| Summary: | Annoying grep(1) bug with --color | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Ighighi <ighighi> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 6.3-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
Ighighi
2008-07-06 06:00:02 UTC
Ighighi wrote:
> GNU grep fixed it some time ago
Which version contains the fix?
Kris
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@ubuntu:~$ env -i /bin/grep --colour=always :0: /etc/passwd
root:x:0:0:root:/root:/bin/bash
ws@ubuntu:~$ env -i /bin/grep --only-matching :0: /etc/passwd
:0:
ws@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.
State Changed From-To: open->closed I agree with Wayne, who suggested the overlapped matching. As we don't have any patches, we're closing this PR. Will be happy to open up again if we receive patches. it would be interesting to see how the new BSD licensed grep handles this case. -- a13x ok just checked. GNU grep and BSD grep behave exactly the same in this case. :) cheers. alex -- a13x |