This service will be undergoing maintenance at 20:00 UTC, 2017-04-03. It is expected to last about 30 minutes
Bug 147717 - rpm opens terminal on fd 7/17 for scriptlets
rpm opens terminal on fd 7/17 for scriptlets
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: rpm (Show other bugs)
3.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Paul Nasrat
Mike McLean
:
: 191196 (view as bug list)
Depends On:
Blocks: RHEL3U8CanFix
  Show dependency treegraph
 
Reported: 2005-02-10 14:40 EST by Hal Wine
Modified: 2007-11-30 17:07 EST (History)
3 users (show)

See Also:
Fixed In Version: RHBA-2006-0314
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-07-20 11:19:24 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)
spec file to produce example output (812 bytes, text/plain)
2005-02-10 14:43 EST, Hal Wine
no flags Details
rpm-4.2.3-close-script-fd.patch (868 bytes, patch)
2006-03-02 06:30 EST, Bastien Nocera
no flags Details | Diff

  None (edit)
Description Hal Wine 2005-02-10 14:40:14 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3)
Gecko/20040913

Description of problem:
after installing a locally built RPM, which started a daemon (that
isn't perfect, but that's a different bug with a different vendor) I
could not cleanly log out of the system.

Investigation showed that the daemon had fd 17 open on the controlling
terminal still.

Further investigation showed that fd 17 had been explicitly opened by RPM.

Version-Release number of selected component (if applicable):
rpm-4.2.3-10

How reproducible:
Always

Steps to Reproduce:
1. make rpm from spec file (attached)
2. show open fd's on terminal before rpm with 
    /usr/bin/lsof -p $$ | grep -w CHR
3. install thenremove rpm & note output
    

Actual Results:  [root@rb482-vmware root]# /usr/sbin/lsof -p $$ | grep
-w CHR
bash    1060 root    0u   CHR  136,0               2 /dev/pts/0
bash    1060 root    1u   CHR  136,0               2 /dev/pts/0
bash    1060 root    2u   CHR  136,0               2 /dev/pts/0
[root@rb482-vmware root]# rpm -Uvh /tmp/fd17-1.0Beta1-0.i386.rpm
Preparing...                ###########################################
[100%]
in pre    for 1.0Beta1: '1'
sh      1164 root    1u   CHR  136,0               2 /dev/pts/0
sh      1164 root    2u   CHR  136,0               2 /dev/pts/0
sh      1164 root    7u   CHR  136,0               2 /dev/pts/0
   1:fd17                   warning: user hwine does not exist - using
root
warning: group hwine does not exist - using root
########################################### [100%]
in post   for 1.0Beta1: '1'
sh      1168 root    1u   CHR  136,0               2 /dev/pts/0
sh      1168 root    2u   CHR  136,0               2 /dev/pts/0
sh      1168 root   17u   CHR  136,0               2 /dev/pts/0
[root@rb482-vmware root]# rpm -e fd17
in preun  for 1.0Beta1: '0'
sh      1175 root    1u   CHR  136,0               2 /dev/pts/0
sh      1175 root    2u   CHR  136,0               2 /dev/pts/0
sh      1175 root    7u   CHR  136,0               2 /dev/pts/0
in postun for 1.0Beta1: '0'
sh      1179 root    1u   CHR  136,0               2 /dev/pts/0
sh      1179 root    2u   CHR  136,0               2 /dev/pts/0
sh      1179 root    7u   CHR  136,0               2 /dev/pts/0
[root@rb482-vmware root]#


Expected Results:  fd 7/17 should not have been explicitly opened by
RPM, _or_ this should be documented somewhere.

Additional info:
Comment 1 Hal Wine 2005-02-10 14:43:31 EST
Created attachment 110933 [details]
spec file to produce example output

This spec file built the rpm used to produce the output cited above.
Comment 2 Jeff Johnson 2005-02-10 14:59:32 EST
rpm-4.3.x undertakes closing all file descriptors and above,
as yum and other applications were leaking fdno's through to scriptlets
that restarted daemons.

All those applications need to control for their open descriptors,
it's not rpmlib's job to close open file decriptors that
rpmlib did not open.

And you *really* need to fix your daemon, as any invocation,
not just an invocation from an rpm scriptlet, will pass
descriptors to the dameon. Other file descriptrs may be
much more sensitive than the one that rpm had open when
the scriptlet was invoked (RDONLY on package payload
positioned at EOF iirc).
Comment 3 Hal Wine 2005-02-10 15:31:51 EST
Please clarify closing. Current release of RHEL is RHEL 3, Update 4,
which has rpm-4.2.3-13.

Are you saying this bug will NOT be fixed for RHEL 3? End of life on
RHEL 3 is still a ways out....

And, this _is_ a file descriptor that rpmlib is explcitly opening
somewhere. (or rpm -- strace shows a 'dup(1)' call in the rpm process
right before the clone call)
Comment 4 Jeff Johnson 2005-02-10 15:42:36 EST
Nope, sorry. I also maintain 3 other branches of rpm.

Thank you for reopening.

Comment 5 Bastien Nocera 2006-03-02 06:30:00 EST
Created attachment 125522 [details]
rpm-4.2.3-close-script-fd.patch

Backported from RHEL4's rpm 4.3.3
Comment 6 Bastien Nocera 2006-03-02 06:34:52 EST
I've tested the patch locally and it seems to do the job.
Comment 8 Jeff Johnson 2006-03-05 07:56:06 EST
NEEDINFO_ENG so I don't have to stare at ancient history.
Comment 15 Bob Johnson 2006-04-11 12:25:10 EDT
This issue is on Red Hat Engineering's list of planned work items 
for the upcoming Red Hat Enterprise Linux 3.8 release.  Engineering 
resources have been assigned and barring unforeseen circumstances, Red 
Hat intends to include this item in the 3.8 release.
Comment 16 Jeffrey Moyer 2006-05-09 15:24:31 EDT
*** Bug 191196 has been marked as a duplicate of this bug. ***
Comment 19 Red Hat Bugzilla 2006-07-20 11:19:24 EDT
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 the 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.

http://rhn.redhat.com/errata/RHBA-2006-0314.html

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