Bug 1343 - /etc/sysconfig/network-scripts/ifdown-ppp broken
/etc/sysconfig/network-scripts/ifdown-ppp broken
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Depends On:
  Show dependency treegraph
Reported: 1999-02-25 21:16 EST by henry
Modified: 2014-03-16 22:09 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 1999-03-15 19:16:55 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 henry 1999-02-25 21:16:37 EST
In  the  /etc/sysconfig/network-scripts/ifdown-ppp file
that   comes   with    Red    Hat    5.2    (part    of
initscripts-3.78-1),  the line that tries to figure out
a value for CHATPID:

CHATPID=`ps axl | awk '$4 ~ $PID {print $3}' 2>/dev/null`

is busted for two unrelated reasons:

    since $PID occurs in single quotes, it is NOT going
        to  be  substituted with the value of the shell
        variable PID.  Since the awk variable PID isn't
        initialized,  it is the empty string, which, as
        a number, is viewed as 0, so $PID is  $0  which
        is  the  entire  line.   Usually this will just
        fail to match.  Some times the ps line will not
        be  a valid regular expression (e.g., unmatched
        parens coming from the command  arguments),  in
        which case awk will exit.

    Even   correcting   this  mistake  is  not  enough.
        CHATPID is looking for a process which has $PID
        as  its  parent process, not one which has $PID
        as a substring of its parent process id.

A fix is to use
CHATPID=`ps axl | awk '$4 ~ /^'"$PID"'$/ {print $3}'
Comment 1 David Lawrence 1999-03-02 16:56:59 EST
This has been passed on to a developer for further review.
Comment 2 Bill Nottingham 1999-03-15 19:16:59 EST
fixed in initscripts-3.95-1

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