Linux kbuild/kconfig development
 help / color / mirror / Atom feed
* [PATCH] kbuild: reject nonzero checker exit status in checker-valid.sh
@ 2026-12-01 22:00 Hamdy Abou El Anein
  0 siblings, 0 replies; only message in thread
From: Hamdy Abou El Anein @ 2026-12-01 22:00 UTC (permalink / raw)
  To: nathan, nsc; +Cc: linux-kbuild, linux-kernel, irogers, tglx, peterz

The checker validation script only examines the output for the word
"error". If the checker fails without printing that word, the pipeline
still reports 1, and Kbuild treats the checker as functional.

Check the invocation's exit status before scanning its output. Retain
the existing output check because sparse can return zero on error.

Tested using a mock checker that succeeds, fails silently, fails with
a diagnostic, or reports an error while returning zero. Also verified
that a missing checker is still rejected.

AI assistance: ChatGPT identified the bug by inspecting the script and
prepared the fix, commit message and local regression tests.

Fixes: fd69b2f7d5f4 ("compiler: Use __typeof_unqual__() for __unqual_scalar_typeof()")
Signed-off-by: Hamdy Abou El Anein <info@daylightlinux.ch>
---
 scripts/checker-valid.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/checker-valid.sh b/scripts/checker-valid.sh
index 625a789ed1c8..38defc32cbd9 100755
--- a/scripts/checker-valid.sh
+++ b/scripts/checker-valid.sh
@@ -14,6 +14,10 @@ static inline int u(const int *q)
 }
 EOF
 
-# sparse happily exits with 0 on error so validate
-# there is none on stderr. Use awk as grep is a pain with sh -e
-$@ $tmp_file 2>&1 | awk -v c=1 '/error/{c=0}END{print c}'
+# Reject a failed checker invocation even if it prints no error.
+# sparse may also exit with 0 on error, so inspect its output.
+if output=$("$@" "$tmp_file" 2>&1); then
+	printf '%s\n' "$output" | awk -v c=1 '/error/{c=0}END{print c}'
+else
+	echo 0
+fi
-- 
2.56.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-01 22:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 22:00 [PATCH] kbuild: reject nonzero checker exit status in checker-valid.sh Hamdy Abou El Anein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox