From nobody@FreeBSD.org  Sun Jul  6 04:50:06 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E6DD91065678
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  6 Jul 2008 04:50:06 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id B6C478FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  6 Jul 2008 04:50:06 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m664o6Bd045078
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 6 Jul 2008 04:50:06 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m664o6PJ045077;
	Sun, 6 Jul 2008 04:50:06 GMT
	(envelope-from nobody)
Message-Id: <200807060450.m664o6PJ045077@www.freebsd.org>
Date: Sun, 6 Jul 2008 04:50:06 GMT
From: Ighighi <ighighi@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Annoying grep(1) bug
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         125325
>Category:       bin
>Synopsis:       Annoying grep(1) bug with --color
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 06 05:00:02 UTC 2008
>Closed-Date:    Sat Aug 28 18:45:50 UTC 2010
>Last-Modified:  Sun Aug 29 10:10:06 UTC 2010
>Originator:     Ighighi
>Release:        6.3-STABLE (RELENG_6)
>Organization:
>Environment:
6.3-STABLE FreeBSD 6.3-STABLE #0: Fri Jul  4 21:56:00 VET 2008
>Description:
GNU grep(1) -color has an annoying bug. Sometimes it doesn't colorize the relevant
string.

Old-school tty hackers: I value my vision ;-)
>How-To-Repeat:
$ 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.
>Fix:
GNU grep fixed it some time ago.

>Release-Note:
>Audit-Trail:

From: Kris Kennaway <kris@FreeBSD.org>
To: Ighighi <ighighi@gmail.com>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/125325: Annoying grep(1) bug
Date: Sun, 06 Jul 2008 20:18:26 +0200

 Ighighi wrote:
 
 > GNU grep fixed it some time ago
 
 Which version contains the fix?
 
 Kris
 

From: Wayne Sierke <ws@au.dyndns.ws>
To: Ighighi <ighighi@gmail.com>
Cc: bug-followup@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@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 
State-Changed-By: vwe 
State-Changed-When: Sat Aug 28 18:43:51 UTC 2010 
State-Changed-Why:  
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. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=125325 

From: Alexander Best <arundel@freebsd.org>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/125325: Annoying grep(1) bug with --color
Date: Sun, 29 Aug 2010 09:51:22 +0000

 it would be interesting to see how the new BSD licensed grep handles this case.
 
 -- 
 a13x

From: Alexander Best <arundel@freebsd.org>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/125325: Annoying grep(1) bug with --color
Date: Sun, 29 Aug 2010 10:07:16 +0000

 ok just checked. GNU grep and BSD grep behave exactly the same in this case. :)
 
 cheers.
 alex
 
 -- 
 a13x
>Unformatted:
