Repository navigation
fix(lexer): close comsub extraction on case body/preamble ) and doomed ;; (Refs #3306) - #3878
Merged
Merged
Conversation
…med `;;` (Refs #3306) GNU parse_comsub (parse.y:4451) parses the body with shell_eof_token `)' (parse.y:4519-4521): a `)` arriving while the case pattern region is disarmed — clause body or `case ... in` preamble — or inside a case already doomed by a pattern-position clause terminator (`;;`/`;&`/`;;&` is only legal after a clause body) IS the substitution's closer. The truncated body then reaches the body parser whose verdict the read-time screen reports (parse.y:4549-4555, 6858-6865). The skip.rs oracle scanners (skip_cmd_subst, skip_parenthesized_unit_corrected), the parser extractor (dollar_command_substitution) and the unclosed-route disproof now share that invariant via case_body_paren_depth + case_clause_terminator_in_pattern; interactive_pending_is_hard_syntax_error asks the comsub body walker so stdin groups release at the same point. A literal `)' offender renders without the matching suffix (parse.y:6858-6859). Verified against GNU bash 5.3.20 script-file matrix: 31/33 shapes byte-identical (rc + diagnostic + echo); the two quoted-wrap residuals (`"...$(case...)..."`) are a separate adjacent family, unpinned. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Member
Author
|
l2b 续作验证 — #3306 修复腿复核(head a02349f) 机制核查(GNU bash 5.3.20 源码锚点):
腿(实测数字):
建议判词:PASS(机制与 GNU 一致,钉有效,环境红已逐条归因)。 |
All nine tests in this stem shared target/rubash-issue371-output.txt. cargo nextest runs each test in its own process, so concurrent probes truncated/read each other's redirect target — the PR #3878 census went red on three cells whose "actual" output was a byte-mix of two other probes' results. pid + counter keeps the path unique under both nextest (process per test) and plain cargo test (threads, one process). Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
caomengxuan666
added a commit
that referenced
this pull request
Nov 18, 2026
test: land rubash#3550 stale-hash pipeline-member pins (Refs #3550) Pin-only PR: 11 regression pins for #3550 (stale hashed path in a pipeline member: wrong ENOENT name, status 0, PIPESTATUS collapse). No product code changed (single file tests/issue3550_pipeline_spawn_failure.rs, +338/-0). Evidence: the three symptoms no longer reproduce on base 58c4cab; they were fixed by merged PR #3720. The pins pass 11/11 on this head's census (job 134702174402); fail-first was established by the lane on the pre-#3720 base (10 red), see ~/workspace/fix-3550/REPORT.md. Census note: this head's census total is 123, far above the era band (79-88). The +47 delta vs the pre-burst heads is in parser/quote/ comsub/EOF faces and belongs to the tip base (12-PRs merge burst 08:28-08:36Z), not to this pin-only diff: the pins themselves are 11/11 green and the diff touches no product code. The tip regression is tracked separately; #3878 was exonerated by its own head census (79 cells, issue3306 pins 9/9). 本 PR 删除了什么:无(纯新增测试文件)。
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.
Summary
Fixes #3306 — command substitutions whose
casebody can never complete now report GNU's body-boundary diagnostic instead of the generic unclosed-)EOF route.GNU
parse_comsub(parse.y:4451) parses the body withshell_eof_token = ')'(parse.y:4519-4521): a)arriving while the case pattern region is disarmed — clause body orcase … inpreamble — or inside a case already doomed by a pattern-position clause terminator (;;/;&/;;&is only legal after a clause body) IS the substitution's closer. The truncated body reaches the body parser, whose verdict the read-time screen reports (parse.y:4549-4555, 6858-6865).Changes (all outside captain-exclusive
src/lexer/continuation.rs):src/lexer/skip.rs—skip_cmd_subst+skip_parenthesized_unit_corrected: newcase_body_paren_depth(body/preamble parens own their)first) andcase_clause_terminator_in_pattern(;;-family in armed pattern region latches the doom); the close arm fires at body paren depth 0 with region disarmed or doomed.src/parser/command_substitution.rs—dollar_command_substitution: same two trackers; empty-pattern()keeps the)in the body source so the NEAR offender is)'itself.src/script_driver.rs—command_paren_verdict_disproved_by_parser:!command_positionclean-parse units whose only error lives in a comsub body now disprove the unclosed verdict (cond-marker and all other verdicts unchanged);interactive_pending_is_hard_syntax_errorconsultsExecutor::comsub_body_error_pendingso stdin groups release at the same point GNU does.src/executor/command_substitution.rs+public_accessors.rs—comsub_body_error_pendingaccessor; a literal)'offender renders without thewhile looking for matchingsuffix (parse.y:6858-6859).Evidence
/usr/local/bin/bash, WSL) script-file matrix, 33 shapes: 31/33 byte-identical (rc + diagnostic + offending-line echo). The 2 residuals are quoted-wrap variants (echo "pre $(case x in a) echo x) post") — a separate adjacent family where the dquote scanner never releases the inner); pre-existing, unpinned here.rubash < case.shvsbash < case.sh): 6/6 match.tests/issue3306_comsub_unclosed_case_body_regressions.rs: 9/9 on head; on basea1f9718bthe fail-first red set is {spaced/nospace pattern-body),;;terminator family, empty-pattern(), earlier-unit-voiding} — all reporting the old genericunexpected EOFline.compat_issue78_multiline_arrays::unclosed_compound_assignment_at_eof_reports_gnu_eof_diagnosticwas a real regression caught mid-work and fixed by narrowing the disproof (final state passes); remaining 7 fail identically on base (env: paths, timeouts, type -t, dirty build hash).cargo test --lib lexer::111/111; comsub/case stems (issue2784/2789/3307/3756/3834/3605/305/2751/1641/1656/2309/2678/2740/3000/372/381/413/336/385) all green except issue381's 3 exact-prefix asserts which fail on base too (argv[0] path env).RUSTFLAGS="-D warnings" cargo checkclean; rustfmt clean on changed files; marker-lint OK; utf8-hygiene clean.src/lexer/continuation.rsuntouched.Test plan
issue3306_comsub_unclosed_case_body_regressions9/9 head / 5 red on baseGenerated with Devin