bin/125325: Annoying grep(1) bug
Wayne Sierke
ws at au.dyndns.ws
Mon Jul 7 18:20:04 UTC 2008
The following reply was made to PR bin/125325; it has been noted by GNATS.
From: Wayne Sierke <ws at au.dyndns.ws>
To: Ighighi <ighighi at gmail.com>
Cc: bug-followup at freebsd.org
Subject: Re: bin/125325: Annoying grep(1) bug
Date: Tue, 08 Jul 2008 03:29:16 +0930
On Sun, 2008-07-06 at 04:50 +0000, Ighighi wrote:
>
> $ env -i /usr/bin/grep --colour=always :0: /etc/passwd
> root:*:0:0:Charlie &:/root:/usr/local/bin/bash
> toor:*:0:0:Bourne-again Superuser:/root:
>
> The entire ":0:0:" should be colorized.
Note that this is probably to do with pattern-matching rather than
colouring:
%env -i /usr/bin/grep --only-matching :0: /etc/passwd
:0:
:0:
%/usr/bin/grep --version
grep (GNU grep) 2.5.1-FreeBSD
...
Testing with ubuntu-8.04.1:

ws at ubuntu:~$ env -i /bin/grep --colour=always :0: /etc/passwd
root:x:0:0:root:/root:/bin/bash
ws at ubuntu:~$ env -i /bin/grep --only-matching :0: /etc/passwd
:0:
ws at ubuntu:~$ /bin/grep --version
GNU grep 2.5.3
...
(only the first :0: is coloured in the first result).
2.5.3 seems to be the latest version of GNU grep.
It's not clear that failing to match overlapped instances of patterns is
a bug.
More information about the freebsd-bugs
mailing list