Repository navigation
fix(rewrite): preserve quoted assignment data - #3462
zhiwuyazhe-fjr wants to merge 3 commits into
Conversation
daa5fe7 to
66011d2
Compare
|
Carried in a local fork build since 2026-08-08 (Windows 11, daily use), no regressions. Still merges cleanly with |
b8bd614 to
a3cdf3a
Compare
|
Thanks @bharvey42 for the report and for carrying this in a daily-use fork build since 2026-08-08 — glad to hear no regressions. Re: the overlap with #3749 — rebased onto
Verification on Windows after the rebase:
Ready for review. |
a3cdf3a to
234dacc
Compare
|
Fresh rebase onto the current Verification on Windows after the rebase:
One heads-up for reviewers: workflow runs from this fork are approval-gated, so the CI run for this push is sitting in |
|
Re-verified today, since a lot has landed since my last note:
CI has never run on this PR; it is still waiting on "Approve and run workflows". This is the silent kind of failure: exit 0 and wrong bytes on disk. Could a maintainer approve the run? |
Summary
shellcheckcorruption and the latest reported single-/double-quoted PR-title and prose casesdevelopRoot cause
The lexer kept quote boundaries and byte offsets correctly. The corruption happened later in
ENV_PREFIX: when a complete quoted assignment did not satisfy the trailing-whitespace requirement at a compound-command boundary, the regex could fall back to the broad unquoted alternative and match only the start of the assignment. The remaining literal text then looked like a command and was rewritten.The unquoted fragment now excludes quote characters, while the environment value accepts a sequence of complete quoted or unquoted fragments. This prevents partial reinterpretation without regressing valid forms such as
FOO='bar baz'qux git status.This is independent of #3202's case-terminator lexer fix.
Security behavior
The original #3262 payload now passes through unchanged. A supported command outside the quoted assignment is still rewritten:
The latest reported shapes are covered too:
T="... make ..."; echo "len=${#T}"preserves the double-quoted valueT='please make a cake'; printf '%s' "$T"preserves the single-quoted valueT=...; echo ...; [ ... ] && gh pr edit ... --title "$T"form preservesTwhile rewriting only the externalghcommandgh pr edit --title "... make ..."still takes the normal rewrite path and preserves its title bytesTest plan
cargo fmt --allcargo clippy --all-targetscargo test --all: 2583 passed, 0 failed, 8 ignored; all integration suites passedCloses #3262