Bug 1335 - Broken status function
Summary: Broken status function
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 5.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: David Lawrence
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-02-25 18:46 UTC by jdsmith
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 1999-03-08 18:50:50 UTC
Embargoed:


Attachments (Terms of Use)

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.


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