gnu/105221: grep(1): `grep -w -F ""` issue
Dorr H. Clark
dclark at engr.scu.edu
Thu Oct 9 07:00:13 UTC 2008
The following reply was made to PR gnu/105221; it has been noted by GNATS.
From: "Dorr H. Clark" <dclark at engr.scu.edu>
To: bug-followup at FreeBSD.org
Cc: freebsd-bugs at FreeBSD.org, martinko <gamato at users.sourceforge.net>
Subject: Re: gnu/105221: grep(1): `grep -w -F ""` issue
Date: Wed, 8 Oct 2008 23:53:08 -0700 (PDT)
gnu/105221
The behavior described in 105221 is due to 'grep' looping
infinitely within Fexecute() of revision 1.25 of search.c.
When used with the combination of '-w' and '-F' and
the empty string, 'grep' enters a inescapable "while(1)" block
A proposed fix then, is to immediately fail the search for a match
when grep is called with this combination of options if the
string to match is zero-length (and thus, trivially does not match
the non-empty input!).
David K Lam
Engineer
Dorr H. Clark
Advisor
Graduate School of Engineering
Santa Clara University
Santa Clara, CA
http://www.cse.scu.edu/~dclark/coen_284_FreeBSD/105221.txt
--- /usr/src/gnu/usr.bin/grep/search.c 2006-02-19 04:27:39.000000000 +0000
+++ search.c 2008-08-21 00:29:38.000000000 +0000
@@ -959,6 +959,10 @@
}
else if (match_words)
{
+
+ if(beg[len-1] == eol)
+ break;
+
while (1)
{
int word_match = 0;
More information about the freebsd-bugs
mailing list