Skip to content

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
mainfrom
mergify/merge-queue/565cfe28e1
Closed

mergify[bot] wants to merge 6 commits into
mainfrom
mergify/merge-queue/565cfe28e1

Conversation

@mergify

@mergify mergify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

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-code queue, to test #69 before it merged into main.

🎉 What landed

Mergify merged its pull request into main, then closed this draft:

  • #69 lane tools: quoted() and lane-end read a single quote back on bash 3.2 (brettheap), as c62ba9c

This draft's code was built in this order:

  1. main at eff8459
  2. #69, the pull request of this batch
Metadata for CI tooling, read by mergify ci
---
all_scopes: false
checking_base_sha: eff8459657e9a970d46a0cdef5cbd531cbe0e9cd
previous_check_retries: []
previous_failed_batches: []
pull_requests:
  - number: 69
    scopes: []
scopes: []
...
Required conditions of queue rule openrepotools-code for merge
Required conditions to stay in the queue

brettheap and others added 6 commits November 12, 2026 19:31
…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]>
@sourcery-ai

sourcery-ai Bot commented Nov 14, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Update quoted() in both lane tools to emit a single-quote spelling that round-trips under bash 3.2 and older compatibility modes, and fix lane-end’s sc_find_err_path to unquote find paths the same way.

  • lane-end L1763-1765
  • lane-handoff L179-188
  • lane-start L782-791

Tests

Add bash compatibility read-back coverage for both quoted() copies and sc_find_err_path, and extend hygiene checks to detect the problematic escaped-quote substitution pattern.

  • tests/test_quoted_bash32_compat.py L1-222
  • tests/test_repo_hygiene.py L4289-4334, L4349-4356, L4368-4407

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sonarqubecloud

Copy link
Copy Markdown

@mergify mergify Bot changed the title merge queue: checking #69 on main (eff8459) merge queue: merged #69: lane tools: quoted() and lane-end read a single quote back on bash 3.2 Nov 14, 2026
@mergify mergify Bot closed this Nov 14, 2026
@mergify
mergify Bot deleted the mergify/merge-queue/565cfe28e1 branch November 14, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant