Bug 1335 - Broken status function
Broken status function
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: David Lawrence
Depends On:
  Show dependency treegraph
Reported: 1999-02-25 13:46 EST by jdsmith
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 1999-03-08 13:50:50 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description jdsmith 1999-02-25 13:46:52 EST
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 16:07:59 EST
I have been unable to replicate this behaviour in the test lab.
Comment 2 jdsmith 1999-02-25 16:21:59 EST
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 13:50:59 EST
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.