Skip to contentSkip to conversation

check-uapi: avoid truncating the failure count in the exit status

PATCH In review Hamdy Abou El Anein 3 participants 3 messages Nov 7 – Nov 23 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 check-uapi: avoid truncating the failure count in the exit status

From: Hamdy Abou El Anein <[email protected]>

check_uapi_files() returns the number of failed header checks as its status. Bash truncates this to eight bits, so 256 failed checks return zero. run() then treats the ABI check as successful. With -q, the error diagnostics are hidden as well.

Return a boolean status instead, while keeping the full failure count in the existing summary.

Tested the complete CLI with fixture Git trees containing 0, 1, 255, 256, 257 and 512 removed headers, plus -j 1 and -q. The 256- and 512-failure cases now exit 1 instead of 0.

AI assistance: ChatGPT/Codex identified the issue and prepared the change, commit message and executable regression tests.

Fixes 1f7f31bf7202 ("check-uapi: Introduce check-uapi.sh")

---
The regression fixtures use a minimal headers_install Makefile and an abidiff stand-in that only supplies --version. Actual removed-header checks, Git archives and the CLI exit path are exercised; no ABI comparison is invoked for these removed headers.

 scripts/check-uapi.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/check-uapi.sh +1 -1
index c8beec588..93095a5b8 100755
@@ -295,7 +295,7 @@ check_uapi_files() {
 			"$total" "$ARCH"
 	fi
 
-	return "$failed"
+	return "$((failed != 0))"
 }
 
 # Check an individual file for UAPI compatibility

base-commit: d48723711bae9b8cdc56719c448ba42fef28cbee

Signature · 1 line
2.56.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines

check_uapi_files() returns the number of failed header checks as its status. Bash truncates this to eight bits, so 256 failed checks return zero. run() then treats the ABI check as successful. With -q, the error diagnostics are hidden as well.

Return a boolean status instead, while keeping the full failure count in the existing summary.

Tested the complete CLI with fixture Git trees containing 0, 1, 255, 256, 257 and 512 removed headers, plus -j 1 and -q. The 256- and 512-failure cases now exit 1 instead of 0.

Quoted 5 lines

AI assistance: ChatGPT/Codex identified the issue and prepared the change, commit message and executable regression tests.

Fixes 1f7f31bf7202 ("check-uapi: Introduce check-uapi.sh")

Seems a little contrived but the fix is simple so:

Signature · 2 lines
Cheers,
Nathan
maintainer
#2 lore raw
In reply to Hamdy Abou El Anein
Quoted 1 line · Hamdy Abou El Anein

check-uapi: avoid truncating the failure count in the exit status

Applied to kbuild/linux.git (kbuild-next-unstable), thanks!

[1/1] check-uapi: avoid truncating the failure count in the exit status

      https://git.kernel.org/kbuild/c/d45fe61e

Please look out for regression or issue reports or other follow up comments, as they may result in the patch/series getting dropped, reverted or modified (e.g. trailers).

Patches applied to the kbuild-next-unstable branch are accepted pending wider testing in linux-next and any post-commit review; they will generally be moved to the kbuild-next branch in about a week if no issues are found.

Best regards,

Signature · 1 line
Nicolas