linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: efremov@linux.com
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: 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,
	Denis Efremov <efremov@linux.com>
Subject: [PATCH] coccicheck: return proper error code on check fail
Date: Fri, 10 Aug 2018 16:36:36 +0300	[thread overview]
Message-ID: <20180810133636.8340-1-efremov@linux.com> (raw)

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

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


             reply	other threads:[~2018-08-10 13:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10 13:36 efremov [this message]
2018-08-10 13:42 ` [PATCH] coccicheck: return proper error code on check fail 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 ` [PATCH v2] coccicheck: return proper error code on fail efremov
2018-08-10 20:31   ` 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=20180810133636.8340-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;
as well as URLs for NNTP newsgroup(s).