You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
shopt -u extglob mid-script leaves our parse-time extglob gate open: later +(a|b) parses as a group instead of GNU's ( operator syntax error #332
shopt -u extglob mid-script does not close our parse-time extglob gate (the rubash#131 extended_glob / token.extglob_gate mechanism): a later +(a|b) word still parses as an extglob group where GNU — whose parser reads each command AFTER the previous ones executed (parse.y:5466 gates group consumption on the live extended_glob) — reports the ( operator syntax error.
Repro (wt16/fix16 @ c12b8344, WSL GNU Bash 5.3.0 oracle)
+(a|b)
<path>: line 4: syntax error near unexpected token `('
<path>: line 4: `echo +(a|b)'
rc=2 (nothing after runs).
rubash:
+(a|b)
<path>: line 4: syntax error near unexpected token `)'
<path>: line 4: `echo +(a|b)'
rc=2 — the group is still consumed at parse time (gate stayed open), so the error names ) instead of (.
Same divergence with an unclosed bracket after the unset (shopt -s extglob; shopt -u extglob; echo +(a|b[)* — GNU: syntax error near unexpected token '('; rubash: unexpected EOF while looking for matching ']' — the pre-#317 extglob-off subscript misfire, same root).
Owner
The parse-time extglob gate (src/lexer/scanner.rsextended_glob / extglob_split_pending, set_parse_extended_glob in src/builtins/shopt.rs:343-347) and the mid-script re-parse plumbing (token extglob_gate stamps, scanner.rs:975-977). Related known residue from #317: extglob-OFF diagnostics (echo +(a|b[)* outside any shopt) need extglob awareness in unclosed_input_close_char_posix (src/lexer/continuation.rs — captain-exclusive; lane report carries the proposal).
Original reporter: execdeep perf15 run (shopt -s extglob; shopt -u extglob residual state); target/perf15/b*.sh no longer exists in the main tree — the shapes above reproduce it deterministically (probes target/fix16/xt*.sh of wt16/fix16).
Fixed by wt18/misc17 (8f588f3a, master 9faaead): contrary to the issue framing, the #131 parse-time extglob gate DOES correctly track runtime toggles (proof: word splits at the paren with the gate closed; the case shapes already matched GNU). The real owner was the diagnostics layer: token_actions marked the argument-position paren as a parse error but returned Continue, so later lines parsed on and a stray-paren error OVERWROTE the first error - reporting ) instead of (. Fix: lone_word_function_head_candidate (parse.y:1054 LALR shift model - exactly one word then paren is a function-head candidate; ! prefix does not prevent it, assignment/redirect prefixes commit a simple_command so the paren reports) + push_unexpected_token_error_named (GNU virtual newline token) + the arm now pushes the error node and Breaks (first error stops the remaining input, parse.y:6724/6833). 25-form matrix byte-identical to WSL GNU 5.3.0 incl. both issue reproducers, single-line toggles, no-shopt bare forms, !/assignment/redirect prefixes, function bodies, first-error-wins, gate-regon positive; extglob suites stay at the 16 environment-class lines with zero syntax-error lines. 12 regressions. Leftovers for other owners: the +(a|b[)* prescan shapes (captain continuation proposal, verified in-lane), echo () body diagnostic, echo ( EOF naming.
Activity
caomengxuan666 commentedon Sep 30, 2026
Fixed by wt18/misc17 (8f588f3a, master 9faaead): contrary to the issue framing, the #131 parse-time extglob gate DOES correctly track runtime toggles (proof: word splits at the paren with the gate closed; the case shapes already matched GNU). The real owner was the diagnostics layer: token_actions marked the argument-position paren as a parse error but returned Continue, so later lines parsed on and a stray-paren error OVERWROTE the first error - reporting ) instead of (. Fix: lone_word_function_head_candidate (parse.y:1054 LALR shift model - exactly one word then paren is a function-head candidate; ! prefix does not prevent it, assignment/redirect prefixes commit a simple_command so the paren reports) + push_unexpected_token_error_named (GNU virtual newline token) + the arm now pushes the error node and Breaks (first error stops the remaining input, parse.y:6724/6833). 25-form matrix byte-identical to WSL GNU 5.3.0 incl. both issue reproducers, single-line toggles, no-shopt bare forms, !/assignment/redirect prefixes, function bodies, first-error-wins, gate-regon positive; extglob suites stay at the 16 environment-class lines with zero syntax-error lines. 12 regressions. Leftovers for other owners: the +(a|b[)* prescan shapes (captain continuation proposal, verified in-lane), echo () body diagnostic, echo ( EOF naming.
fix(#361): command-position `!(` with extglob OFF lexes as BANG + sub…