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
Unmasked after the rubash#218/#219 fixes and the case-pattern bracket/literal fixes landed in wt4/ecofix: modernish init (bin/modernish @ 63bdae0) still aborts with rc=128 Fatal shell bug(s) detected, now at the FTL_FLOWCORR1 check.
Reproducer (rubash only; GNU bash 5.3.0 passes)
export MSH_PREFIX=/d/repo/rubash-wt-ecofix/target/ecosuite/upstream/modernish
export MSH_AUX=$MSH_PREFIX/lib/modernish/adj
_Msh_test=$(command."$MSH_AUX/fatal.sh"||echo BUG )echo"test=[$_Msh_test]"# rubash: [fatalbug]; GNU: the $PPID line
fatal.sh's execution counter t reaches 2 at the case $((t += 1)) check
(lib/modernish/adj/fatal.sh:536) — the region between t=0 (line 524) and
that case executes twice inside the $( ) subshell, so the ( 2 ) arm sets trap 'echo fatalbug' 0 and the comsub yields fatalbug instead of the
final trap 'echo $PPID' 0 verification line (fatal.sh:549).
Not yet root-caused: a minimal probe of the FTL_DEVCLOBBR/FTL_FNREDIR region
(set -C, fn() { command : <&5; } 5</dev/null) alone shows t=1 (correct);
the double execution needs the full fatal.sh content inside the comsub.
Suspect: the source-in-comsub resume/retokenize path re-executing a tail
region (comsub body re-tokenization family, cf. the rubash#118 worked
counter-example).
Fixed on the way (this lane, verified by WSL GNU 5.3.0 script-file probes)
quoted ]' inside a case-pattern bracket class is now a CTLESC-protected member (case c in ( ["${t}"] )` with t='ab]cd'), GNU subst.c
add_quoted_string / sm_loop.c
command/unset/test/let builtin diagnostics now honor the bound
fd 2 (exec 2>/dev/null contains them)
Artifacts: /tmp probes under target/p222* in the wt4/ecosuit tree; modernish
checkout at target/ecosuite/upstream/modernish (LF-forced).
Fixed in wt5/omb. The tail double-execution surface no longer reproduces; underneath it were four comsub-boundary defects, each fixed at its GNU owner:
EXIT-trap gate (rubash#117 anti-pattern): the comsub child only ran its EXIT trap when the body text contained a literal trap word. GNU subst.c:7340-7341 ends the child with rc = run_exit_trap (); exit (rc); unconditionally. Gate removed; reset_for_subshell now also runs unconditionally (POSIX subshell trap reset; ignore actions survive).
Assignment-RHS in-place comsub path had no trap lifecycle:_Msh_test=$( command . fatal.sh || echo BUG ) routed through run_ast_command_substitution_with_context (embedded_mutations.rs), which ran the body in place and restored state without ever running the child's EXIT trap — and without resetting inherited traps. Now mirrors the same child lifecycle (reset at entry, run_exit_trap with capture before the fork-boundary restore, trap status becomes the substitution status).
fd-table leak: the same in-place path never snapshotted the fd table, so fatal.sh's exec 2>/dev/null (line 37) silenced the PARENT shell's stderr/xtrace after the substitution returned (_Msh_initExit diagnostics vanished; exit 128 with no message). Whole-table clone/restore added (fork semantics, subst.c:7143), same for run_function_command_substitution.
exec cmd 2>/dev/null in a comsub leaked its stdout past the capture: the exec builtin's fd-2-redirect arms used Stdio::inherit() for the child's fd 1. GNU redir.c only rebinds fd 2; the capture-aware fd-1 routing (as the no-redirect arm) now applies (trap_exec.rs) — this was the goodsh.sh _Msh_Gsh_doTestShell blocker.
Verification: reproducer now yields the $PPID verification line exactly like GNU (rubash test=[<ppid>], GNU test=[<ppid>]; was [fatalbug] / empty). fatal.sh tail region traced single-execution (t reaches 1 once).
modernish .t suite (bounded, file harness, WSL GNU 5.3.0 oracle): 164 tests run to completion; 159 rc-vectors identical to GNU; 5 diverge → filed #258 (BUG_CSUBBTQUOT, BUG_PSUBSQUOT, BUG_SCLOSEDFD, QRK_BCDANGER, QRK_EMPTPPWRD). bin/modernish init now passes std.sh, defpath.sh, fatal.sh and goodsh's shell test (with MSH_SHELL=rubash); it proceeds to line 866 and 1589 where two NEW pre-existing parse/exec bugs surface → filed #256 (break in case-condition of while: infinite loop) and #257 (|| ! case syntax error). Artifacts: target/issue-suites/results/wt5-omb/issue-probes/ (wt5/omb worktree).
Activity
caomengxuan666 commentedon Sep 27, 2026
Fixed in wt5/omb. The tail double-execution surface no longer reproduces; underneath it were four comsub-boundary defects, each fixed at its GNU owner:
EXIT-trap gate (rubash#117 anti-pattern): the comsub child only ran its EXIT trap when the body text contained a literal
trapword. GNU subst.c:7340-7341 ends the child withrc = run_exit_trap (); exit (rc);unconditionally. Gate removed; reset_for_subshell now also runs unconditionally (POSIX subshell trap reset; ignore actions survive).Assignment-RHS in-place comsub path had no trap lifecycle:
_Msh_test=$( command . fatal.sh || echo BUG )routed through run_ast_command_substitution_with_context (embedded_mutations.rs), which ran the body in place and restored state without ever running the child's EXIT trap — and without resetting inherited traps. Now mirrors the same child lifecycle (reset at entry, run_exit_trap with capture before the fork-boundary restore, trap status becomes the substitution status).fd-table leak: the same in-place path never snapshotted the fd table, so fatal.sh's
exec 2>/dev/null(line 37) silenced the PARENT shell's stderr/xtrace after the substitution returned (_Msh_initExitdiagnostics vanished; exit 128 with no message). Whole-table clone/restore added (fork semantics, subst.c:7143), same for run_function_command_substitution.exec cmd 2>/dev/nullin a comsub leaked its stdout past the capture: the exec builtin's fd-2-redirect arms used Stdio::inherit() for the child's fd 1. GNU redir.c only rebinds fd 2; the capture-aware fd-1 routing (as the no-redirect arm) now applies (trap_exec.rs) — this was the goodsh.sh_Msh_Gsh_doTestShellblocker.Verification: reproducer now yields the $PPID verification line exactly like GNU (rubash
test=[<ppid>], GNUtest=[<ppid>]; was[fatalbug]/ empty). fatal.sh tail region traced single-execution (t reaches 1 once).modernish .t suite (bounded, file harness, WSL GNU 5.3.0 oracle): 164 tests run to completion; 159 rc-vectors identical to GNU; 5 diverge → filed #258 (BUG_CSUBBTQUOT, BUG_PSUBSQUOT, BUG_SCLOSEDFD, QRK_BCDANGER, QRK_EMPTPPWRD). bin/modernish init now passes std.sh, defpath.sh, fatal.sh and goodsh's shell test (with MSH_SHELL=rubash); it proceeds to line 866 and 1589 where two NEW pre-existing parse/exec bugs surface → filed #256 (break in case-condition of while: infinite loop) and #257 (
|| ! casesyntax error). Artifacts: target/issue-suites/results/wt5-omb/issue-probes/ (wt5/omb worktree).omb/modernish/bats ecosystem fixes: #251 omb interactive brace cascade,
caomengxuan666 commentedon Sep 27, 2026
已修复并合入 master(commit e22fa3a,lane wt5/omb;验证评论已在本 issue:#251 交互 252/252 环境平价(其余 74 个名字来自 WSL 侧 bash-completion 缺失=环境绑定)、PS1 字节一致;#252 modernish 159/164 rc 向量一致、init 推进到 866 行;#253 env|grep -c BASH_FUNC=1、bats 三文件越过 readlinkf 墙)。后续阻塞已开单 #256-#259。感谢报告!