Bug 53070 - daemon() in /etc/rc.d/init.d/functions fails to detect already-running daemon instances
Summary: daemon() in /etc/rc.d/init.d/functions fails to detect already-running daemon...
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
(Show other bugs)
Version: 7.1
Hardware: i386 Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-09-03 06:03 UTC by Need Real Name
Modified: 2014-03-17 02:23 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-09-03 06:03:29 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Need Real Name 2001-09-03 06:03:25 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

Description of problem:
The daemon() function within /etc/rc.d/init.d/functions attempts to 
discern whether or not any instances of the specifed process are already 
running.  If so then it returns without further invocations.  The snippet 
currently looks like:

  #See if it's already running.  Look *only* at the pid file.
  pidlist=`pidfileofproc $base`
[ -n "$pid" ] && return

This snippet is erroneous in that it tests whether or not the length of 
$pid is non-zero, yet it is $pidlist that is populated with existing pid
(s).  Result is that running instances are never detected.

Solution is to use consistent variable naming.

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


How reproducible:
Always

Steps to Reproduce:
1. Write a start-script that utilizes the daemon() function 
within /etc/rc.d/init.d/functions to start up a process.
2. Run the start-script, and note the # of running instances of the 
specified process.
3. Run the start-script a second time, and note that 2 processes should 
now be running.
	

Actual Results:  Two instances of the process were observed to be running 
after the second invocation of the start-script.

Expected Results:  Only one instance of the process was expected to be 
running after the second invocation of the start-script.

Additional info:

When I used consistent variable-naming (i.e. I changed $pid to $pidlist in 
the snippet from daemon() within /etc/rc.d/init.d/functions, the expected 
results were then produced.

Comment 1 Bill Nottingham 2001-09-04 00:20:58 UTC
This is fixed in the roswell initscripts.


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