Repository navigation
fix(#4): stop build.sh when the engine version cannot be read - #11
Merged
Merged
Conversation
The jar check read the version as a prefix assignment (VAR="$(extract_version.py ...)" python3 - ...), whose substitution status set -e ignores, so a failing extract_version.py went on with an empty version. It is now its own assignment. tests/test_build_scripts.py scans the build scripts for that pattern and for local/export/readonly/declare substitutions, which hide the status the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4
scripts/build.shread the engine version for its integration-jar check as a prefix assignment:ARCADEDB_VERSION="$(python3 extract_version.py ...)" BUILD_VERSION=... python3 - << 'PY'. Bash ignores the exit status of a command substitution in a prefix assignment, soset -euo pipefaillet a failingextract_version.pythrough, for example with no engine jar or with two engine versions. The script went on with an empty version and failed later with an unrelated message. The version is now read in its own assignment. A failure stops the build at that line, and the extractor's ownError: ...message is the last thing printed.Test plan
tests/test_build_scripts.py::test_no_command_substitution_in_a_prefix_assignmentscansscripts/*.sh. RED: onmainit flags exactlybuild.sh:405. GREEN: it passes with this change.test_scanner_tells_a_prefix_from_a_plain_assignmentpins the scanner on 15 cases. Among them:$(cd "$(dirname ...)" && pwd)and<(...)inside a substitution;; cmdand&& cmdafter an assignment;local/export/readonlysubstitutions.bash -n scripts/build.shand pre-commit pass.Coverage
Invariant: in the build scripts, a failing command substitution stops the build under
set -e.The callers of the version extractor, found with
grep -nE 'extract_version\.py|write_version\.py' scripts/*.sh:build-native.sh:311,PYTHON_VERSION=$(...): a plain assignment, so it was already stopped byset -e.build-native.sh:330,write_version.py: a plain command.build.sh:405: fixed here.The workflows'
ARCADEDB_TAG=$(python3 scripts/extract_version.py ...)lines are plain assignments in abash -estep, so they were already safe.For other lines of the same shape, the test scans every
scripts/*.shfor:$(...)or backticks, andlocal,export,readonlyanddeclareassignments holding a substitution.After the fix it finds none.
Known gaps: None in the scripts. The scanner reads one line at a time, so a substitution split across lines or built with
evalwould not be seen; the test's docstring says so.Adversarial pass
I ran one independent review. It confirmed that the fix holds and runs in CI (both workflows pass a jars dir, which sets
JAR_LIB_DIR), and found these scanner gaps:V="$(a)"; cmd. Fixed: an unquoted;,&or|now ends the word.local/export/readonly V=$(cmd)and backticks not caught. Fixed: both are flagged now. None appear in the scripts today.evaland heredoc forms. Documented in the test's docstring as out of scope; none are used in the scripts.read_text()without an encoding fails on Windows outside UTF-8 mode. Fixed: it now reads withencoding="utf-8".bash.exeon Windows. Fixed by dropping that test; it tested bash itself, not our scripts.Review cycles
This repository has no Claude review workflow, so no bot review was waited for. Final state:
no-reviewer.🤖 Generated with Claude Code