bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix grep -Fw '' against empty string


From: Jim Meyering
Subject: Re: [PATCH] Fix grep -Fw '' against empty string
Date: Sat, 03 Apr 2010 08:25:48 +0200

Paolo Bonzini wrote:
> I found this bug while working on the hang.  I thought it could be
> fixed only by almost-rewriting Fexecute, but this doesn't seem true.
>
> Additional pairs of eyes are very welcome.
>
> Paolo Bonzini (2):
>   grep: fix matching the empty string with grep -Fw
>   test: cover just-fixed bug
>
>  NEWS           |    3 +++
>  src/kwsearch.c |    4 +++-
>  tests/empty    |    4 +---
>  3 files changed, 7 insertions(+), 4 deletions(-)
>
> Subject: [PATCH 1/2] grep: fix matching the empty string with grep -Fw
>
> * NEWS: Document fix.
> * src/kwsearch.c (Fexecute): The empty string is a valid match if it is
> a whole word.

Thanks for the patch.
That looks like a correct change.

However, the change in behavior is likely enough to cause trouble
that I preferred to defer it to 2.7.

While uses like grep -Fw '' (explicit empty string) are probably very
rare, using grep -Fw -f KEYWORD_FILE with blank lines in that file is
much more plausible, and this fix would cause a big behavior change.
With the fix, grep will now match all blank lines in the input.

You're welcome to push it now (though please move the NEWS entry "up").




reply via email to

[Prev in Thread] Current Thread [Next in Thread]