Package: grep
Version: 2.5.4-4
Whether this is a bug is perhaps debatable (because of the vagueness
of specifications in the matter), and maybe needs to be discussed
upstream, but the following behavior is extremely confusing at the
very least:
vega david ~ $ locale
LANG=
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
vega david ~ $ printf 'foobar\251\n' > /tmp/test
vega david ~ $ fgrep -q foobar /tmp/test
vega david ~ $ echo $?
0
vega david ~ $ fgrep -q -i foobar /tmp/test
vega david ~ $ echo $?
1
vega david ~ $ LC_CTYPE=C fgrep -q -i foobar /tmp/test
vega david ~ $ echo $?
0
I realize that "foobar\251\n" is not a well-formed utf-8 text file, so
fgrep is basically allowed to send daemons flying through my nose, but
I still think it is very wrong that fgrep -i foobar should not match a
file, be it binary, be it in a utf-8 locale, somehow containing the
string "foobar", especially as fgrep foobar and egrep -i foobar (and
egrep foobar) all match.
--
David A. Madore
( http://www.madore.org/~david/ )
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]