Repository navigation
Description
Construct (minimal repro, 11 lines)
f() {
[[ a == b ]] && {
((0)) && {
g <<< ""
}
}
}
function h {
function i {
printf X
}
}rubash -n (fresh master a157656, release build):
nn2.sh: line 11: syntax error: unexpected end of file from `{' command on line 9
GNU bash 5.3.0 parses this file (Git Bash 5.2 grammar: rc=0, non-authoritative corroboration).
Measured boundaries on the fresh build:
| variation | rubash -n | GNU 5.3 |
|---|---|---|
| full repro above | syntax error (EOF from {) |
ok |
[[ ]] && { (( )) && { g <<< "" } } alone |
ok | ok |
nested function h { function i { ... } } alone |
ok | ok |
function h { function i { ... } } with function h () form + the group above |
syntax error | ok |
herestring word non-empty (<<< x) instead of <<< "" |
ok | ok |
either the [[ ]] or the (( )) line removed |
ok | ok |
inner function given () (function i () {) |
ok | ok |
So the state produced by the [[ … ]] && { (( … )) && { cmd <<< "" ; } ; } group makes rubash mis-track the body of a later function NAME { definition whose body itself contains a nested function NAME2 { — the inner function's { is reported as never closed ("unexpected end of file from { command"). The same signature appears with entirely different bodies (a bare printf 'X'), so it is the nesting/state, not the content.
Real-world evidence (ecosystem harvest)
Klapptnot/dotf-old/.config/bash/mirkop.sh (374-line prompt framework; harvest 2026-10-04):
function __mirkop_transient_prompt { # line 185: [[ ]] && { ((..)) && { ... <<< "" } }
...
function __mirkop_load_prompt_config { # line 259
function hex_to_shell { # line 265 — reported unclosed- WSL GNU Bash 5.3.0
bash -n: rc=0 on the whole file (recorded oracle, harvest 2026-10-04/05) - Git Bash 5.2 grammar: rc=0 (non-authoritative corroboration)
- rubash master a157656
rubash -n: rc=2,syntax error: unexpected end of file from '{' command on line 265 - rubash's own runtime sources the file (ConPTY run reaches the prompt) — only the
-nparse path fails.
GNU C source anchor (vendored bash.git @b4608166, Bash-5.3 patch 15)
parse.y:1056 function_def: FUNCTION WORD function_bodyandparse.y:1054 function_def: WORD '(' ')' newline_list function_body— both definition forms share the same function_body machinery; a preceding compound group must not change how the later definition's body braces are tracked.parse.y:1193 group_command: '{' compound_list '}'— group bodies are tracked by brace state in the lexer; GNU keeps the brace/quote state per construct, with no leakage from a completed&&-group (including its<<<herestring and(( ))arithmetic-command lines) into later definitions.
Classification
Parser/lexer state divergence (cross-construct state leakage into function-definition brace tracking). Distinct from rubash#460 (terminator-less then after ]] in a function body) — different construct, different failure signature.
Activity
[-][parse] compound-group state leaks into later nested function-definition brace tracking: EOF from '{' — GNU accepts (breaks mirop.sh)[/-][+][parse] compound-group state leaks into later nested function-definition brace tracking: EOF from '{' — GNU accepts (breaks mirkop.sh)[/+]docs(audit): wt98b/goldtri ecosystem gold triage — 172 rows classifie…
merge wt98b/goldtri: 172-row gold triage — 27 already-fixed (fa87622/…
chore(release): prepare 1.4.0 (version bump, CHANGELOG, packaging sli…
test(lexer): #465 fold pin — assert the balance invariant, not the in…
fix(lexer): a '<' run opens a heredoc only at its first '<' (rubash#3…