+++ This bug was initially created as a clone of Bug #650998 +++
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 run.ksh > /dev/null
This bug has been fixed in the latest upstream beta version (ksh-2010-10-10).
Created attachment 471862 [details]
patch to fix this
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.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.