Repository navigation
lane tools: quoted() and lane-end read a single quote back on bash 3.2 - #69
Conversation
…ads back on bash 3.2
quoted() prints its arguments as shell words, for the messages a person
copies and runs. It spelled a single quote with "${q_a//\'/\'\\\'\'}".
Inside double quotes bash 3.2 (3.2.57), and bash 5.2 under BASH_COMPAT 31
to 42, keep the backslashes of the replacement half, so /p/it's here printed
'/p/it\'\\'\'s here' on 3.2 and eval of that line failed. Bash 4.3 and later
strip them, which is why every GNU runner was green. A space, a double quote,
a backslash, $ and a newline always read back.
Found by lane 4's review of opensoft/openRepoTools#165 (comment 6833596198,
RC-W12f's SHOULD, checked by its QA-QUOTED). The fix is its form: set
q_r="'\\''" once, then substitute "${q_a//\'/$q_r}". A variable's value is not
read again, so every bash gives '\''. Both copies change, and nothing else in
either file but the comment that says why.
tests/test_quoted_bash32_compat.py cuts each copy out of the shipped file and
runs it with BASH_COMPAT unset and at 32 and 42 (and under /bin/bash where
that is another file, which on the macOS job is the real 3.2.57). It checks
that eval in bash and in sh gives back every argument exactly, over 23 cases:
one quote, two and three in a row, a quote at the start, at the end and at
both, only a quote, a space, a double quote, a backslash, a backslash then a
quote, $ and $(), a backtick, a glob, a newline, an empty string, a plain
word, safe punctuation, an em dash, several arguments and none. At BASH_COMPAT
32 and 42 the old line fails the 11 cases that hold a quote, in both readers;
the new line fails none.
Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lf of a double-quoted substitution
The rule on the replacement half of ${var/pat/rep} needs a double quote
between the braces, so it never saw quoted()'s old line,
"${q_a//\'/\'\\\'\'}", where the quote is outside them. Bash 3.2 and
BASH_COMPAT up to 42 keep the backslashes in such a replacement (see the
fix to quoted() in lane-start and lane-handoff, from opensoft/openRepoTools#165
comment 6833596198), so the line printed \'\\'\' where '\'' was meant.
test_no_shipped_bash_quotes_the_replacement_half_of_a_substitution now also
fails a line, outside a comment, that holds a ${var/pat/rep} inside double
quotes whose replacement half holds a backslash and a single quote. What it
flagged before is unchanged. Outside double quotes every bash takes the
backslash off, so a bare one is no hit, and neither is a quote only in the
pattern half or a backslash every bash reads the same ("${v//\\/\\134}").
Checked by hand: the old line, taken from both files at 59c26e8, is flagged
by the new check and by none of the old regex; the new line is not flagged. A
parametrized test pins that with 12 lines.
One shipped line is flagged and is not this change's to fix: lane-end's
sc_find_err_path, sfe_x="${sfe_x//\\\'/\'}", which gives \' for ' under
BASH_COMPAT 42 and below. It is reached only from GNU find's message. It is
listed in KNOWN_ESCAPED_QUOTE_REPLACEMENTS, and a test fails once the file no
longer holds it, so the entry leaves with the fix.
Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e exemption it needed
sc_find_err_path turns GNU find's \' in a quoted path back into ' with
sfe_x="${sfe_x//\\\'/\'}". It is the same replacement quoted() had, and the
same defect: inside double quotes bash 3.2 and BASH_COMPAT up to 42 keep the
backslash of the literal \' replacement, so /p/it's here came back as
/p/it\'s here. The widened hygiene rule from the previous commit found it, and
the lane 3 coordinator asked for it to be fixed on this branch.
The fix is quoted()'s: the quote is put in a variable, sfe_q="'", and the
substitution is "${sfe_x//\\\'/$sfe_q}". It is the one line, set on that line,
and a two-line comment beside it. Nothing else in lane-end changes, so lane 4's
T403, which changes lane-end only from old line 1775 down, is not touched.
tests/test_repo_hygiene.py: the exemption the previous commit added
(KNOWN_ESCAPED_QUOTE_REPLACEMENTS, and the test that held the entry) goes,
since no shipped line is flagged now. Checked by hand over all 14 shipped bash
files: no hit, and the 12 pinned lines still come out as pinned.
tests/test_quoted_bash32_compat.py gains a read-back case for
sc_find_err_path. The function is nested in a block of lane-end, so it is cut
out by its own indent and run with BASH_COMPAT unset and at 32 and 42 (and
under /bin/bash where that is another file). It is given find's error line for
10 paths and must print each path exactly: one quote, two in a row, a quote at
the start, at the end and alone, a backslash then a quote, a space, a
backslash, a plain word, and BSD find's unquoted form. At BASH_COMPAT 32 and
42 the old line fails the 6 that hold a quote; the new line fails none.
Lane: openRepoTools-3
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 21 hours and 32 minutes by commenting |
Reviewer's GuideImplementationUpdate both
TestsAdd cross-version read-back tests for the shipped quoting and path-unquoting functions, and extend hygiene checks to catch the unsafe substitution spelling.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
… for the code queue Code main's tip is a15a6b5 (#74). The code queue's check needs the pull request's base to be main's tip and main to be an ancestor of its head (.github/ci/delivery_verify.py:296 and :299 at code 908d815, unchanged at a15a6b5). The merge is clean, and the pull request's own diff against main is unchanged: its patch-id is ea1884598f20732940c059131d814e6887707000 before and after. Lane: openRepoTools-3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… for the code queue Code main's tip is eff8459 (#82). The code queue's check needs the pull request's base to be main's tip and main to be an ancestor of its head (.github/ci/delivery_verify.py:296 and :299 at code eff8459, as at 908d815). The merge is clean, and the pull request's own diff against main is unchanged: its patch-id is ea1884598f20732940c059131d814e6887707000 before and after. Lane: openRepoTools-3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
{
"schema_version": 1,
"repository": "opensoft/openRepoTools-code",
"pull_request": 69,
"head_sha": "6a9350517e255bfc6122e4a07673931dc22a9b15",
"base_sha": "eff8459657e9a970d46a0cdef5cbd531cbe0e9cd",
"reviewer": "codex-local",
"skill": "pr-review",
"status": "accepted",
"unresolved_findings": 0,
"findings": "None. No BLOCKING, SHOULD, or NIT finding exists at head `6a9350517e255bfc6122e4a07673931dc22a9b15` against base `eff8459657e9a970d46a0cdef5cbd531cbe0e9cd`. The mandatory expert panel likewise reported no actionable correctness, security, compatibility, reliability, contract, performance, test, or maintainability issue.",
"resolution": "No code change is requested. The merge refresh exactly reproduces the synthetic merge tree, preserves the stable patch ID, and leaves all five PR-owned blobs identical to reviewed parent `2b5239ba8afc9e4169fc8cf94c5f96fa98b10ac6`. The six intervening main commits do not conflict or interact unsafely with the Bash quoting fix.",
"validation": "The focused runner passed `37/37`; the repository hygiene module passed `252` tests with `18` skips and no failures. The merge tree, patch ID, changed-file blobs, base ancestry, queue-path scope, whitespace, and final clean detached state all passed. Live GitHub state, hosted full-CI gates, native Bash 3.2, and the complete suite remain outside this offline review."
} |
|
@Mergifyio queue openrepotools-code |
|
✅ Merged into
|
…resh its base for the code queue Code main's tip is c62ba9c, the merge of #69 at 2026-11-14T17:17:27Z. The code queue's check needs the pull request's base to be main's tip and main to be an ancestor of its head (.github/ci/delivery_verify.py:296 and :299, the same blob at code eff8459 and c62ba9c). The merge is clean: the 13 files main changed since a15a6b5 do not include lane-worktrees or tests/test_lane_worktrees_report.py, so the pull request's change is unchanged from 7d2b3ee. Lane: openRepoTools-3 Co-Authored-By: Claude Opus 5.5 <[email protected]>



Lane: openRepoTools-3
Claim: none (lane 3's own lane-tooling fix; Brett's per-PR word, Q5, opensoft/openRepoTools#165 6866656915)
Lane tooling, outside feature 007's task sets.
quoted()inlane-startandlane-handoff, andsc_find_err_pathinlane-end, handled a single quote with a substitution that bash 3.2 reads differently from every newer bash, so a path such as/p/it's herewas printed, or read back, wrongly. This PR fixes all three, widens the hygiene test so that spelling is refused wherever it comes back, and adds read-back tests that run the shipped functions withBASH_COMPATunset and at 32 and 42. Brett Heap gave his word for this PR on 2026-11-13, and it lands through theopenrepotools-codemerge queue once it has the gates in "Landing".What
The defect. Inside double quotes, bash 3.2 (3.2.57, the one Apple ships) and bash 5.2 under
BASH_COMPAT31 to 42 keep the backslashes in the replacement half of${var/pat/rep}. Bash 4.3 and later, and anyBASH_COMPATabove 42, take them off, which is why every GNU runner was green.quoted(), one copy in each oflane-startandlane-handoff, prints its arguments as shell words for the messages a person copies and runs. It spelled a single quote as"${q_a//\'/\'\\\'\'}". Where the backslashes stay,/p/it's hereprints with runs of\'where'\''was meant, andevalof the printed line fails. A space, a double quote, a backslash, a dollar sign and a newline read back exactly all along; only the single quote did not.sc_find_err_path, inlane-end, turns GNU find's\'in a quoted path back into'with"${sfe_x//\\\'/\'}". It is the same replacement with the same defect:/p/it's herecame back as/p/it\'s here.Both substitutions, old and new as written in the diff, were re-run on bash 5.2.21 for this text. No real bash 3.2 is on that host, so these are the
BASH_COMPATlevels that behave as 3.2 does:quoted()'s old line gives/p/it'\''s herewithBASH_COMPATunset and at 43, which is right, and/p/it\'\'\'s hereat 32 and at 42. The new line gives/p/it'\''s hereat all four.sc_find_err_path's old line gives/p/it's hereunset and at 43, and/p/it\'s hereat 32 and 42. The new line gives/p/it's hereat all four.The fix. The quote goes into a variable and the substitution uses the variable. A variable's value is not read again, so every bash gives the same text. In both copies of
quoted()it isq_r="'\\''"and then"${q_a//\'/$q_r}". Inlane-endit issfe_q="'"and then"${sfe_x//\\\'/$sfe_q}", set on the same line. Each change has a short comment saying why. Nothing else in those three files changes.The hygiene rule.
tests/test_repo_hygiene.pyalready refuses a quoted replacement half in a substitution, but that rule needs a double quote between the braces, so it never sawquoted()'s old line. It now also fails a line, outside a comment, that holds a${var/pat/rep}inside double quotes whose replacement half holds a backslash and a single quote. A bare one is no hit, because outside double quotes every bash takes the backslash off. A quote only in the pattern half is no hit, and neither is a backslash every bash reads the same ("${v//\\/\\134}"). The widened rule passes on the 14 shipped bash files inALL_BASH, and, throughtests/test_claude_current.py's per-file rule, onclaude-currentandclaude-restart-check, at this head (in the verify run below, whose selector takesclaude_current).Five files change, +333 and -3:
lane-end,lane-handoff,lane-start, the newtests/test_quoted_bash32_compat.py, andtests/test_repo_hygiene.py.The three commits
648cbcc:quoted()in both tools, and the new read-back module with 23 argument sets.47788f9: the widened hygiene rule, pinned by 12 lines. It found one shipped line,lane-end'ssc_find_err_path, and listed it as a known exception with a test that fails once the file no longer holds it, so the exception leaves with the fix.f2188f6:lane-end's fix, which removes that exception and its test, and a read-back case forsc_find_err_pathover 10 paths.The queue merges with
merge_method: merge(.mergify.yml:97), so main keeps the three commits as written.Why
quoted(): found by lane 4's review of Amendment 22 act 2: the SQL register under lanes-edit.sh — mode=primary writers in one transaction each, the estate switch and lanes/STORE, the write journal and the renderer (one mirror commit per write), exit 69, fail-closed readers, lanes-index import/rollback, SERIALIZABLE claim order, and the agreement tests openRepoTools#165 (Amendment 22 act 2: the SQL register under lanes-edit.sh — mode=primary writers in one transaction each, the estate switch and lanes/STORE, the write journal and the renderer (one mirror commit per write), exit 69, fail-closed readers, lanes-index import/rollback, SERIALIZABLE claim order, and the agreement tests openRepoTools#165 (comment), RC-W12f's SHOULD, checked by its QA-QUOTED). The fix is the form that review gave.sc_find_err_path: found by the widened rule in47788f9, the one shipped line it flagged. The lane 3 coordinator asked for it to be fixed on this branch.Tests
tests/test_quoted_bash32_compat.py(new). It cuts each function out of the shipped file as written there and runs it inbashwithBASH_COMPATunset and at 32 and 42, the two ends of the levels that keep the backslashes (32 is the macOS bash's own level, and 42 is the last one below bash 4.3's change). It also runs it under/bin/bashwhere that is another file, which on a Mac is the real 3.2.57. CI has no macOS test job at660459fa(.github/workflows/tests.yml:7-10), so CI checks theBASH_COMPATemulation only. What it printed is read back byevalinbashand insh, and each argument must come out exactly as it went in.test_quoted_prints_a_line_that_reads_back_whatever_the_bash: 2 tools and 3 levels, so 6 items, over 23 argument sets. They are one quote, two and three in a row, a quote at the start, at the end and at both, only a quote, only two, a space, a double quote, a backslash, a backslash then a quote, a dollar sign with a command substitution, a backtick, a glob, a newline, an empty string, a plain word, safe punctuation, an em dash, several arguments and none.test_sc_find_err_path_gives_back_the_path_whatever_the_bash: 3 items, each over 10 find error lines (one quote, two in a row, a quote at the start, at the end and alone, a backslash then a quote, a space, a backslash, a plain word, and BSD find's unquoted form).tests/test_repo_hygiene.py:test_the_escaped_quote_rule_flags_the_old_quoted_line_and_not_the_new_one: 12 pinned lines, the oldquoted()line flagged and the new one not;test_no_shipped_bash_quotes_the_replacement_half_of_a_substitutionis the existing test, now also running the widened rule on each of the 14 shipped bash files inALL_BASH.BASH_COMPAT32 and 42 the oldquoted()line fails the 11 of 23 sets that hold a quote, in both readers, and the oldsc_find_err_pathline fails the 6 of 10 that hold one. The new lines fail none.verify/l3/quoted-bash32-f2188f6(head81ba4230, a commit that carries only trailers onf2188f6and has the same tree), over59c26e8, this branch's base and not main as it now stands (660459fa), PostgreSQL off, selectorquoted_bash32_compat or repo_hygiene or lane_start or lane_handoff or lane_end or triad_lane_tooling or claude_current: 559 passed, 0 failed, 25 skipped; exit 0. Targeted verification is "feedback, never full integration or release acceptance" (.github/ci/task-set-delivery.md:39-40). The four full gates below are the acceptance. No test was run on the merge with660459fa.Task-set fields
.github/ci/task-set-delivery.md:57-59 says to "assign each task to one set and one PR. Record set ID, outcome, task IDs, immediate predecessor, fast verification command and safe intermediate state." This change has no task in a tasks.md, and the fields are recorded anyway.quoted()inlane-startandlane-handoff, andsc_find_err_pathinlane-end, give back every argument exactly on bash 3.2 and underBASH_COMPAT32 to 42, and the hygiene test refuses the spelling that broke them.660459fa. The branch is cut from59c26e8, an ancestor of660459fa, so it is 3 commits ahead of660459faand 11 behind. Main gained those 11 commits since the base, and they change 34 paths (CI and delivery files, Sonar coverage, feature 009 notes, the openRepoShape pin, the launcher's HTTPS flags inopenRepoTools, and tests). None of them touches this PR's five paths:git diff --stat 59c26e8 660459faoverlane-end,lane-handoff,lane-start,tests/test_quoted_bash32_compat.pyandtests/test_repo_hygiene.pyis empty, and the four files that exist on main have the same blob at both commits. One of the 34,openRepoTools, is read by the hygiene test (it is inALL_BASH); the widened rule gives 0 hits on its text at660459faand on the other 13 files.git merge-tree --write-tree 660459fa f2188f6is clean and writes treecef8fb8ca864c09c9c2f4fd8556c8f2ee5e433ad, whose only differences from main are the five files (+333, -3). The branch's diff is the same patch onto59c26e8and onto660459fa.tests/run.sh -k "quoted_bash32_compat or escaped_quote_rule or quotes_the_replacement_half"Over the merged tree with
660459fa(2,230 test functions in 78 files), pytest's ownExpressionover the names and parametrize ids selects 5 test functions and no others, 37 items, counted and not collected: the two in the new module, the new pinned-lines test, the existing widened test, andtest_the_two_commands_keep_the_repositorys_bash_rulesintests/test_claude_current.py, whose ids name the widened rule and which runs it overclaude-currentandclaude-restart-check.660459fais safe with or without this PR. Nothing depends on it and it depends on nothing. It changes whatquoted()prints for a quote, one path-unquoting step inlane-end, and tests; reverting it restores the old lines and nothing else.Landing
It goes through the merge queue. It is an independent PR targeting main (
task-set-delivery.md:47). Its five paths are known root commands and safe file paths undertests/, which theopenrepotools-codequeue accepts (.github/ci/batching-pilot.md:139-140). None is a workflow, queue configuration, pin or gitlink, package-control file or unknown path, which "need separate normal reviewed landing, not this queue" (task-set-delivery.md:48-49;batching-pilot.md:141-143). The branch name and all five paths also pass the conditions of theopenrepotools-coderule in.mergify.yml:98-110 (head~=at 103,#files>=1at 104,-files=src/openrepotools/_release.pyat 105,-files~=at 106), read offline at660459faand run over the branch name and the paths. The rule added at 119-142 in the same file,openrepotools-claude-current, takes onlyclaude-currentandtests/test_claude_current.py(138), so it is not this PR's queue.Brett Heap has given his word for this PR, and the gates are still to pass. On 2026-11-13, by dialog in lane 3's session, Brett answered Q5, on lane 3's two lane-tooling fixes, with "Open both, land on gates (Recommended)". The option read: "Open both PRs on opensoft/openRepoTools-code. Each lands through the merge queue once it has an independent READY, green full CI and your terminal Codex review (lane 3 sends one prompt per PR)." Lane 3 relayed it on Amendment 22 act 2: the SQL register under lanes-edit.sh — mode=primary writers in one transaction each, the estate switch and lanes/STORE, the write journal and the renderer (one mirror commit per write), exit 69, fail-closed readers, lanes-index import/rollback, SERIALIZABLE claim order, and the agreement tests openRepoTools#165 as comment 6866656915 (Amendment 22 act 2: the SQL register under lanes-edit.sh — mode=primary writers in one transaction each, the estate switch and lanes/STORE, the write journal and the renderer (one mirror commit per write), exit 69, fail-closed readers, lanes-index import/rollback, SERIALIZABLE claim order, and the agreement tests openRepoTools#165 (comment)). Opening this PR queues nothing: the queue is "not an automatic merge rule or fast-only CI" (
batching-pilot.md:134-135). The gates, each at the exact head:.github/ci/delivery-cutover.md(lines 193-261 at660459fa). The receipt is a new top-level PR comment from an existing repository writer, and it names the head and base it reviewed (lines 199-200 and 209-210).After those gates comes the queue preflight in
batching-pilot.md:145-154: merge authority and lane claims, the exact head, base and changed paths, all four full gates, exact-head Codex review, and unresolved threads. For this queue it is an operator attestation, not service-enforced Codex/SHA proof (lines 152-154). Only after it does a repository writer post the named queue command (lines 154-160; its text is not printed here).The review prompt is not in this body. Lane 3 sends it to Brett, one prompt per PR, once the head is final.
task-set-delivery.md:74-76 holds that "A quota response, Copilot, or old-head review is not approval", so a review of an older head does not count.Full CI.
guard-launch-mode,tests,tests-no-submoduleandpackagerun on this head and must pass (.mergify.yml:107-110). This PR is not in theclaude-currentscope thatdelivery-cutover.md:44-46 describes, so it keeps full CI: "All other work retains full CI" (task-set-delivery.md:6-9).No
Depends-Online. This PR has no predecessor in this repository.Not in this PR
lane-end. Thelane-endhunk covers old lines 1760-1766, andf2188f6's message says T403 changeslane-endonly from old line 1775 down, so the two should not collide.fix/lane-worktrees-report-fifo-l3, lane 3's other lane-tooling fix. The two share no file, so either may land first.Body corrections
f2188f6. This body said the fast verification command selects 4 test functions (35 items) and that the widened rule passes on 14 files. Over the merged tree it selects 5 functions (37 items), and the rule also runs onclaude-currentandclaude-restart-check, both passing. It also said a macOS job runs the real bash 3.2; CI has no macOS test job at660459fa. The code and the head did not change.🤖 Generated with Claude Code
Summary by Sourcery
Make lane-tool quoting reliable across Bash versions, especially for paths and arguments containing single quotes.
Bug Fixes:
Enhancements:
Tests: