Bug 36400 - gpm doesn't close file descriptors; can hold onto rpm output fd
Summary: gpm doesn't close file descriptors; can hold onto rpm output fd
Status: CLOSED DUPLICATE of bug 24512
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gpm
Version: 7.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Preston Brown
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-04-18 02:41 UTC by Greg Hudson
Modified: 2007-04-18 16:32 UTC (History)
0 users

Clone Of:
Last Closed: 2001-06-25 17:41:22 UTC

Attachments (Terms of Use)

Description Greg Hudson 2001-04-18 02:41:13 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)

gpm does not close its file descriptors on startup, like a properly 
written daemon should.  (It does chdir to / and setsid() and background 
itself, though.)  So it retains a reference to its standard out file 

This isn't ordinarily harmful at boot time, but it can be in other 
contexts.  Particularly, the gpm RPM postuninstall script does an 
/etc/init.d/gpm condrestart if $! -ge 1.  (I don't know how common that is 
for Red Hat RPMs of daemon programs.)  The resulting gpm can retain a 
reference to the rpm command's standard output; if that output is being 
piped through another program, then that program's input won't be closed 
and the program won't terminate.

Reproducible: Couldn't Reproduce
Steps to Reproduce:
Theoretically this shouldn't be too hard to reproduce, but I wasn't able 
to do it on the system I currently have access to.  What you should need 
is two relatively recent version of the gpm RPM; install the older one and 
then "rpm -U newerone | cat".  The command should fail to terminate 
because gpm is holding a reference to "cat"'s input.

Comment 1 Greg Hudson 2001-04-25 21:51:14 UTC
Hi.  My bug report still stands, but some of the details in my description were
wrong.  It turns out that the actual symptoms I witnessed were caused by a bug
in RPM (which I've reported, #37695), and that /sbin/initlog normally covers up
for daemons which don't take responsibility for closing file descriptors (by
redirecting fds 0/1/2 prior to Red Hat 7.1, and by also closing other file
descriptors in Red Hat 7.1).

Also, my exact description of what gpm should be doing was imprecise.  What I
meant to say is that all properly written daemons should redirect file
descriptors 0/1/2 to /dev/null, and that gpm does not do this.

Comment 2 Preston Brown 2001-06-25 17:17:10 UTC

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

Comment 3 Greg Hudson 2001-06-25 17:41:17 UTC
Bug number 24512 is restricted such that I am not allowed to read it.
I am not sure precisely what principles the Red Hat bug tracking service
operates on, but it doesn't seem acceptable under any reasonable
principles to resolve a user's bug report as a duplicate of a confidential
bug.  So I'm reopening this bug.

Comment 4 Preston Brown 2001-07-19 16:01:03 UTC

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

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