Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp77252imm; Fri, 10 Aug 2018 07:54:16 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzvq4NkhJK7Vg9v3uz15wsWli2E/UZNwhGbsSLyQ5GsjwxAX9r9lUjQgzMdfYGV9X+hK0gz X-Received: by 2002:a63:ba54:: with SMTP id l20-v6mr6857682pgu.145.1533912855941; Fri, 10 Aug 2018 07:54:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533912855; cv=none; d=google.com; s=arc-20160816; b=yZTBcPctWTHfi7bfZ3XRjXv/wwEFv1kUvFd/eYsPhHpbT3A9r7l6ZWP+Y/qirinQyd l5fv+V0flpGvR7Pq4Kcx+GrtrCuy21lJ7c+KTA6VKJHKovFAKHjnv67W9Hlmebkz0xdx r+oOH0UCubCExe/pPeC6oIC56adMPiSqIh7ixvlqT+6nGoOVWkEmpDR+NOhf2o9RWNjF ZG2fLVVop1Q4Ftj3J83gUbKjWEKYpovCIadSn6PSwsLeXOEwJa9l7dzK5gsOFp2UuMg0 yajHaHzAzDryELMQp/gS1dAoHT7yjsdXIuL8UUHChqqpkXzzit9xKgeR2a+ESdf+5R7V +WoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version :arc-authentication-results; bh=pa7FxmbHRRU5r+3YlrzOB2oMF5izfnuxuL2q1fIAuZQ=; b=euMaSZxFiuCYtEEOqzxLeKvps/J/r7CabaGIMTlquc/+0nL5fsJR4Fj03UikECcRa0 K2OlYLpHOeUvP8yXM0Hkc8jY2Kg2Okvt0c/k/qI53Bv17RMrFBW0E4Tx9Didjmen8dtf V+9Ao9/Xoln+V4/QH4QOOfTDybxNALhqBOOuCMToNNaTgiV81ibCm6u1mDE6y8hiSIYl 850Ux75iTTpUHEdwM4pD/gAxcg34jWd+9ZMJdDS8TOYQKs61Q41gJWRkbpWJbtP3cZsy AYGXOewpSXS0iv2zFfpQ1nFKoQ+kVstq4nPAdg8j4N+pT179MuggRHqf2YVbyVaR1CM7 Xa4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9-v6si8602023pgf.380.2018.08.10.07.54.00; Fri, 10 Aug 2018 07:54:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728102AbeHJQua (ORCPT + 99 others); Fri, 10 Aug 2018 12:50:30 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:39511 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727519AbeHJQua (ORCPT ); Fri, 10 Aug 2018 12:50:30 -0400 Received: by mail-ed1-f67.google.com with SMTP id h4-v6so4867548edi.6 for ; Fri, 10 Aug 2018 07:20:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=pa7FxmbHRRU5r+3YlrzOB2oMF5izfnuxuL2q1fIAuZQ=; b=Xs8YNuslNSvGtDKJRJm+OcuLdtS42oBevjRY1dief21eg9Amv2z/XtyiAnLXam0Y0E MFJvVptRy77SAgHpVpXm83n3eCWkyZEnEEFg6vUuIL0gYc73TFMDziArGZK/pJ/PPFmD wFAlspW1dlNVT/TtSBVIhI4nL5ziDv3zAtD+JbsawxKJx37cVx/FGLU0LwIekxwE9bK+ p5+LxnP0OX6PTxy3d9e+TrfImlpzcFDJB2KQe/fTodzb9qXUCMkG/wTdlGdAEAKQ9Fny ArHlfoxhie2EIWj7k0Wo1+DryqqDDmJH/QOeHib6EQewBTctozllD+QsJCDvsLPDVYbf pCYw== X-Gm-Message-State: AOUpUlGiVH3CMtYh2kioiqAIfItiXMJqs6+ye8OVRCLy+hRMbgFbJajD wBntrkP7ulvPICj2wjo4tNcYJ5CXAOY= X-Received: by 2002:a50:ccdb:: with SMTP id b27-v6mr8687949edj.98.1533910822614; Fri, 10 Aug 2018 07:20:22 -0700 (PDT) Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com. [74.125.82.43]) by smtp.gmail.com with ESMTPSA id h8-v6sm3963010edi.68.2018.08.10.07.20.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 07:20:21 -0700 (PDT) Received: by mail-wm0-f43.google.com with SMTP id y9-v6so2105620wma.5 for ; Fri, 10 Aug 2018 07:20:20 -0700 (PDT) X-Received: by 2002:a1c:4182:: with SMTP id o124-v6mr1610363wma.101.1533910820744; Fri, 10 Aug 2018 07:20:20 -0700 (PDT) MIME-Version: 1.0 References: <20180810133636.8340-1-efremov@linux.com> In-Reply-To: Reply-To: efremov@linux.com From: Denis Efremov Date: Fri, 10 Aug 2018 17:20:09 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] coccicheck: return proper error code on check fail To: Julia Lawall Cc: Masahiro Yamada , "Luis R . Rodriguez" , Nicolas Palix , Gilles Muller , Michal Marek , linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Do you mean that there is an error in the behavior of coccicheck or that coccicheck finds an error in the source code? An error in the source code. Here is an example of how the patch changes the behavior of 'make coccicheck' (my comments after the ###): Current behavior: $ make M=mymodule coccicheck mymodule/file1.c:97:4-14: ERROR: Assignment of bool to non-0/1 constant mymodule/file2.c:104:4-19: ERROR: Assignment of bool to non-0/1 constant mymodule/file2.c:577:1-15: code aligned with following code on line 583 mymodule/file3.c:439:5-10: Unneeded variable: "error". Return "0" on line 449 mymodule/file4.c:451:5-7: Unneeded variable: "rc". Return "0" on line 455 mymodule/file5.c:433:5-8: Unneeded variable: "ret". Return "0" on line 607 mymodule/file6.c:433:5-10: Unneeded variable: "error". Return "0" on line 440 mymodule/file7.c:774:2-3: Unneeded semicolon coccicheck failed ### <-- Check failed $ echo $? 0 ### <-- But error code signals that everthing is OK After this patch: $ make M=mymodule coccicheck ... coccicheck failed make: *** [Makefile:1636: coccicheck] Error 2 $ echo $? 2 ### <-- The patch changes error code Why does this matter? 1) Because it's clear from the source code that the original intention was to return an error code of checking command, not the "echo 'coccicheck failed'" command. 2) Automated testing systems (CI, for example) rely on the return code.