Description of problem:
ksh does not restore file handles after execution of a sourced script. If output or error stream is redirected in the sourced script, the respective stream remains redirected in the parent script as well.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Prepare 3 scripts:
$ cat > 1.ksh
$ cat > 2.ksh
echo "STDERR" >&2
cat > run.ksh
2. And then execute run.ksh with standard output redirected to /dev/null:
$ ksh ksh.ksh > /dev/null
This bug has been fixed in the latest upstream beta version (ksh-2010-10-10).
Created attachment 458785 [details]
Backport from ksh-2010-10-10
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.
This request was erroneously denied for the current release of
Red Hat Enterprise Linux. The error has been fixed and this
request has been re-proposed for the current release.
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
Previously, ksh did not restore file handles after executing a sourced script. If an output stream or an error stream was redirected in the sourced script, the respective stream remained redirected in the parent script as well. With this update, file handles are restored after execution of sourced scripts so a parent script is not affected by sourced script redirections.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.