Bug 1343 - /etc/sysconfig/network-scripts/ifdown-ppp broken
Summary: /etc/sysconfig/network-scripts/ifdown-ppp broken
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 5.2
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-02-26 02:16 UTC by henry
Modified: 2014-03-17 02:09 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 1999-03-16 00:16:55 UTC
Embargoed:


Attachments (Terms of Use)

Description henry 1999-02-26 02:16:37 UTC
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 21:56:59 UTC
This has been passed on to a developer for further review.

Comment 2 Bill Nottingham 1999-03-16 00:16:59 UTC
fixed in initscripts-3.95-1


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