Repository navigation
fix(executor): mark_quoted_ifs_from_raw recognizes markers.rs carrier bytes (#868) - #874
Merged
Merged
Conversation
… bytes (#868) The #743 per-char IFS marking pass simulated quote removal with a parallel state machine and bailed without marking on any mismatch. The simulator treated every markers.rs carrier the lexer cook produces ($'...' ANSI-C decode output, $"..." bodies, escaped quotes, escaped IFS blanks and pattern-significant chars) as an opaque data byte, so carrier-laden raw words mismatched on every char and silently degraded to the coarse split-everything-or-nothing fallback - exactly the words that most need the per-char rule - and pure-carrier words skipped the new path entirely. The simulator now replays the lexer walk's carrier arms arm-for-arm (lexer/quotes.rs remove_shell_quotes + remove_double_quoted_into_ cursor): backslash escapes cook to DATA_DOLLAR / DATA_BACKTICK / DATA_SQUOTE / DATA_BACKSLASH / DATA_DQUOTE consuming both bytes; escaped IFS blanks cook to the self-guarded ANSI_C_IFS_GUARD pair (never re-marked); escaped pattern-significant chars cook to CTLESC pairs; single-quote spans cook $, backtick and " to their DATA_* carriers; double-quote spans additionally cook ' to DATA_SQUOTE, the glob set to CTLESC pairs and a non-expansion $ to DATA_DOLLAR (parse.y skip_double_quoted); $'...' decodes through the authoritative decode_ansi_c_quoted + escape_decoded_ansi_c_quotes pipeline; $"..." enters the double-quote rules with the $ dropped; and an unbraced $name keeps the walk's pending_name protocol (the next $/quote/backslash trigger emits PARAM_NAME_END_MARKER first). Same function, second defect exposed by the #868 battery: the apply loop added a second \x1c glue in front of a char mark_literal_ifs_ chars had already marked. The splitter consumes each glue as 'protect the next char', so the doubled glue spent the first glue on the second and released the IFS char itself - with IFS=:, "a:b"$w (and the plain-ASCII 'a:b'$w family) split its quoted colon. Already-glued positions are no longer re-marked. The mismatch bail stays as the safety net for shapes outside these arms; carrier words no longer reach it. Verification (WSL GNU bash 5.3.0 oracle, script-file mode, byte-exact): - 45-shape battery (carrier inside/outside the IFS value, nested quotes, multiple IFS separators, pure-carrier words, unset expansions): all 42 shapes owned by this layer match GNU; the 3 residual diffs verified against master as pre-existing gaps in other layers (decoded quote vs quote-char-in-IFS, adjacent quoted-$w tail splitting), base-identical or closer. - New regressions tests/issue868_carrier_ifs_mark_regressions.rs (7 cases) plus scripts/regression-catalog case issue-868 (diverges on master, must-match here). - No-regression: #298/#795/#843/#369/#428/#432/#315/marker_leak_golden families all green (107 cases). - Full suite --no-fail-fast --test-threads=1 A/B against master bd24cf8: 5606 passed / 37 failed vs base 5598/38, failure sets identical minus three base-side environment flakes; zero new failures. - cargo fmt clean; no new clippy warnings. closes #868
Member
Author
独立代码评审(CR #874)— 结论:APPROVE-WITH-NITS独立复验(自建 worktree @ 001a647,未触碰他人树;oracle 为 WSL GNU bash 5.3.0(1) x86_64-pc-linux-gnu,script-file 模式双侧逐字节)。 主张逐项复核 — 全部成立
非阻塞备注(NITS / 建议跟进)
不合并(按评审规程由维护者执行)。评审 worktree 已清理。 |
This was referenced Oct 19, 2026
Closed
Closed
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 #868. Carries #794's disposition item 3 (carrier-blind quote simulation) to closure; #298's compound transport tag and the #795
\'guard semantics are preserved (their regression suites stay green).Problem
mark_quoted_ifs_from_raw(src/executor/command_prepare.rs~4040 at e6a5445) re-parses the raw word with a parallel quote-removal simulator and only applies per-char\x1cIFS marks when the simulated cook equals the actual cooked word; on mismatch it bails into the coarse split-everything-or-nothing fallback. The simulator treated everymarkers.rscarrier the lexer cook produces ($'...'ANSI-C decode output,$"..."bodies, escaped quotes, escaped IFS blanks and pattern-significant chars) as an opaque data byte — carrier-laden raw words mismatched on every char and silently lost the per-char rule, and pure-carrier words skipped the path entirely.The full-suite A/B also exposed a second defect in the same function that the ticket's acceptance battery trips over: the apply loop double-marked chars that
mark_literal_ifs_charshad already glued. The splitter consumes each glue as "protect the next char", so the doubled glue spent the first glue on the second and released the IFS char itself — withIFS=:,"a:b"$w(and the plain-ASCII'a:b'$wfamily) split its quoted colon on master.Fix
The simulator now replays the lexer walk's carrier arms arm-for-arm (
lexer/quotes.rscursor walk), per themarkers.rsregistry:ANSI_C_IFS_GUARDpair (never re-marked — split sites convert the guard to IFS_GLUE, and a doubled glue would re-release the blank); escaped pattern-significant chars cook to CTLESC pairs;'...'spans cook$/`/"to their DATA_* carriers;"..."spans additionally cook'to DATA_SQUOTE, the glob set* ? [ @ + !to CTLESC pairs, and a$that starts no expansion to DATA_DOLLAR (GNU parse.y skip_double_quoted);$'...'decodes through the authoritative pipeline (decode_ansi_c_quoted+escape_decoded_ansi_c_quotes) so the simulation sees exactly the E010/E011/E401/CTLESC quoting the lexer emits;$"..."enters the double-quote rules with the$dropped;$namekeeps the walk'spending_nameprotocol: the next$/'/"/\trigger arm first emits PARAM_NAME_END_MARKER;The mismatch bail stays as the safety net for shapes outside these arms; carrier words no longer reach it.
Verification
WSL GNU bash 5.3.0 (
/usr/local/bin/bash) oracle, script-file mode, byte-exact both sides:$wtail splitting) were verified A/B against master as pre-existing gaps in other layers — base-identical or closer — and are not mark_quoted_ifs_from_raw simulator is carrier-blind: carrier-laden raw words silently lose per-char IFS marking #868 scope.tests/issue868_carrier_ifs_mark_regressions.rs(7 cases, expectations GNU-verified) +scripts/regression-catalogcaseissue-868(diverges on master e6a5445/bd24cf8b,must-matchhere). No-regression families all green: [bug] Unquoted positional parameter in array assignment is not word-split on IFS: set -- a.b.c; IFS=.; A=($1) gives 1 element (GNU 3) — breaks OMB _omb_util_split / half-life git version compare #298 (12), #789 splitting rework: two field-splitting regressions vs GNU 5.3.0 (nested-quote guard + ${$+<nl>}) #795 (arrdefault+parameter_transform, 23), patsub 替换文本的用户 PUA 码点未 E400 转义,与 PATSUB 标记碰撞(release 可复现)——#838 CR NIT-3 #843 (12), regression(8c52cb7f): wholly-quoted compound-assignment element undergoes pathname expansion — arr=("$x") globs when x='*' #369/[P1] variable assigned via ${V:=default} never word-splits again (breaks bash-it powerline segment loops) #428/[P2] compound-array quoted default ${v:=x y} inside ("${v:=x y}") stores wrong elements (wt66-adjacent family) #432/[bug] inside guard reports SET for unset element; empty quoted element dropped in unquoted slice assignment c=( ${b[@]+"${b[@]:0:2}"} ) — liquidprompt test_array 2/3 fail #315,marker_leak_golden(18) — 107 cases.cargo test --no-fail-fast --test-threads=1both sides — fix5606 passed / 37 failedvs base bd24cf85598 / 38; failure sets identical except three base-side environment flakes that pass on the branch (part_043 command -pPATH face,part_071shellmath fixture face,executor::pathwindows listing cache). Zero new failures.cargo fmt --checkclean on both; clippy warning count unchanged (555 pre-existing on both).Known visible improvements over master (previously wrong vs GNU, now byte-exact):
IFS=:; printf '<%s>' "a:b"$w→<a:bx><y>;printf '<%s>' "a b"$'x'$w→<a bxc><d>(the ticket's acceptance probe face);'a:b'$w,a\:b$w,"a*b"$wunder custom IFS,$'\u00e9:'$wand carrier-in-IFS faces.