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
comsub bodies that are not one bare command leak stdout and yield empty: $(command -v 'sed'), $(PATH=...; command -v sed) #289
wt8/sourcefix lane finding (modernish init blocker family), script-file verified.
Reproducers (each a standalone .sh, LF)
a=$(command -V 'sed') # quoted argument
b=$(command 'echo' hi)
c=z$(command -v 'sed')z # comsub embedded in a word
d=$(PATH=/usr/bin; command -v sed) # prefix assignment then command -v
Observed under target/debug/rubash.exe (debug build, branch wt8/sourcefix @ 93147937+):
sed is /c/Program Files/Git/usr/bin/sed.exe <- leaked to real stdout
a=[] <- variable left EMPTY
/c/Program Files/Git/usr/bin/sed.exe <- leaked
c=[zz] <- comsub contributed nothing
/c/Program Files/Git/usr/bin/sed.exe
d=[]
WSL GNU Bash 5.3.0 (captured before a machine-side WSL outage mid-session, same files):
T[sed is /usr/bin/sed]
U[hi]
V[z/usr/bin/sedz]
W[/usr/bin/sed]
X[/usr/bin/sed]
(all captured, no leaks; see session artifacts target/m15.sh + /tmp outputs).
Shape
The comsub capture works when the body is a single bare unquoted command
(x=$(command -v sed) and x=$(command -V while) both capture fine), and
for echo 'a b' / type 'sed' / command 'echo' hi. It breaks when the
body carries a quoted argument to command -v/-V or a prefix assignment:
the command's output bypasses BOTH the $() capture and any enclosing
compound redirection (fi >/dev/null 2>&1 does not suppress it — verified
with the else-branch of bin/modernish 649-1340 slice), and the substitution
result is empty.
Modernish impact: _Msh_kwOutput=$(command -V 'while') (bin/modernish
thisshellhas setup) and the sys/base/rev $(PATH=$DEFPATH; command -v sed)
probe ("Can't find a functioning sed" + the leaked path line) — exactly
this class.
Bisection artifacts: target/m1..m15.sh, target/vleak*.sh in the
wt8/sourcefix worktree; reproducers are 3-5 lines each.
Fixed by wt12/comsubfix (9fefe5b, master): the leak was NOT prefix-assignment-specific - ANY comsub body whose command -v/-V reaches the full executor leaked. Root: the command builtin dispatch forked on command_has_output_redirects; the no-redirect arm called describe_name raw println, which bypasses the thread-local STDOUT_CAPTURE that owns fd 1 during substitution (the m144re single true path). Exactly rubash#117 wrong-invariant shape: no-redirect-means-process-stdout is false under active capture. Fix: both dispatch points unconditionally take the buffered single-truth path; the raw execute_command_describe and describe_name are deleted. GNU anchor: subst.c:7143 command_substitute dup2(fildes[1], 1) at :7320 - fd 1 IS the pipe write end, describe_command printf (command.def:113 / type.def) is always captured; GNU has no word-level bypass at all.
Verification: 20-form matrix byte-identical to WSL GNU Bash 5.3.0 (single/multi prefix assignments, sequences, quoted forms, nested comsub, pipe bodies, -V verbose, command -p, type -t, hash, not-found status/stderr routing, in-body redirects, exec 2>/dev/null containment, -c mode); the three original forms stay fixed; #296 golden + issue144 + marker_leak green; cli_tests/executor_tests cross vs master zero new (executor_tests one EXTRA pass).
nvm fast-suite evidence for this family (ecosweep2 lane, rubash @116b12aa release).
Extending ecosuite §3's 12-test slice to the full test/fast plain-file set (36 files, cwd=test/fast, 60s each): GNU 5.3.0 passes 36/36; rubash passes 21, and 15 fail — 11 of those also fail under Git Bash 5.3.15 (Windows env: node.exe naming, symlinks, hashing, MANPATH), but 4 fail under rubash only: f12 "uninstall with an inferred version", f18 "use system", f26 "use should respect system in .nvmrc", f28 "nvm-exec should display required node version".
The f26 xtrace (artifacts below) shows this issue's exact signature leaking into an outer capture:
OUTPUT="$(nvm use 2>&1)" # captured value begins with the BARE CWD LINE:
/d/repo/rubash-wt-ecosweep2/target/ecosweep2-corpus/nvm/test/fast
No version provided and no .nvmrc file found
i.e. inside the outer comsub, the nested dir="$(nvm_find_up '.nvmrc')" (3 levels: outer $(nvm use) → $(nvm_find_nvmrc) → nvm_find_up's nvm_echo/command printf) loses its own capture: the inner substitution comes back empty (so nvm_find_nvmrc sees [ -e "/.nvmrc" ] and reports "no .nvmrc found") while the inner stdout line leaks into the outer capture. nvm_echo uses command printf '%s\n' — matches the "not one bare command" shape of this issue.
Minimal-repro status (honest): standalone reductions of the 3-level shape ($(g 2>&1) → local v; v="$(f)" → command printf, with/without set -u, with/without heredocs) all PASS on rubash @116b12aa — the trigger additionally depends on nvm.sh's real context (5000-line sourced file). Filed as evidence for the family rather than a new issue; artifacts:
Core fixed by wt12/comsubfix (9fefe5b, master): the command -v/-V describe output always takes the buffered single-truth path — the raw println bypass of the thread-local STDOUT_CAPTURE is deleted, so comsub bodies of any shape capture correctly. Verified then with the 20-form matrix; the prefix-assignment form re-verified on current master just now: d=/usr/bin/sed captures cleanly (byte-checked against WSL GNU). The nvm fast-suite residuals (f12/f18/f26/f28 leaking the bare CWD line into outer captures) are a related-but-distinct cd-print family — nvm use prints the directory; under GNU that print goes to the terminal and NOT into $(...) capture of a different command. Filed as its own follow-up if it still reproduces on current master; closing this issue for the original describe-output leak.
Activity
caomengxuan666 commentedon Sep 29, 2026
Fixed by wt12/comsubfix (9fefe5b, master): the leak was NOT prefix-assignment-specific - ANY comsub body whose command -v/-V reaches the full executor leaked. Root: the command builtin dispatch forked on command_has_output_redirects; the no-redirect arm called describe_name raw println, which bypasses the thread-local STDOUT_CAPTURE that owns fd 1 during substitution (the m144re single true path). Exactly rubash#117 wrong-invariant shape: no-redirect-means-process-stdout is false under active capture. Fix: both dispatch points unconditionally take the buffered single-truth path; the raw execute_command_describe and describe_name are deleted. GNU anchor: subst.c:7143 command_substitute dup2(fildes[1], 1) at :7320 - fd 1 IS the pipe write end, describe_command printf (command.def:113 / type.def) is always captured; GNU has no word-level bypass at all.
Verification: 20-form matrix byte-identical to WSL GNU Bash 5.3.0 (single/multi prefix assignments, sequences, quoted forms, nested comsub, pipe bodies, -V verbose, command -p, type -t, hash, not-found status/stderr routing, in-body redirects, exec 2>/dev/null containment, -c mode); the three original forms stay fixed; #296 golden + issue144 + marker_leak green; cli_tests/executor_tests cross vs master zero new (executor_tests one EXTRA pass).
fix(#289d): command -v/-V describe output always takes the buffered s…
caomengxuan666 commentedon Sep 29, 2026
nvm fast-suite evidence for this family (ecosweep2 lane, rubash @116b12aa release).
Extending ecosuite §3's 12-test slice to the full
test/fastplain-file set (36 files, cwd=test/fast, 60s each): GNU 5.3.0 passes 36/36; rubash passes 21, and 15 fail — 11 of those also fail under Git Bash 5.3.15 (Windows env: node.exe naming, symlinks, hashing, MANPATH), but 4 fail under rubash only: f12 "uninstall with an inferred version", f18 "use system", f26 "use should respect system in .nvmrc", f28 "nvm-exec should display required node version".The f26 xtrace (artifacts below) shows this issue's exact signature leaking into an outer capture:
i.e. inside the outer comsub, the nested
dir="$(nvm_find_up '.nvmrc')"(3 levels: outer$(nvm use)→$(nvm_find_nvmrc)→nvm_find_up'snvm_echo/command printf) loses its own capture: the inner substitution comes back empty (sonvm_find_nvmrcsees[ -e "/.nvmrc" ]and reports "no .nvmrc found") while the inner stdout line leaks into the outer capture.nvm_echousescommand printf '%s\n'— matches the "not one bare command" shape of this issue.Minimal-repro status (honest): standalone reductions of the 3-level shape (
$(g 2>&1)→local v; v="$(f)"→command printf, with/withoutset -u, with/without heredocs) all PASS on rubash @116b12aa — the trigger additionally depends on nvm.sh's real context (5000-line sourced file). Filed as evidence for the family rather than a new issue; artifacts:target/issue-suites/results/ecosweep2/nvm/{rb,gnu,gb}/f*.out/.err/.rc(36×3 sides)/tmp/f26.errmirrored attarget/issue-suites/results/ecosweep2/nvm/f26-trace.errnvm/index.txt; runners:nvm/run-{rb2,gnu2}.shdocs(corpus): ecosweep2 lane section — second-pass fine-grained corpu…
caomengxuan666 commentedon Sep 29, 2026
Core fixed by wt12/comsubfix (9fefe5b, master): the command -v/-V describe output always takes the buffered single-truth path — the raw println bypass of the thread-local STDOUT_CAPTURE is deleted, so comsub bodies of any shape capture correctly. Verified then with the 20-form matrix; the prefix-assignment form re-verified on current master just now: d=/usr/bin/sed captures cleanly (byte-checked against WSL GNU). The nvm fast-suite residuals (f12/f18/f26/f28 leaking the bare CWD line into outer captures) are a related-but-distinct cd-print family — nvm use prints the directory; under GNU that print goes to the terminal and NOT into $(...) capture of a different command. Filed as its own follow-up if it still reproduces on current master; closing this issue for the original describe-output leak.