Bug 138862 - %post scripts inherit dup'd stdout (FD_CLOEXEC needed)
%post scripts inherit dup'd stdout (FD_CLOEXEC needed)
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: rpm (Show other bugs)
3.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Panu Matilainen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-11-11 12:35 EST by Michael J. Pomraning
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-10-19 15:14:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Michael J. Pomraning 2004-11-11 12:35:30 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041107 Firefox/1.0

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
it's stdout.

%post scripts (and perhaps others, too) inherit a dup'd copy of their
stdout.

Version-Release number of selected component (if applicable):
rpm-4.2.2-0.14

How reproducible:
Always

Steps to Reproduce:
1.  Make a dummy RPM (no source, no files) with the following:
    %post
    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:

total 0
lr-x------    1 root     root           64 Nov 11 11:13 0 -> pipe:[181105]
l-wx------    1 root     root           64 Nov 11 11:13 1 -> pipe:[181081]
l-wx------    1 root     root           64 Nov 11 11:13 14 ->
pipe:[181081]
lrwx------    1 root     root           64 Nov 11 11:13 2 -> /dev/pts/3
lr-x------    1 root     root           64 Nov 11 11:13 255 ->
/var/tmp/rpm-tmp.57281

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.

Additional info:
Comment 1 Jeff Johnson 2006-01-19 22:23:43 EST
This is fixed in rpm-4.3.x, all open file desciptors 3->100 are closed.
Comment 2 David Lawrence 2006-04-18 16:15:25 EDT
NEEDINFO_ENG has been deprecated in favor of NEEDINFO or ASSIGNED. Changing
status to ASSIGNED for ENG review.
Comment 3 RHEL Product and Program Management 2007-10-19 15:14:20 EDT
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:
http://www.redhat.com/security/updates/errata/
 
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.

Note You need to log in before you can comment on or make changes to this bug.