Repository navigation
merge queue: merged #69: lane tools: quoted() and lane-end read a single quote back on bash 3.2 - #83
Closed
mergify[bot] wants to merge 6 commits into
Closed
mergify[bot] wants to merge 6 commits into
mergify[bot] wants to merge 6 commits into
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]>
… 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]>
Reviewer's GuideImplementationUpdate
TestsAdd bash compatibility read-back coverage for both
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
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.



Note
This is a merge queue draft opened by Mergify. Its pull request has merged, and nobody needs to act on it.
Mergify opened it for batch stimulating-veloute-nc9zs5 of the
openrepotools-codequeue, to test #69 before it merged intomain.🎉 What landed
Mergify merged its pull request into
main, then closed this draft:c62ba9cThis draft's code was built in this order:
mainateff8459Metadata for CI tooling, read by
mergify ciRequired conditions of queue rule
openrepotools-codefor mergecheck-success=@github-actions/guard-launch-modecheck-success=@github-actions/packagecheck-success=@github-actions/testscheck-success=@github-actions/tests-no-submodulegithub-code-owner-review-satisfied[🛡 GitHub repository ruleset ruleRequire Code Owner Review]github-review-approved[🛡 GitHub repository ruleset ruleRequire Code Owner Review]main: the four tests.yml jobs required (owner act 2)]:check-success = @github-actions/openrepotools-deliverycheck-neutral = @github-actions/openrepotools-deliverycheck-skipped = @github-actions/openrepotools-deliveryRequired conditions to stay in the queue
#files>=1-closed-draft-files=src/openrepotools/_release.py-files~=^(?!(?:(?:claude-current|claude-restart-check|lane|lane-end|lane-handoff|lane-rename|lane-start|lane-worktrees|lanes|lanes-edit[.]sh|lanes-index|link-estates|openRepoTools|park|resume|status|repos[.]tsv|README[.]md)|(?:tests|src|commands|skills|features)/[A-Za-z0-9_.+/-]+)\Z)-from-forkbase=maincheck-success=@github-actions/guard-launch-modecheck-success=@github-actions/packagecheck-success=@github-actions/testscheck-success=@github-actions/tests-no-submodulegithub-code-owner-review-satisfied[🛡 GitHub repository ruleset ruleRequire Code Owner Review]github-review-approved[🛡 GitHub repository ruleset ruleRequire Code Owner Review]head~=^(?!release/|verify/|mergify/|ci/batch-pilot/)[A-Za-z0-9][A-Za-z0-9._/-]*\Zmain: the four tests.yml jobs required (owner act 2)]:check-success = @github-actions/openrepotools-deliverycheck-neutral = @github-actions/openrepotools-deliverycheck-skipped = @github-actions/openrepotools-delivery