Bug 1343 - /etc/sysconfig/network-scripts/ifdown-ppp broken
/etc/sysconfig/network-scripts/ifdown-ppp broken
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
5.2
All Linux
low Severity medium
: ---
: ---
Assigned To: Bill Nottingham
:
Depends On:
Blocks:
  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:
Environment:
Last Closed: 1999-03-15 19:16:55 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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}'
2>/dev/null`
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.