Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp54236imm; Fri, 10 Aug 2018 07:31:18 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyyTaHCzL5jWo5swZ2jQl0TViRVZBBNTh7K57SxeMV19xlvnUKxIflkMgKmcGcL5YEcnsn9 X-Received: by 2002:a17:902:8e86:: with SMTP id bg6-v6mr6379856plb.108.1533911478375; Fri, 10 Aug 2018 07:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533911478; cv=none; d=google.com; s=arc-20160816; b=qAN06bvDAEfIHjtTnfjYenaHma0yvsziyBZuXNTSm5APDx1eZ87KmfQe0h9XzWBhD7 /SIEFOz90zzNnkBQuHL+qYf4i1exOlnYr/Y0n13v2L93fajnBUYpYtiJRXa6FGlB1QJL icIRwtbRcE3DAN2hiy4OSGO7UwKK0vpvIypx4AFr3QZy18mbMHeYRZkJE2NYCZW6Zcfo uskETzMs1RoBjiI/E5smzMz4TteZdCWhoRVtD93IPSiFkQRV34MyPkWJrwln31qhuK0Q zP1r7JoDKodx2Q99UZoy/ltWOQo8ivU3I/HzJTbpyCHksVky8VUr1U/xzZZvQSDkbbzA TzBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=Ga3SqFoynFtObNm98c8OE+ahrAElldrSH2J1WTWbnFo=; b=nGwwClTQ6bc69h+9odJs3Zx2G2iu1F/Scujvw9CVpgwPc+4mt+jQzSgzfEG9trwbfX debhOv/y65ZmmkwauohCNcPqlviU39q74SjOFrwARJAkFe+P2l18otmpLSJaQRavTH7r yGiFcCJPqBn3eV/DkKDAJRDQ12xvuYK4A1VIkHApeP2GeEPBt5REc6tk0V4NeI+ffy5l km/llnrM4WbR1bQDI44xwTyMCmGOSCJxl4/v8L0VWOcOo2YkOL9PwpGDaAQbGKUpUz/B u3yZrRAbNkOFu7alBGkeeAbREs3Oa7RuqI5XYIp4RhRA/7Ql8o8C0ZINN4Wj/J6UqX5R JEFg== 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 n11-v6si7696971plg.344.2018.08.10.07.31.02; Fri, 10 Aug 2018 07:31:18 -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 S1728287AbeHJQ7Q (ORCPT + 99 others); Fri, 10 Aug 2018 12:59:16 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:46978 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727432AbeHJQ7Q (ORCPT ); Fri, 10 Aug 2018 12:59:16 -0400 X-IronPort-AV: E=Sophos;i="5.53,220,1531778400"; d="scan'208";a="342063467" Received: from vaio-julia.rsr.lip6.fr ([132.227.76.33]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Aug 2018 16:29:05 +0200 Date: Fri, 10 Aug 2018 16:28:58 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Denis Efremov cc: Masahiro Yamada , "Luis R . Rodriguez" , Nicolas Palix , Gilles Muller , Michal Marek , linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: Re: [PATCH] coccicheck: return proper error code on check fail In-Reply-To: Message-ID: References: <20180810133636.8340-1-efremov@linux.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 10 Aug 2018, Denis Efremov wrote: > > 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 Are you sure that this coccicheck failed has any connection to the various messages printed above it? Normally Coccinelle has no idea about the semantics of messages printed using python script code. I'm not sure what would cause it to return an error code because a particular script was activated. julia > $ 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. >