Skip site navigation (1)Skip section navigation (2)
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:        re@FreeBSD.org, tjr@FreeBSD.org
Subject:   gnu/87969: Regression in "fgrep -w"
Message-ID:  <200510250706.j9P76Yke072873@comp.chem.msu.su>
Resent-Message-ID: <200510250710.j9P7AGsn042814@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         87969
>Category:       gnu
>Synopsis:       Regression in "fgrep -w"
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 25 07:10:16 GMT 2005
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510250706.j9P76Yke072873>