From yar@comp.chem.msu.su  Tue Oct 25 07:06:38 2005
Return-Path: <yar@comp.chem.msu.su>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5C95416A41F;
	Tue, 25 Oct 2005 07:06:38 +0000 (GMT)
	(envelope-from yar@comp.chem.msu.su)
Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 276F643D48;
	Tue, 25 Oct 2005 07:06:36 +0000 (GMT)
	(envelope-from yar@comp.chem.msu.su)
Received: from comp.chem.msu.su (localhost [127.0.0.1])
	by comp.chem.msu.su (8.13.3/8.13.3) with ESMTP id j9P76YP7072874;
	Tue, 25 Oct 2005 11:06:34 +0400 (MSD)
	(envelope-from yar@comp.chem.msu.su)
Received: (from yar@localhost)
	by comp.chem.msu.su (8.13.3/8.13.3/Submit) id j9P76Yke072873;
	Tue, 25 Oct 2005 11:06:34 +0400 (MSD)
	(envelope-from yar)
Message-Id: <200510250706.j9P76Yke072873@comp.chem.msu.su>
Date: Tue, 25 Oct 2005 11:06:34 +0400 (MSD)
From: Yar Tikhiy <yar@comp.chem.msu.su>
To: FreeBSD-gnats-submit@freebsd.org
Cc: tjr@freebsd.org, re@freebsd.org
Subject: Regression in "fgrep -w"
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         87969
>Category:       gnu
>Synopsis:       Regression in "fgrep -w"
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    tjr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 25 07:10:16 GMT 2005
>Closed-Date:    Thu Oct 27 16:30:54 GMT 2005
>Last-Modified:  Thu Oct 27 16:30:54 GMT 2005
>Originator:     Yar Tikhiy
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
MSU
>Environment:

	The problem found in CURRENT and RELENG_6,
	but not in RELENG_5 or RELENG_4.

>Description:

	The manifestation of the problem is simple: "fgrep -w" fails
	to match the substring given although it is there and delimited
	by whitespace or other non-word characters (tested for '.').
	This failure happened for all substrings tested.

	The problem is rather grave because grep is widely used to
	process system logs and its malfunction can lead to system
	events of high importance missed.

	The problem is specific to fgrep or "grep -F", and it doesn't
	seem to affect basic grep or "grep -E".
	
	"fgrep -w" appears to be broken in CURRENT and RELENG_6,
	but not in RELENG_5 despite the fact that all the 3 branches
	share the same version of grep.  RELENG_4 isn't affected
	either.  Hence the problem might have to do with the changes
	to grep that had come to HEAD before RELENG_6 was tagged.
	src/gnu/usr.bin/grep/search.c is the most probable suspect.

>How-To-Repeat:

	CURRENT built yesterday:

		yar@behemoth:~$unset LANG LC_ALL LC_CTYPE
		yar@behemoth:~$grep --version
		grep (GNU grep) 2.5.1-FreeBSD

		Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
		This is free software; see the source for copying conditions. There is NO
		warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

		yar@behemoth:~$echo a b c | grep -Fw b
		yar@behemoth:~$echo a.b.c | grep -Fw b
		yar@behemoth:~$echo a b c | grep -w b
		a b c
		yar@behemoth:~$echo a b c | grep -Ew b
		a b c
		yar@behemoth:~$echo a b c | grep -F b
		a b c
		yar@behemoth:~$

	RELENG_6 as of about RC1 time:

		yar@rt2:~$unset LANG LC_ALL LC_CTYPE
		yar@rt2:~$grep --version
		grep (GNU grep) 2.5.1-FreeBSD

		Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
		This is free software; see the source for copying conditions. There is NO
		warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

		yar@rt2:~$echo a b c | grep -Fw b
		yar@rt2:~$echo a.b.c | grep -Fw b
		yar@rt2:~$echo a b c | grep -w b
		a b c
		yar@rt2:~$echo a b c | grep -Ew b
		a b c
		yar@rt2:~$echo a b c | grep -F b
		a b c
		yar@rt2:~$

	RELENG_5 (pretty old, as of the 23rd of May):

		yar@rt1:~$unset LANG LC_ALL LC_CTYPE
		yar@rt1:~$grep --version
		grep (GNU grep) 2.5.1-FreeBSD

		Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
		This is free software; see the source for copying conditions. There is NO
		warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

		yar@rt1:~$echo a b c | grep -Fw b
		a b c
		yar@rt1:~$echo a.b.c | grep -Fw b
		a.b.c
		yar@rt1:~$

	RELENG_4 (freefall):

		-bash-2.05b$ echo a b c | grep -Fw b
		a b c
		-bash-2.05b$ echo a.b.c | grep -Fw b
		a.b.c
		-bash-2.05b$

>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->tjr 
Responsible-Changed-By: tjr 
Responsible-Changed-When: Tue Oct 25 08:39:18 GMT 2005 
Responsible-Changed-Why:  
I'm investigating this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=87969 
State-Changed-From-To: open->patched 
State-Changed-By: tjr 
State-Changed-When: Tue Oct 25 09:20:08 GMT 2005 
State-Changed-Why:  
Fixed in -current. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=87969 
State-Changed-From-To: patched->closed 
State-Changed-By: jkim 
State-Changed-When: Thu Oct 27 16:29:49 GMT 2005 
State-Changed-Why:  
MFC'd to RELENG_6 and RELENG_6_0. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=87969 
>Unformatted:
