Bug 1335 - Broken status function
Summary: Broken status function
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 5.2
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: David Lawrence
QA Contact:
Depends On:
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:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 1999-03-08 18:50:50 UTC

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

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

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.


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.



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.