CSH subshell behaviour in Red Hat Enterprise Linux 5 differs from previous releases
Environment
- Red Hat Enterprise Linux 5
- tcsh-6.14-12.el5 or newer
Issue
Subshells created via `cmd`
may be launched after forking twice. This can cause programs that depend on information from getppid()
to fail.
Resolution
This issue should be resolved in tcsh-6.14-17.el5_5.2
, released by Advisory RHBA-2010:0823-1. To resolve this issue, please upgrade to the latest version of tcsh
available for Red Hat Enterprise Linux 5.
Root Cause
The following bit of code was removed from sh.glob.c``:
861 if (t)
862 t->t_dflg |= F_NOFORK;
The code above prevents tcsh
from forking a new process when evaluating command substitutions in backquotes (""). Removal of that code caused
tcsh` to fork an extra process before running the command.
Diagnostic Steps
Run a command like the following in tcsh:
echo `pstree -p $$`
In Red Hat Enterprise Linux 4 (tcsh-6.13
), something like the following should be output:
tcsh(11889)---pstree(11890)
Red Hat Enterprise Linux 5 (tcsh-6.14
) should print something like the following:
tcsh(11878)---tcsh(11879)---pstree(11880)
The output from the command in Red Hat Enterprise Linux 5 shows that tcsh
is forking twice before running the pstree
command, whereas the output in Red Hat Enterprise Linux 4 shows that tcsh
is only forking once.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments