ci: Document why IN_GETOPT_BIN env var is needed on macOS
What changed, and why it matters
This commit is purely a code cleanup and documentation change in Bitcoin Core's continuous integration (CI) scripts. It moves a small macOS-specific environment variable setup from a shell script into a Python wrapper, and adds a comment explaining why GNU getopt is needed. There is no security-relevant change here.
No security action needed. Treat as normal CI maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change relocates the setting of IN_GETOPT_BIN (pointing to GNU getopt installed via Homebrew on macOS) from ci/test/02_run_container.sh to ci/test/02_run_container.py, and adds a comment that GNU getopt is required for the CI_RETRY_EXE script. Functionally equivalent; no privilege, input handling, or cryptographic changes.
Changed components
ci/test/02_run_container.pyci/test/02_run_container.shInspect captured patch +9 / −5
diff --git a/ci/test/02_run_container.py b/ci/test/02_run_container.py
index f1bb85c3..4d0bed2a 100755
--- a/ci/test/02_run_container.py
+++ b/ci/test/02_run_container.py
@@ -145,6 +145,15 @@ def main():
).stdout.strip()
os.environ["CI_CONTAINER_ID"] = container_id
+ # GNU getopt is required for the CI_RETRY_EXE script
+ if os.getenv("CI_OS_NAME") == "macos":
+ prefix = run(
+ ["brew", "--prefix", "gnu-getopt"],
+ stdout=subprocess.PIPE,
+ text=True,
+ ).stdout.strip()
+ os.environ["IN_GETOPT_BIN"] = f"{prefix}/bin/getopt"
+
run(["./ci/test/02_run_container.sh"]) # run the remainder
diff --git a/ci/test/02_run_container.sh b/ci/test/02_run_container.sh
index beb9f139..251b01c0 100755
--- a/ci/test/02_run_container.sh
+++ b/ci/test/02_run_container.sh
@@ -17,11 +17,6 @@ else
mkdir -p "${PREVIOUS_RELEASES_DIR}"
fi
-if [ "$CI_OS_NAME" == "macos" ]; then
- IN_GETOPT_BIN="$(brew --prefix gnu-getopt)/bin/getopt"
- export IN_GETOPT_BIN
-fi
-
CI_EXEC () {
$CI_EXEC_CMD_PREFIX bash -c "export PATH=\"/path_with space:${BINS_SCRATCH_DIR}:${BASE_ROOT_DIR}/ci/retry:\$PATH\" && cd \"${BASE_ROOT_DIR}\" && $*"
}
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.