What changed, and why it matters
This commit is a routine internal cleanup of Bitcoin Core's continuous integration (CI) scripts. It moves logic from a Bash script into an equivalent Python script to avoid a shell lint warning about word splitting. There is no user-facing change, no network code change, and no security-relevant behavior change.
No security action required. This is a normal CI maintenance refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change deletes ci/test/02_run_container.sh and inlines its behavior into ci/test/02_run_container.py. Previously, the Python script set CI_CONTAINER_ID and called the Bash script, which built a single-string command prefix CI_EXEC_CMD_PREFIX=’docker exec ${CI_CONTAINER_ID}’ and invoked it via a Bash function. The new Python code builds the same docker exec command as a proper list of arguments, avoiding the SC2086 shellcheck warning about unquoted variable expansion. The rsync, base install, and test script invocations remain functionally identical; only the wrapper language changes.
Changed components
ci/test/02_run_container.pyci/test/02_run_container.shInspect captured patch +21 / −25
diff --git a/ci/test/02_run_container.py b/ci/test/02_run_container.py
index 377ccfa9..d9ef27b4 100755
--- a/ci/test/02_run_container.py
+++ b/ci/test/02_run_container.py
@@ -162,9 +162,28 @@ def main():
stdout=subprocess.PIPE,
text=True,
).stdout.strip()
- os.environ["CI_CONTAINER_ID"] = container_id
- run(["./ci/test/02_run_container.sh"]) # run the remainder
+ def ci_exec(cmd_inner, **kwargs):
+ if os.getenv("DANGER_RUN_CI_ON_HOST"):
+ prefix = []
+ else:
+ prefix = ["docker", "exec", container_id]
+
+ return run([*prefix, *cmd_inner], **kwargs)
+
+ # Normalize all folders to BASE_ROOT_DIR
+ ci_exec([
+ "rsync",
+ "--recursive",
+ "--perms",
+ "--stats",
+ "--human-readable",
+ f"{os.environ['BASE_READ_ONLY_DIR']}/",
+ f"{os.environ['BASE_ROOT_DIR']}",
+ ])
+ ci_exec([f"{os.environ['BASE_ROOT_DIR']}/ci/test/01_base_install.sh"])
+ ci_exec([f"{os.environ['BASE_ROOT_DIR']}/ci/test/03_test_script.sh"])
+
if not os.getenv("DANGER_RUN_CI_ON_HOST"):
print("Stop and remove CI container by ID")
run(["docker", "container", "kill", container_id])
diff --git a/ci/test/02_run_container.sh b/ci/test/02_run_container.sh
deleted file mode 100755
index 9771065e..00000000
--- a/ci/test/02_run_container.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env bash
-#
-# Copyright (c) 2018-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.
-
-export LC_ALL=C.UTF-8
-
-set -o errexit -o pipefail -o xtrace
-
-if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
- export CI_EXEC_CMD_PREFIX="docker exec ${CI_CONTAINER_ID}"
-fi
-
-CI_EXEC () {
- $CI_EXEC_CMD_PREFIX "$@"
-}
-export -f CI_EXEC
-
-# Normalize all folders to BASE_ROOT_DIR
-CI_EXEC rsync --recursive --perms --stats --human-readable "${BASE_READ_ONLY_DIR}/" "${BASE_ROOT_DIR}"
-CI_EXEC "${BASE_ROOT_DIR}/ci/test/01_base_install.sh"
-CI_EXEC "${BASE_ROOT_DIR}/ci/test/03_test_script.sh"
Why this scored 15/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.