## 复现 ```bash x='abc{def'; echo \${x%%[<{(]*} # F181 ``` ```bash for() # F126 ``` | 片段 | GNU bash 5.3.0 | rubash 764b9dde | |---|---|---| | F181 | `bash: line 1: syntax error near unexpected token '('` + 源行回显两行,**rc=2** | ``...: line 2: syntax error: unexpected end of file from `(' command on line 1``,**rc=0** | | F126 | `bash: line 1: syntax error near unexpected token '('` + `` `for()' `` 回显,rc=2 | ``...: line 2: syntax error: unexpected end of file from `for' command on line 1``,rc=2 | ## 根因 未加引号的 `(` 是元字符:跟在词后面(F181 的 `[<{(]*}`、F126 的 `for` 后)应立即报 "syntax error near unexpected token `('" 并回显源行。rubash 的 lexer 反而**打开了 `(`/`for` 复合结构**,吞到 EOF 才报 "unexpected end of file from X command"。两片段同构(消息形状一致地错);F181 额外退出码为 0(语法错误置位缺失,与"stdin 语法错误 rc=0"issue 的退出码管线交叉引用)。 ## 规范/源码依据 - XCU 2.3 Token Recognition rule:`(` 为控制操作符,词法阶段即终结当前词。 - bash 诊断三形态(near-token / EOF / matching-quote)+ 源行回显(bash error.c:parser_error → 报 token + 打印当前输入行)。 ## 跨实现互证(huck) - [huck#211 "Align top-level syntax-error diagnostics to bash's 3-shape model (near-token/EOF/matching)"](https://github.com/jdstanhope/huck/issues/211)(已修复)——诊断形状总纲,同族。 - [huck#625 "An unterminated `for (( … ))` header reports the last line and huck's generic wording"](https://github.com/jdstanhope/huck/issues/625)(已修复)——`for` 头部诊断的行号/文案,同点。 ## 证据 - 语料出处:extglob_command_sub_diff_check.sh:31(F181);parser_syntax_errors_diff_check.sh:51(F126) - 复核:764b9dde 仍复现;旧构建 41de8319 行为一致
Activity
fix: P1 semantic batch - errexit body adjudication, stdin rc, write-f…
fix: Wave4a P2 batch - redirect ambiguity gate, backtick diagnostic w…
caomengxuan666 commentedon Oct 12, 2026
Fixed by #576 (Wave4a). Vendored-bash anchors and RED-then-GREEN regression evidence in the PR.
Merge origin/master into fix/wave4c-parser-path
fix(parser): dangling redirects in unclosed subshells; comsub body to…
fix(parser): token-level errors preempt compound EOF reports (#3405) (#…