Red Hat Bugzilla – Bug 138862
%post scripts inherit dup'd stdout (FD_CLOEXEC needed)
Last modified: 2007-11-30 17:07:05 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Description of problem:
Capturing the output of an rpm installation (backticking `rpm ...` in
shell or perl, for example) may hang indefinitely if rpm's %post
script launches a long-running process -- even if that process closes
%post scripts (and perhaps others, too) inherit a dup'd copy of their
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Make a dummy RPM (no source, no files) with the following:
sleep 10 >/dev/null &
ls -l /proc/$$/fd > /tmp/fdtest-post.$$
2. Build the rpm, and install it under backticks
# FOO=`rpm -Uhv dummyrpm...`
3. Inspect the resultant /tmp/fdtest-post.$$ file
Actual Results: /tmp/fdtest-post.$$ contained:
lr-x------ 1 root root 64 Nov 11 11:13 0 -> pipe:
l-wx------ 1 root root 64 Nov 11 11:13 1 -> pipe:
l-wx------ 1 root root 64 Nov 11 11:13 14 ->
lrwx------ 1 root root 64 Nov 11 11:13 2 -> /dev/pts/3
lr-x------ 1 root root 64 Nov 11 11:13 255 ->
also, $FOO assignment took about 10 seconds.
Expected Results: /tmp/fdtest-post.$$ should not have had shown a
line for a dup of fd 1 (fd 14, in the "Actual Results"). $FOO
assignment should have taken no longer than it takes for the rpm
command to exit.
This is fixed in rpm-4.3.x, all open file desciptors 3->100 are closed.
NEEDINFO_ENG has been deprecated in favor of NEEDINFO or ASSIGNED. Changing
status to ASSIGNED for ENG review.
This bug is filed against RHEL 3, which is in maintenance phase.
During the maintenance phase, only security errata and select mission
critical bug fixes will be released for enterprise products. Since
this bug does not meet that criteria, it is now being closed.
For more information of the RHEL errata support policy, please visit:
If you feel this bug is indeed mission critical, please contact your
support representative. You may be asked to provide detailed
information on how this bug is affecting you.