ksh command substitution does not work after stdout/stderr closed
Issue
- User has a tool which after
fork()and beforeexecv()call closes thestdoutandstderrfile descriptors. This causes the execved script written inkshnot working. This behavior can be reproduced by the following simple command:
# ksh -c 'a=`cd;pwd`;echo $a>/tmp/a' >&-;cat /tmp/a
- On RHEL 6.3 or RHEL 5.10, the command results in the output
# ksh -c 'a=`cd;pwd`;echo $a>/tmp/a' >&-;cat /tmp/a
/root
#
However, on RHEL 6.5, it outputs an empty line.
Environment
- Red Hat Enterprise Linux (RHEL) 6.5
- ksh-20120801-10.el6_5.8.x86_64
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.