Subject: grep-2.5.1a bug report: broken egrep and fgrep



In mail of Thu, 4 Apr 2002 18:45:37 -0700 (MST), I reported a problem
with grep-2.5.1 on the bug-gnu-utils@xxxxxxx list. On Friday, I
installed the new grep-2.5.1a release, and over the weekend,
discovered from failing cron jobs that the bug that I reported has not
yet been fixed.

Here it is again, from my original message:

>> ...
>> In past grep releases, egrep and fgrep were symbolic (or hard) links
>> to grep.
>>
>> However, in this new release, egrep and fgrep are shell scripts:
>>
>> % cat /usr/local/bin/egrep
>> #!/bin/sh
>> exec grep -E ${1+"$@"}
>>
>> % cat /usr/local/bin/fgrep
>> #!/bin/sh
>> exec grep -F ${1+"$@"}
>>
>> Cron jobs normally run with a limited PATH, often just /bin:/usr/bin.
>> Even though my cron job explicitly invoked /usr/local/bin/egrep, that
>> script then runs /bin/grep, which is not the GNU version, and it does
>> not recognize the -E (or -F) option.
>>
>> I'm patching these scripts locally so that the last line reads
>>
>> exec /usr/local/bin/grep -E ${1+"$@"}
>>
>> and
>>
>> exec /usr/local/bin/grep -F ${1+"$@"}
>>
>> respectively.
>>
>> It is imperative that future releases of GNU grep account for this:
>> those scripts should have
>>
>> exec $prefix/bin/grep ...
>>
>> where $prefix is replaced at install time by the value in the
>> ...

Makefile.

>> ...

In the local patch that I made this morning, I replaced /usr/local/bin
by `dirname $0`, so that my patched script works even on systems where
prefix is something other than /usr/local (I have at least three such
systems).

-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: beebe@xxxxxxxxxxxxx -
- 155 S 1400 E RM 233 beebe@xxxxxxx beebe@xxxxxxxxxxxx -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe -
-------------------------------------------------------------------------------







Privacy