public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: efremov@linux.com
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Denis Efremov <efremov@linux.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	"Luis R . Rodriguez" <mcgrof@kernel.org>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	Michal Marek <michal.lkml@markovi.net>,
	linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org
Subject: [PATCH v2] coccicheck: return proper error code on fail
Date: Fri, 10 Aug 2018 23:25:55 +0300	[thread overview]
Message-ID: <20180810202555.11034-1-efremov@linux.com> (raw)
In-Reply-To: <20180810133636.8340-1-efremov@linux.com>

From: Denis Efremov <efremov@linux.com>

If coccicheck fails, it should return an error code distinct from zero
to signal about an internal problem. Current code instead of exiting with
the tool's error code returns the error code of 'echo "coccicheck failed"'
which is almost always equals to zero, thus failing the original intention
of alerting about a problem. This patch fixes the code.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 scripts/coccicheck | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/coccicheck b/scripts/coccicheck
index 9fedca611b7f..e04d328210ac 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -128,9 +128,10 @@ run_cmd_parmap() {
 	fi
 	echo $@ >>$DEBUG_FILE
 	$@ 2>>$DEBUG_FILE
-	if [[ $? -ne 0 ]]; then
+	err=$?
+	if [[ $err -ne 0 ]]; then
 		echo "coccicheck failed"
-		exit $?
+		exit $err
 	fi
 }
 
-- 
2.17.1


  parent reply	other threads:[~2018-08-10 20:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10 13:36 [PATCH] coccicheck: return proper error code on check fail efremov
2018-08-10 13:42 ` Julia Lawall
2018-08-10 14:20   ` Denis Efremov
2018-08-10 14:28     ` Julia Lawall
2018-08-10 14:45       ` Denis Efremov
2018-08-10 18:23         ` Himanshu Jha
2018-08-10 20:25 ` efremov [this message]
2018-08-10 20:31   ` [PATCH v2] coccicheck: return proper error code on fail Julia Lawall
2018-08-13  7:28     ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180810202555.11034-1-efremov@linux.com \
    --to=efremov@linux.com \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Julia.Lawall@lip6.fr \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.palix@imag.fr \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox