Bug 1335

Summary: Broken status function
Product: [Retired] Red Hat Linux Reporter: jdsmith
Component: initscriptsAssignee: David Lawrence <dkl>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-03-08 18:50:50 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:

Description jdsmith 1999-02-25 18:46:52 UTC
The status function included in the initscripts-3.78-1 file
/etc/rc.d/init.d/functions seems to be broken.  The command
at line 130 checking for the pid of the passed process is:

pid=`ps auxww | grep '[^[]'$1 | awk '{print $2}'`

which finds several processes that aren't relevant (such at
status itself).  The old code I find in initscripts-3.67-1
is:

pid=`ps auxww | grep $1 | egrep -v grep\|$0 | awk '{print
$2}'`

which works fine.  I'm not sure I understand why
non-relevant processes would have a '[' before the name, and
hence why this change was implemented.  I'm using the
standard procps-1.2.9-2 for ps.

Thanks,

JD Smith

Comment 1 David Lawrence 1999-02-25 21:07:59 UTC
I have been unable to replicate this behaviour in the test lab.

Comment 2 jdsmith 1999-02-25 21:21:59 UTC
This is a multi-task issue.  The grep and/or other commands may
actually be complete before ps looks for them.

For instance:

bash> ps auxw | grep '[^[]'boo

will either show the grep[^[]boo or not, arbitrarily, when run on my
machine.  Just because the grep is after the ps in the pipe, this
doesn't guarantee that it won't show up on the process table.  And
unless the expression '[^[]' somehow eliminates these unwanted
processes, the script is broken.  Note that the egrep -v in the old
version performed this elimination.


Thanks,

JD

Comment 3 Bill Nottingham 1999-03-08 18:50:59 UTC
this has been fixed in a later version of initscripts.