Bug 1343

Summary: /etc/sysconfig/network-scripts/ifdown-ppp broken
Product: [Retired] Red Hat Linux Reporter: henry
Component: initscriptsAssignee: Bill Nottingham <notting>
Severity: medium Docs Contact:
Priority: low    
Version: 5.2CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-03-16 00:16:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

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}'

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