Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 147717 - rpm opens terminal on fd 7/17 for scriptlets
Summary: rpm opens terminal on fd 7/17 for scriptlets
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: rpm
Version: 3.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Paul Nasrat
QA Contact: Mike McLean
URL:
Whiteboard:
: 191196 (view as bug list)
Depends On:
Blocks: RHEL3U8CanFix
TreeView+ depends on / blocked
 
Reported: 2005-02-10 19:40 UTC by Hal Wine
Modified: 2007-11-30 22:07 UTC (History)
3 users (show)

Fixed In Version: RHBA-2006-0314
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-07-20 15:19:24 UTC
Target Upstream Version:


Attachments (Terms of Use)
spec file to produce example output (deleted)
2005-02-10 19:43 UTC, Hal Wine
no flags Details
rpm-4.2.3-close-script-fd.patch (deleted)
2006-03-02 11:30 UTC, Bastien Nocera
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2006:0314 normal SHIPPED_LIVE RPM bug fix update 2006-07-19 20:38:00 UTC

Description Hal Wine 2005-02-10 19:40:14 UTC
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 19:43:31 UTC
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 19:59:32 UTC
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 20:31:51 UTC
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 20:42:36 UTC
Nope, sorry. I also maintain 3 other branches of rpm.

Thank you for reopening.



Comment 5 Bastien Nocera 2006-03-02 11:30:00 UTC
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 11:34:52 UTC
I've tested the patch locally and it seems to do the job.

Comment 8 Jeff Johnson 2006-03-05 12:56:06 UTC
NEEDINFO_ENG so I don't have to stare at ancient history.

Comment 15 Bob Johnson 2006-04-11 16:25:10 UTC
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 Jeff Moyer 2006-05-09 19:24:31 UTC
*** Bug 191196 has been marked as a duplicate of this bug. ***

Comment 19 Red Hat Bugzilla 2006-07-20 15:19:24 UTC
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.