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:
Created attachment 110933 [details] spec file to produce example output This spec file built the rpm used to produce the output cited above.
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).
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)
Nope, sorry. I also maintain 3 other branches of rpm. Thank you for reopening.
Created attachment 125522 [details] rpm-4.2.3-close-script-fd.patch Backported from RHEL4's rpm 4.3.3
I've tested the patch locally and it seems to do the job.
NEEDINFO_ENG so I don't have to stare at ancient history.
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.
*** Bug 191196 has been marked as a duplicate of this bug. ***
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