Bug 59382 - rpm leaks fds when it runs script (e.g. %post)
Summary: rpm leaks fds when it runs script (e.g. %post)
Keywords:
Status: CLOSED DUPLICATE of bug 61198
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: openssh
Version: 6.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tomas Mraz
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-02-06 18:45 UTC by Pavel Kankovsky
Modified: 2007-04-18 16:39 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-02-03 10:44:38 UTC
Embargoed:


Attachments (Terms of Use)

Description Pavel Kankovsky 2002-02-06 18:45:22 UTC
Description of Problem:
Scripts invoked by rpm appear to inherit various file descriptors used by rpm
internally (including the file of a package being installed).

Example: OpenSSH 3.0.2p2's sshd started from %post after upgrade:

[root@kunhuta i386]# /sbin/service sshd status
sshd (pid 9106) is running...
[root@kunhuta i386]# ls -l /proc/9106/fd/
total 0
lrwx------    1 root     root           64 Feb  6 19:17 0 -> /dev/null
lrwx------    1 root     root           64 Feb  6 19:17 1 -> /dev/null
lr-x------    1 root     root           64 Feb  6 19:17 11 ->
/home/sw/rh/RPMS/i386/openssh-server-3.0.2p1-1loc62.i386.rpm
lrwx------    1 root     root           64 Feb  6 19:17 12 -> /dev/pts/1
lrwx------    1 root     root           64 Feb  6 19:17 2 -> /dev/null
l-wx------    1 root     root           64 Feb  6 19:17 21 -> /dev/null
lrwx------    1 root     root           64 Feb  6 19:17 3 -> socket:[520909]
lr-x------    1 root     root           64 Feb  6 19:17 7 -> pipe:[520908]
l-wx------    1 root     root           64 Feb  6 19:17 8 -> pipe:[520908]

Fds 11 and 12 should not be there. Well, they wouldn't be there if sshd did the
right thing (or the wrong thing according to the wise men of OpenBSD) and closed
all its unused fds upon startup but you get the point.

Version-Release number of selected component (if applicable):
rpm-4.0.2-6x

How Reproducible:
Easily.

Steps to Reproduce:
1. cat <<EOF >test.spec
Summary: The test package
Name: test
Version: 1
Release: 1
Group: Test
License: public domain
Packager: peak
%description
This is a test.
%prep
%build
%install
%post
ls -l /proc/$$/fd
%files
EOF
2. rpmbuild test.spec
3. rpm -i test-1-1.i386.rpm

Actual Results:
total 0
lr-x------    1 root     root           64 Feb  6 19:37 0 -> pipe:[521125]
lrwx------    1 root     root           64 Feb  6 19:37 1 -> /dev/pts/1
lr-x------    1 root     root           64 Feb  6 19:37 11 ->
/home/sw/rh/RPMS/i386/test-1-1.i386.rpm
lrwx------    1 root     root           64 Feb  6 19:37 12 -> /dev/pts/1
lrwx------    1 root     root           64 Feb  6 19:37 2 -> /dev/pts/1
lr-x------    1 root     root           64 Feb  6 19:37 3 -> /tmp/rpm-tmp.14470

Expected Results:
perhaps something like this...
total 0
lr-x------    1 root     root           64 Feb  6 19:37 0 -> pipe:[521125]
lrwx------    1 root     root           64 Feb  6 19:37 1 -> /dev/pts/1
lrwx------    1 root     root           64 Feb  6 19:37 2 -> /dev/pts/1
lr-x------    1 root     root           64 Feb  6 19:37 3 -> /tmp/rpm-tmp.14470

Additional Information:
N/a.

Comment 1 Jeff Johnson 2002-02-06 21:41:44 UTC
Will be fixed in rpm-4.0.4-0.30 (and rpm-4.0.4 final.

Off to openssh to get the daemon repaired as well (sorry Nalin)

Comment 2 Pavel Kankovsky 2002-02-12 18:26:11 UTC
While browsing bugs for openssh (!), I have found bugs #18988 (1.5 years old),
#27749 (1 year old) describing the same problem. I hope you are going to fix rpm
for real this time... ;)

Comment 3 Tomas Mraz 2005-02-03 10:44:38 UTC

*** This bug has been marked as a duplicate of 61198 ***


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