Skip to contentSkip to conversation

scripts: coccicheck: Fix chain mode in coccicheck

PATCH Superseded Davidson Francis 1 participant 1 message Mar 5, 2021 Coccinelle/Semantic Patches (SmPL)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: coccicheck: Fix chain mode in coccicheck

As described in the Coccinelle documentation (Documentation/dev-tools/ coccinelle.rst), chain mode should try patch, report, context, and org modes until one of them succeed.

It turns out that currently, the 'run_cmd_parmap' function, by failing to run $SPATCH, rather than returning an error code, kills the execution of the script by executing the exit command, rather than returning the error code.

This way, when running coccicheck in chain mode, as in:

    $ make coccicheck MODE=chain

the first .cocci file that does not support one of the virtual rules stops the execution of the makefile, rather than trying the remaining rules as specified in the documentation.

Therefore, modify the coccicheck script to return the error code, rather than terminating the script.

---
 scripts/coccicheck | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coccicheck +1 -1
index 65fee63aeadb..15711bd43395 100755
@@ -153,7 +153,7 @@ run_cmd_parmap() {
 	err=$?
 	if [[ $err -ne 0 ]]; then
 		echo "coccicheck failed"
-		exit $err
+		return $err
 	fi
 }
 
Signature · 1 line
2.29.1