From nobody@FreeBSD.org  Thu Apr 28 19:25:35 2011
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 C5EC0106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 28 Apr 2011 19:25:35 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id B4D748FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 28 Apr 2011 19:25:35 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p3SJPZQq035474
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 28 Apr 2011 19:25:35 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p3SJPZXd035473;
	Thu, 28 Apr 2011 19:25:35 GMT
	(envelope-from nobody)
Message-Id: <201104281925.p3SJPZXd035473@red.freebsd.org>
Date: Thu, 28 Apr 2011 19:25:35 GMT
From: Artem Perekresny <kondybas@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Improper behaviour of GNU grep
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         156704
>Category:       gnu
>Synopsis:       Improper behaviour of GNU grep(1)
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 28 19:30:10 UTC 2011
>Closed-Date:    
>Last-Modified:  Tue May 03 06:18:30 UTC 2011
>Originator:     Artem Perekresny
>Release:        386/7.3p4 am64/8.2
>Organization:
Private person
>Environment:
FreeBSD relay.maltitek.rv.ua 7.3-RELEASE-p4 FreeBSD 7.3-RELEASE-p4 #0: Sun Mar  6 12:00:45 EET 2011     artem@relay.maltitek.rv.ua:/usr/src/sys/i386/compile/MTEK  i386

>Description:
grep (GNU grep) 2.5.1-FreeBSD fails on "-o" option 

When pattern is alternatives joined with "|" option "-o" produce every possible matches ignoring "^", "\<", "\b" etc.


>How-To-Repeat:
# cat file.txt
ABCD
# egrep -o "^A" file.txt
A
# egrep -o "^B" file.txt
# egrep -o "^A|^B|^C|^D" file.txt
A
B
C
D
# cat file2.txt
DCBA
# egrep -o "^A|^B|^C|^D" file2.txt
D
C
B
A
#
>Fix:


>Release-Note:
>Audit-Trail:

From: Alexander Best <arundel@freebsd.org>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: gnu/156704: Improper behaviour of GNU grep
Date: Fri, 29 Apr 2011 09:33:34 +0000

 just tried this with BSD grep and there the issue is not reproducable.
 
 i'm quite sure this has already been fixed in gnu grep, however one needs to
 check, whether this was done before or after the switch to gplv3.
 
 cheers.
 alex
 
 -- 
 a13x
>Unformatted:
