Even tough sh_subtmpfile() should only be relevant to command
substitutions, checking the sh.comsub flag instead of sh.subshell
before calling is not valid in all cases; subshells of command
substitutions run into problems in some oddly specific cases, e.g.,
both 'eval' and an external command must be involved. The ksh
regression tests didn't detect a problem, but both modernish[*] and
shellspec[*] have one regression test failure after that change.
Minimal reproducer, assuming a cat at /bin/cat:
v=$(eval 'print output | /bin/cat')
print -r "v=[$v]"
Actual output:
output
v=[]
Expected output:
v=[output]
|
||
|---|---|---|
| .. | ||
| cmd | ||
| lib | ||
| Mamfile | ||