gnu/87969: Regression in "fgrep -w"

Yar Tikhiy yar at comp.chem.msu.su
Tue Oct 25 00:10:18 PDT 2005


>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 at behemoth:~$unset LANG LC_ALL LC_CTYPE
		yar at 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 at behemoth:~$echo a b c | grep -Fw b
		yar at behemoth:~$echo a.b.c | grep -Fw b
		yar at behemoth:~$echo a b c | grep -w b
		a b c
		yar at behemoth:~$echo a b c | grep -Ew b
		a b c
		yar at behemoth:~$echo a b c | grep -F b
		a b c
		yar at behemoth:~$

	RELENG_6 as of about RC1 time:

		yar at rt2:~$unset LANG LC_ALL LC_CTYPE
		yar at 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 at rt2:~$echo a b c | grep -Fw b
		yar at rt2:~$echo a.b.c | grep -Fw b
		yar at rt2:~$echo a b c | grep -w b
		a b c
		yar at rt2:~$echo a b c | grep -Ew b
		a b c
		yar at rt2:~$echo a b c | grep -F b
		a b c
		yar at rt2:~$

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

		yar at rt1:~$unset LANG LC_ALL LC_CTYPE
		yar at 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 at rt1:~$echo a b c | grep -Fw b
		a b c
		yar at rt1:~$echo a.b.c | grep -Fw b
		a.b.c
		yar at 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:


More information about the freebsd-bugs mailing list