Skip to content

command substitution with a VAR=value prefix assignment leaks the command's stdout past the capture #192

Closed

Description

@caomengxuan666

Activity

  1. added
    bug
    on Sep 27, 2026
  2. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    Not reproducible on baseline 26728da (this issue's body is empty, so I probed the class the title names). Could not make the stdout leak past the capture in any form, on the current baseline binary:

    a=$(V=1 cat f.txt)            # external, file operand
    b=$(V=1 sort s.txt | cat)      # pipeline
    c=$(V=1; sort s.txt)           # assignment-only prefix
    d=$(V=1 sort s.txt s.txt)
    e=$(V=1 echo hi)  f=$(V=1 printf "%s\n" qq)   # builtins
    g=$(V=zz myfunc)  h=$(V=1 eval "cat f.txt")      # function / eval
    i=$(V=$(echo nest) cat f.txt)  j=$(IFS=x; echo qq) # nested comsub
    k=$(V=1 ./tool.sh)  l=$(V=1 sh tool.sh)           # shebang scripts
    m=$(V=1 git --version)  n=$(V=1 cmd //c "echo wincmd")
    o=$(V=1 W=2 cat f.txt)  p=$(V+=1 cat f.txt)  q=$(V=1 env | grep "^V=")
    r=$(V=1 export V; echo $V)  s=$(V=1 unset V; echo "[$V]")

    All captured; output matches WSL GNU Bash 5.3.0 byte-for-byte (a=[hi] ... f=[[]] / end, rc 0 — probe target/p3/i192h.sh shape).

    The report was against wt/o3-platform c9bd0af+#175 era binaries. Several capture/PATH/carrier fixes landed between c9bd0af and 26728da (27c8a255 PATH import, 1f1870f6 carrier payload gating, e6cf44df lexer fixes). Please retest on current main (or wt/p3-comsub) with a concrete reproducer file; if a form still leaks, attach the LF script and I will reopen the hunt. Related but distinct: the exec-in-script capture family you hit in #193 WAS still broken on 26728da and is now fixed there.

  3. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    P3 车道已在 26728da 上跑完整 20+ 形态矩阵(字面量/函数/嵌套 comsub/eval/管道/管道中段/外部 exe/shebang 脚本/env/export/unset/append/多赋值),全部正确捕获与 GNU 逐字节一致——后续修复(27c8a255/1f1870f6/e6cf44df)疑似已顺带修复。请报告者用最新 master 复测原复现路径,如仍复现请补复现脚本。

  4. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    原泄漏复测 12 个变体均无法复现,予以关闭;顺带发现并修复了一个真实的姊妹 bug(commit 492355a):任何赋值前缀的管道成员(VAR=1 yes | head-2)曾强制走顺序逐段排水路径导致非终止生产者死锁——现在普通 VAR=x 成员进入并发 OS 管道路径并按 execute_cmd.c:4617 应用成员环境。已知出范围项:b+=7 cmd | cat 与 PATH= 前缀仍保守回退。感谢报告!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions