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
[bug] [[ string =~ ^(a|b)$ ]] with unquoted parenthesized regex aborts the parse: 'unexpected end of file from (' — pbb is_hex_color section dies #322
Found by ecosweep3 lane (pure-bash-bible corpus, section 003; carrier release build of 6106961). New construct instance of the over-strict family (#222), not covered by its listed shapes.
Reproducer (target/probe-out/p2.sh)
if [[ "#FFFFFF"=~ ^(#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3}))$ ]]; thenecho"match:${BASH_REMATCH[1]}"elseecho"nomatch"fi
GNU bash 5.3.0: match:#FFFFFF, rc=0
rubash: syntax error: unexpected end of file from ( command on line 2, rc=2
The unquoted regex word containing ( is lexed as a command-substitution opener. Quoting the regex (=~ $re with re variable, or quoted) is not affected — the pbb regex() helper (variable regex) passes.
GNU anchor
parse.y cond.c word after =~ is taken verbatim to EOL as the regex (see parse.ycond_regexp handling in parse.y:3688 region / bash MANUAL: within [[, the characters after =~ up to the closing ]] form the pattern; parens are not tokenized). If the C anchor line needs re-verification, grep cond_regexp in parse.y.
Impact
pbb 'Use regex on a string' section (is_hex_color) unparseable end-to-end; any script using inline unquoted parenthesized regexes in if/else bodies hits rc=2.
C anchor verified: parse.y:5439-5462#ifdef COND_REGEXP block in read_token_word() — after =~ the parser keeps reading the regex word with COND_REGEXP handling so ( inside it is not a comsub opener. (Corrects the issue body's tentative anchor.)
pbbfix lane progress: scanner-level fix committed (wt14/pbbfix 99344ca0) — PST_REGEXP port into LexerParseState; [[ $v =~ ^(#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3}))$ ]] with variable/unquoted LHS now parses and matches byte-identical to GNU 5.3.0 (pbb is_hex_color section end-to-end green). Remaining: QUOTED-literal-LHS form ([[ "#FFFFFF" =~ ^(#?...)$ ]]) is blocked by a phantom-unterminated-( false positive in the completeness oracle (lexer/continuation.rs, captain-exclusive file) — validated proposed diff at target/issue-suites/results/pbbfix/issue322-continuation-proposed.diff handed to the captain for apply (quote-completion counts as word material for at_command, both one-shot and incremental copies; randomized consistency test green).
Fixed by wt14/pbbfix (00df0f6, master): the tokenizer ate token-initial # inside the =~ RHS word as a comment. PST_CONDCMD/PST_REGEXP reader states ported into LexerParseState (GNU: parse.y:5169 sets PST_REGEXP, :5443-5461 the whole-word group swallow). Variable-LHS full regex + pbb 003 byte-identical; word-initial # stays a comment (GNU rc=2 preserved). ONE RESIDUE (continuation.rs is captain-exclusive): quoted-literal LHS ([[ "#FFFFFF" =~ ^(#?...) ]]) hits a phantom paren in the at_command tracking - the lane left a verified proposed diff at target/issue-suites/results/pbbfix/issue322-continuation-proposed.diff (one-shot and incremental forms, random-consistency tested),移交 captain per protocol.
Captain applied the lane's proposed continuation.rs patch (master 1237459): completed quote spans are word material for the at_command tracker in BOTH the one-shot close-char scan and the incremental residual advance (read_token returns one WORD token for a quoted span, parse.y:5305). Verified: the quoted-LHS form now MATCH-OK (was: syntax error unexpected EOF from '('), variable-LHS and word-initial-# semantics unchanged, 545 lib / 27 regression green.
Activity
caomengxuan666 commentedon Sep 29, 2026
C anchor verified:
parse.y:5439-5462#ifdef COND_REGEXPblock inread_token_word()— after=~the parser keeps reading the regex word withCOND_REGEXPhandling so(inside it is not a comsub opener. (Corrects the issue body's tentative anchor.)caomengxuan666 commentedon Sep 29, 2026
pbbfix lane progress: scanner-level fix committed (wt14/pbbfix
99344ca0) — PST_REGEXP port into LexerParseState;[[ $v =~ ^(#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3}))$ ]]with variable/unquoted LHS now parses and matches byte-identical to GNU 5.3.0 (pbb is_hex_color section end-to-end green). Remaining: QUOTED-literal-LHS form ([[ "#FFFFFF" =~ ^(#?...)$ ]]) is blocked by a phantom-unterminated-(false positive in the completeness oracle (lexer/continuation.rs, captain-exclusive file) — validated proposed diff attarget/issue-suites/results/pbbfix/issue322-continuation-proposed.diffhanded to the captain for apply (quote-completion counts as word material for at_command, both one-shot and incremental copies; randomized consistency test green).fix(#322): unquoted [[ =~ ]] regex - token-initial # inside the RHS w…
fix(#323): patsub replacement $'...' decodes through the canonical AN…
caomengxuan666 commentedon Sep 29, 2026
Fixed by wt14/pbbfix (00df0f6, master): the tokenizer ate token-initial # inside the =~ RHS word as a comment. PST_CONDCMD/PST_REGEXP reader states ported into LexerParseState (GNU: parse.y:5169 sets PST_REGEXP, :5443-5461 the whole-word group swallow). Variable-LHS full regex + pbb 003 byte-identical; word-initial # stays a comment (GNU rc=2 preserved). ONE RESIDUE (continuation.rs is captain-exclusive): quoted-literal LHS ([[ "#FFFFFF" =~ ^(#?...) ]]) hits a phantom paren in the at_command tracking - the lane left a verified proposed diff at target/issue-suites/results/pbbfix/issue322-continuation-proposed.diff (one-shot and incremental forms, random-consistency tested),移交 captain per protocol.
caomengxuan666 commentedon Sep 29, 2026
Captain applied the lane's proposed continuation.rs patch (master 1237459): completed quote spans are word material for the at_command tracker in BOTH the one-shot close-char scan and the incremental residual advance (read_token returns one WORD token for a quoted span, parse.y:5305). Verified: the quoted-LHS form now MATCH-OK (was: syntax error unexpected EOF from '('), variable-LHS and word-initial-# semantics unchanged, 545 lib / 27 regression green.
fix(cond): decode raw-byte pairs at the [[ =~ ]] regex boundary (Refs #…