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 182623 - 'service NetworkManager status' erroneously reports 'dead but pid file exists' when run without root privileges
Summary: 'service NetworkManager status' erroneously reports 'dead but pid file exists...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks: FC5Target
TreeView+ depends on / blocked
 
Reported: 2006-02-23 18:37 UTC by Nalin Dahyabhai
Modified: 2014-03-17 02:58 UTC (History)
4 users (show)

Fixed In Version: 8.32-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-04-10 22:56:12 UTC


Attachments (Terms of Use)
Use the pid file in status() (deleted)
2006-02-27 21:06 UTC, Miloslav Trmač
no flags Details | Diff

Description Nalin Dahyabhai 2006-02-23 18:37:50 UTC
Description of problem:
Running '/sbin/service NetworkManager status' as an unprivileged user reports
that NetworkManager is dead, even if it's alive and well.  I blame this for many
an unnecessary 'sudo /sbin/service NetworkManager restart'.

Version-Release number of selected component (if applicable):
0.5.1-12.cvs20060213

How reproducible:
Always

Steps to Reproduce:
1. Run '/sbin/service NetworkManager status' as an unprivileged user.
  
Actual results:
NetworkManager dead but pid file exists

Expected results:
NetworkManager (pid XXX) is running...

Additional info:
There are at least two things going on here.  The call to the 'status' function
in the init script hasn't been modified to pass the new location of the pidfile
(after bug #179903 was fixed) (quick fix: change 'status $processname' to
'status -p $pidfile $processname').

The 'status' function itself passes the -c flag to 'pidof', which due to a
permissions problem, can't determine which root directory NetworkManager is
using, and omits the right PID from its output.  I don't really know how to get
around this one.  Maybe it should be calling pidofproc() instead of __pids_pidof()?

Comment 1 Dan Williams 2006-02-27 07:18:22 UTC
Ok, #1 fixed in CVS...

#2 is cute, even the manpage of pidof says "This option does not make sense for
non-root users".

Hopefully this can get pushed to rawhide soon.

Comment 2 Miloslav Trmač 2006-02-27 21:06:09 UTC
Created attachment 125353 [details]
Use the pid file in status()

Removing the -c can generate false positives in chroots.

This patch is another way to add false positives :) by checking the pid file;
if the daemon is killed and the PID is reused, status () may report a false
positive.  Note that this doesn't help when unprivileged users don't have the
right to read the pid file (e.g. sendmail, {sys,k}logd).

Comment 3 Christopher Aillon 2006-02-27 21:17:54 UTC
That's a patch to initscripts.  If work needs to happen there, it should go to
notting.


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