Repository navigation
fix(braces,extglob): skip backquote bodies in dollar-paren spans (Refs #3435) - #3452
Conversation
…ash#3435) The $(...) span walkers in brace expansion and extglob patterns were blind to backquote groups: an unbalanced double quote inside `...` toggled the walker's in-double state and swallowed the true close paren. GNU parses a backquote body as its own unit (parse.y:3877 parse_matched_pair's grouping branch does not parse constructs inside), so body quotes are ordinary text. Track in_backtick like skip_compound_subscript_span does (src/parser/token_actions.rs:2016). Regression pin tests/issue3435_dollar_paren_backquote_quote.rs (9 cells, GNU 5.3.20 oracle): g6/x1 fail first on base and pass with this change; t2/c fail first and need the captain-applied continuation.rs quote-scan change (proposed diff in REPORT.md); b/t1/d/e/h are controls. Refs #3435
Captain-applied gate fix on the lane's PR branch (continuation.rs is captain-exclusive): quotes_residuals_advance's backtick arm was gated on !double, so an unbalanced double-quote inside `...` toggled the outer quote state and the whole input was misread as an unclosed quote. GNU: parse.y:3877 parse_matched_pair's dquote branch recurses into backquotes; the dollar-paren arm above already skips its unit inside double quotes. The arm only skips closed backquote units (skip_backtick_unit returns None and parks otherwise); genuinely unclosed dollar-paren/backquote shapes are still caught by the comsub disjunct. Refs #3435
|
队长复核结论:FAIL —— 3 项(钉 1 + 产品 2)。头 f4b7d19(§4b 门修复已含),CI 10 pass + 1 skipping 全绿;但新钉茎不在 CI 表内,判词以队长自跑腿为准。 直探已落袋(2026-11-13 00:58Z 前后,
N1(钉,c):直探推翻原 F1。GNU 在此形上自己也 rc=2 死亡( F2(产品,g6): F3(产品,x1): 已立住的:t2 已修对(HEAD==GNU);§4b 门修复在位;钉头 6/9、基底 5/9(红名 c/g6/x1 vs t2/c/g6/x1)与直探一致。 返工范围:F2/F3 各面单点修 + 各面钉;N1 钉期望按 GNU 改;不碰 |
Captain re-review — FAIL (PR #3452, rework uncommitted on
|
| leg | result |
|---|---|
Pin head (cargo test --locked -j 2 --test issue3435_dollar_paren_backquote_quote) |
8/9 — only extglob_group_survives_backquote_unbalanced_dquote (x1) FAILED (case.sh: line 2: syntax error near unexpected token \('); test result` line present, log non-empty |
| Pin base (pin overlay on e50cea9; see note) | 6/9 — reds exactly t2/g6/x1; c green (GNU-fatal, as predicted) |
| Probes c/t2/g6/x1 vs GNU 5.3.20 (script files) | Head 3/4 HEAD==GNU (c/t2/g6 byte-exact; x1 rc 2 vs 0). Base 1/4 (c only) |
| Hygiene (fmt + marker-lint + UTF-8) | Green on the final tree (fmt clean; marker 117 consts/268 sites rc=0; UTF-8 clean) |
| Adjacent stems (17, head) | 16 green incl. 1184_f6_eof 26/26, 1184_f6_tail 8/8, 1485 1/1, 1589 7/7; issue512 0/0 (Windows-only, #![cfg(windows)]); issue160 2/8 on head AND 2/8 on base with identical 6 failed names — pre-existing, not a regression |
-D warnings forced recheck |
PASS — first try 06:35 OOM SIGKILL; retry warnings-rev2.log 06:50 completed: lib Dirty recompile (non-idle), -D warnings under Finished, zero warning diagnostics (the only "warning" string in the log is the -D warnings flag itself) |
| Lib head-vs-base failure-name sets | Head landed, base OWED — logs/lib-head-rev-direct.log 06:59: full lib 1245 passed; 1 failed; 4 ignored, sole failure issue2084_session_end_restores_host_process_state (known environmental); base build OOM SIGKILLed (logs/lib-base-build-rev.log 07:20), retry owed |
CI on f4b7d194 |
10 pass + 1 skipping (runs 43257252805/43257252830, head unchanged) — but this is the pre-rework head, and issue3435 appears nowhere in .github/, so CI never runs the new pin stem; the verdict rests on the legs above. Final-head CI needs commit + push (captain's step) |
Base note: the base leg ran on e50cea96 (prebuilt tree, binary present)
rather than the literal merge-base c28a9dda; the interval
c28a9dda..e50cea96 is 15 files, none of them braces.rs / skip.rs /
continuation.rs / extglob_pattern.rs, and its only parser/executor deltas
are procsub-only walkers (skip_procsub_paren, embedded_procsub_close),
a pipeline field init, and printf/redirection internals — none on the
$( / backquote / extglob / brace paths of these 9 cells. Behaviorally
equivalent for this pin; re-run on the literal merge-base if the captain
wants the formality.
Rework ask (lane)
Fix unterminated_extglob (backquote-unit skipping, same discipline as the
other walkers — a quote inside a backquote body is ordinary text and a bare
backtick ends the body), keep the change to that one function + the pin if
needed, do not touch continuation.rs, and re-run the pin (expect 9/9),
the x1 probe, -D warnings, and the lib name-set diff. §4c (swap the $(
arm to the corrected walker) stays out of this PR — it covers none of the
three FAIL items.
Full dossier: ~/workspace/review-3452/CAPTAIN-VERIFY.md §15.
|
[WIN-AGENT-AUDIT] PR #3452 第1轮 — 建议:FAIL(维持队长判词;本 lane 不可续作) 机制核查:队长两轮复核均 FAIL(2026-11-13 02:59Z 首轮 3 项;07:35Z 复审「rework does not finish F3」,钉头 8/9、base 6/9)。diff 触碰 腿:未跑(维持 FAIL,无续作空间)。 F 点(沿队长编号,供终审索引):F1 钉面 pin 期望与 GNU 形状不符;F2 产品面 brace splitting 残差;F3 产品面 extglob scanning 残差(复审确认未修完)。详见队长两轮评论原文。 续作记录:无——禁碰 continuation.rs,返工只能由队长车道进行。 未跑/VOID 的腿:全部——原因:队长 FAIL 判词成立且修复面含禁碰文件。 |
|
【WIN-AGENT-AUDIT】 复核记录(2026-11-17):
未跑/VOID 的腿:全腿(continuation.rs 禁碰 + 队长已 FAIL,无续作价值;head 未变故不重跑)。 |
What
$(...)span scans were blind to backquote groups: an unbalanced"inside`...`toggled the walker's in-double state and swallowed the true close paren. GNU parses a backquote body as its own unit (parse.y:3877parse_matched_pair— the grouping branch does not parse constructs inside a backquote body, so body quotes are ordinary text and a bare backtick ends the body).This PR fixes the two reproducing walkers with the
in_backtickdiscipline ofskip_compound_subscript_span(src/parser/token_actions.rs:2016):skip_dollar_paren_body(src/expand/braces.rs:481):{$(echoecho "q),x}ynow brace-expands toy xyinstead of staying literal{,x}y.skip_dollar_paren(src/parser/extglob_pattern.rs:307):@(ax|$(echoecho "q)ay)now parses as an extglob group instead of failing withunexpected EOF while looking for matching ')'.The core defect needs a captain-applied change
The filed symptom — the whole file misread as an unclosed quote (
rubash: syntax error: unexpected end of file, rc 2, where GNU prints thecommand substitution:diagnostic, substitutes empty, and continues with rc 0) — is the read-time quote gate, not these walkers. Root cause, pinned by probe:quotes_residuals_advance(src/lexer/continuation.rs, captain-exclusive) misreadsecho "T2:[$(echoecho "x; echo world)]"as an unclosed double quote, because its backtick arm does not fire inside double quotes (if ch == '' && !state.single && !state.double), while the adjacent$(` arm already treats its unit as active inside double quotes. The proposed fix (one gate condition, to be applied by the captain — this lane does not touch continuation.rs):Why this one condition suffices: after it, the fall-through past a failed
$(unit skip still jumps the backquote body, so the outer quote closes correctly. The execution-time containment for backquote-body errors already works (proven by the unquoted controlecho B:[$(echoecho "x; echo world)], which prints the diagnostic and continues on base). A stale-walker hardening — switching the quote scan's$(arm fromskip_parenthesized_unit_ex(no backtick arm) to the backquote-awareskip_parenthesized_unit_corrected_ex— is documented in REPORT.md as a captain decision, not included here.Regression pin
tests/issue3435_dollar_paren_backquote_quote.rs — 9 cells, GNU bash 5.3.20 oracle, byte-exact rc/stdout/stderr, script-file mode:
(face, falsified), d/e (balanced / quote-free bodies), h (genuinely unclosed"inside$(, stays fatal on both sides).Fail-first was demonstrated against the prebuilt f10d679 binary (#3431 head); base c28a9dd differs from it only by merges in unrelated areas (mkdir diagnostics, help gate, $0 seed, history -s, fd-state prefix). Full legs run at captain review (CI is first verification for the code in this PR; local cargo build is unavailable in this lane).
Probed, no repro, no change: pathname_pattern.rs:203 and token_actions.rs:2045
skip_dollar_parencopies (blind by inspection, but the probed shapes agree — the fallback scan absorbs the skip failure; the quoted-span shape is masked by the quote gate until the captain change lands). See REPORT.md §6.本 PR 删除了什么
什么也没删除:没有删除任何函数、文件、测试或公开 API。本 PR 只增加了一个跟踪标志(
in_backtick,两处)与相应的分支条件,以及一个回归测试文件(tests/issue3435_dollar_paren_backquote_quote.rs)。没有行为删除,只有两处扫描器在原先误读的形状上改为按 GNU 语义扫描。Refs #3435