lint: Require scripted-diff script to succeed
What changed, and why it matters
This commit tightens a Bitcoin Core lint check that verifies 'scripted-diff' commits. Previously, the shell command running the script could silently ignore failures due to a fragile chain of '&&' and '||' operators. The fix makes the script explicitly fail if the scripted diff does not apply cleanly or leaves unexpected changes. It is a hardening improvement in developer tooling, not a fix for an active vulnerability in the Bitcoin software itself.
No urgent action required. Treat as routine developer-tooling hardening. Ensure CI continues to pass and consider backporting only if the project maintains strict lint consistency across branches.
Security signals we found
Hardening of CI lint script
Failure to fail open in validation logic
Use of stricter shell options (errexit, nounset, pipefail)
No direct change to consensus, networking, wallet, or RPC code
Evidence from the diff
The change is in test/lint/commit-script-check.sh, a CI lint script that validates commits tagged with ‘scripted-diff’. The old code used ‘(eval “$SCRIPT”) && git –no-pager diff –exit-code “$commit” && echo “OK” >&2 || (echo “Failed” >&2; false) || RET=1’. In POSIX sh, this kind of mixed logical-operator chain can short-circuit in ways that fail to set RET=1 if an intermediate command succeeds. The new code uses an explicit if/else with bash -o errexit -o nounset -o pipefail, ensuring the script body is executed strictly and any failure sets RET=1. The shebang was also changed from /bin/sh to /bin/env bash to allow bash-specific options.
Changed components
test/lint/commit-script-check.shInspect captured patch +7 / −3
diff --git a/test/lint/commit-script-check.sh b/test/lint/commit-script-check.sh
index 94b0708f..08fed219 100755
--- a/test/lint/commit-script-check.sh
+++ b/test/lint/commit-script-check.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
# Copyright (c) 2017-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -41,8 +41,12 @@ for commit in $(git rev-list --reverse "$1"); do
else
echo "Running script for: $commit" >&2
echo "$SCRIPT" >&2
- (eval "$SCRIPT") && \
- git --no-pager diff --exit-code "$commit" && echo "OK" >&2 || (echo "Failed" >&2; false) || RET=1
+ if bash -o errexit -o nounset -o pipefail -c "$SCRIPT" && git --no-pager diff --exit-code "$commit"; then
+ echo "OK" >&2
+ else
+ echo "Failed" >&2
+ RET=1
+ fi
fi
git reset --quiet --hard HEAD
else
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.