[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#448524: reopen, fix too broad



reopen 448524
tags 448524 +patch
thanks

The fix in 2.25b-5 is unfortunately too broad.  

As pointed out in the follow-up from Patricio Silva, the fix fails to
anchor the regular expression properly (and besides, the Useless Use of
grep | grep is convoluted).

> PID=`cat $PIDFILE`
> 
> if ps ax | awk '{print $1}' | grep -q "^${PID}$"; then

This can be simplified as follows:

if ps ax | grep -q "^ *$(cat $PIDFILE) "; then

As a further comment on style, awk | grep can almost always be massaged
into a single awk invocation (but I don't think awk is necessary here,
and so the details are left as an exercise for the interested reader).

Attachment: patch
Description: Binary data


Reply to: