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
errexit/trap: set -e misfires in until ... break|continue; set -E not inherited by ( ) subshells #702
P1-high高:核心语义或高频路径受损,影响日常使用/发布bugSomething isn't workingfamily:S8taxonomy S8: errexit / status propagationfamily:S9taxonomy S9: trap/job/signal - no subprocess ownership model
Two errexit / trap-inheritance divergences from GNU bash, both deterministic.
Environment: Niubash 1.4.0 · rubash git e785c3c8f610 — Windows 10 x64. Method: differential vs GNU bash 5.2.21(1) / 5.3.0.
R4.1 set -e misfires in an until loop whose body starts with break / continue
$ set -e;untilfalse;dobreak;done;echo REACHED
niu : exits 1, REACHED not printed
bash: REACHED (rc 0)
Characterization (all re-checked on both shells):
Only until is affected. while true; do break; done and for i in 1; do break; done are fine.
Trigger: the first command executed in the body is break or continue (or a group starting with one: until false; do { break; }; done). If any other command precedes it (until false; do :; break; done) it is fine.
The status applied is the loop condition's: set -e; until (exit 7); do break; done exits 7.
It also fires the ERR trap with the condition's status: set -e; trap 'echo ERR:$?' ERR; until false; do break; done → niu prints ERR:1; bash runs the body and continues.
Without set -e both shells report $? = 0 after the loop — the loop's own status is correct; the stray status only leaks into the errexit / ERR-trap check.
The continue form aborts a loop that would terminate normally:
$ set -e; i=0;until [ $((++i))-ge 2 ];docontinue;done;echo REACHED
niu : exits 1, no output bash: REACHED
R4.2 set -E (errtrace) is not inherited by ( ) subshells
$ set -E;trap'echo ERR' ERR; ( false );echodone
niu : ERR / done (1 ERR)
bash: ERR / ERR / done (2 ERR — the inherited trap fires for`false` inside the subshell, then again for the failing subshell command)
Stable across 5 consecutive runs. set -E is accepted (shopt -o -p errtrace → set -o errtrace), and function inheritance works: set -E; trap 'echo ERR' ERR; f(){ false; }; f → 2 ERR on both. The gap is specifically the subshell fork copy path: ( f ) with -E → GNU 3 ERR vs niu 1.
Also visible through command substitution: o=$(set -E; trap 'echo E' ERR; (false)) embeds two E on GNU, one on niu.
Version note (correction to the Method line): the oracle was reached with bare wsl.exe -e bash, which resolves through PATH to /usr/local/bin/bash = GNU bash 5.3.0(1) — not 5.2.21. The 5.2.21 build lives at /bin/bash, and every item in this report was re-checked on it as well; results were identical on both.
So the two versions are listed in the wrong order above: 5.3.0 was the default, 5.2.21 the cross-check.
No finding here changes; noting it only so the numbers reproduce. (Incidentally 5.3.0 is also the oracle cited in rubash#641, "the repository oracle is WSL 5.3.0".)
Re-measured with the regression catalogue harness (WSL GNU bash 5.3.0 as oracle; both arms bounded; stdout/stderr/rc captured separately; the arm must reach the end of the script):
arm
result
installed 1.4.0 (rubash e785c3c8f610)
set -e; until false; do break; done; echo REACHED1 → no output at all, rc 1 — the shell died at the until, exactly as filed
master (engine 30aaf207, 2026-10-17)
REACHED1 / REACHED2, rc 0 — matches GNU byte-for-byte
Both statements from the issue (the break form and the continue form with [ $((++i)) -ge 2 ]) are covered by the case and both now match, and the tree carries tests/issue702_errexit_until_break_regressions.rs.
Thanks — closing as fixed. (Kept as resolved rather than a duplicate, since the fix postdates the build I originally measured on.)
P1-high高:核心语义或高频路径受损,影响日常使用/发布bugSomething isn't workingfamily:S8taxonomy S8: errexit / status propagationfamily:S9taxonomy S9: trap/job/signal - no subprocess ownership model
Activity
caomengxuan666 commentedon Oct 17, 2026
Version note (correction to the Method line): the oracle was reached with bare
wsl.exe -e bash, which resolves through PATH to/usr/local/bin/bash= GNU bash 5.3.0(1) — not 5.2.21. The 5.2.21 build lives at/bin/bash, and every item in this report was re-checked on it as well; results were identical on both.So the two versions are listed in the wrong order above: 5.3.0 was the default, 5.2.21 the cross-check.
No finding here changes; noting it only so the numbers reproduce. (Incidentally 5.3.0 is also the oracle cited in rubash#641, "the repository oracle is WSL 5.3.0".)
fix(executor): until-break errexit attribution and -E subshell ERR in…
caomengxuan666 commentedon Oct 17, 2026
Verified fixed on master — closing
Re-measured with the regression catalogue harness (WSL GNU bash 5.3.0 as oracle; both arms bounded; stdout/stderr/rc captured separately; the arm must reach the end of the script):
rubash e785c3c8f610)set -e; until false; do break; done; echo REACHED1→ no output at all, rc 1 — the shell died at theuntil, exactly as filed30aaf207, 2026-10-17)REACHED1/REACHED2, rc 0 — matches GNU byte-for-byteBoth statements from the issue (the
breakform and thecontinueform with[ $((++i)) -ge 2 ]) are covered by the case and both now match, and the tree carriestests/issue702_errexit_until_break_regressions.rs.Thanks — closing as fixed. (Kept as resolved rather than a duplicate, since the fix postdates the build I originally measured on.)