chg: ci: Fail when spatch can't process source code

Sometimes spatch fails to process the source code:

    EXN: Failure("replacement: node 80: {7[1,2,30,31,32] in isc__nm_base64_to_base64url reachable by inconsistent control-flow paths") in ./lib/isc/netmgr/http.c

Closes #5567

Merge branch '5567-spatch-detect-more-error-conditions' into 'main'

See merge request isc-projects/bind9!11115
This commit is contained in:
Michal Nowak 2025-10-22 13:27:45 +02:00
commit dedc17d1a4
4 changed files with 5 additions and 8 deletions

View file

@ -697,6 +697,7 @@ coccinelle:
- '**/*.c'
- '**/*.h'
- 'cocci/**'
- 'util/check-cocci.sh'
- *rule_mr_manual
- *rule_tag
- *rule_source_other_than_mr

View file

@ -2,5 +2,5 @@
expression e;
@@
-DNS_TYPEPAIR_VALUE(dns_rdatatype_rrsig,
+DNS_SIGTYPE(
+DNS_SIGTYPEPAIR(
e)

View file

@ -3539,9 +3539,7 @@ isc__nm_base64url_to_base64(isc_mem_t *mem, const char *base64url,
INSIST(i == len);
if (res_len != NULL) {
*res_len = len;
}
SET_IF_NOT_NULL(res_len, len);
res[len] = '\0';
@ -3592,9 +3590,7 @@ isc__nm_base64_to_base64url(isc_mem_t *mem, const char *base64,
}
}
end:
if (res_len) {
*res_len = i;
}
SET_IF_NOT_NULL(res_len, i);
res[i] = '\0';

View file

@ -23,7 +23,7 @@ run_spatch() {
echo "Applying semantic patch $spatch..."
spatch --jobs "${TEST_PARALLEL_JOBS:-1}" --sp-file "$spatch" --use-gitgrep --dir "." --include-headers $spatchargs >>"$patch" 2>cocci.stderr
cat cocci.stderr
if grep -q -e "parse error" cocci.stderr; then
if grep -q -e "parse error" -e "EXN: Failure" cocci.stderr; then
ret=1
fi
if [ "$(wc <"$patch" -l)" -gt "0" ]; then