Bug 433018

Summary: rc.d/init.d/functions:status() should consider pid files before pidof
Product: [Fedora] Fedora Reporter: Matthew Farrellee <matt>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 8CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-09-24 14:14:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 440658    
Attachments:
Description Flags
proposed patch to rc.d/init.d/functions none

Description Matthew Farrellee 2008-02-15 18:14:35 UTC
Description of problem:

The status() function from rc.d/init.d/functions uses pidof to locate pids
before considering pid files. A service that uses pid files will not have them
considered, except for the pid dead but pid file exists case, and pids of
processes with the same name as the service may be incorrectly associated with
the service.

This can result in issues during "service X start" when the init script for X is
written to be LSB-ish compliant (only start if not running) and it uses status()
to determine if the service is running.


Version-Release number of selected component (if applicable):

At least version initscripts 8.60-1 and 8.63-1


Additional info:

A proposed solution is attached as a patch to initscripts-8.63. It changes the
logic of status() to consider pid files only if one is available. There is no
logical change for init scripts that do not use pid files, they will still use
pidof to locate pids of their processes. The logical change for scripts that use
pid files is that they cannot have similarly named processes inadvertently
associated with their service, a good thing. However, if the script uses pid
files and those pid files are improperly managed, i.e. don't hold correct pids
for the service or are not removed when the service stops, the script is
essentially relying on pidof and this change will expose the dependency and the
broken pid file management.

Comment 1 Matthew Farrellee 2008-02-15 18:14:35 UTC
Created attachment 295025 [details]
proposed patch to rc.d/init.d/functions

Comment 2 Bill Nottingham 2008-09-24 14:14:46 UTC
I'm leery of removing the fallback to pidof; this would cause status to behave differently from killproc, etc. 

Fixed in:
http://git.fedorahosted.org/git/?p=initscripts.git;a=commitdiff;h=27bb4e72ea41d86efa0478d27026f80e2cc4a75f;hp=d027a8366d22b2aa7a54ef8c030fff4024bdd5b9