[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] fix hang in grep -F for empty string search
From: |
Jim Meyering |
Subject: |
Re: [PATCH] fix hang in grep -F for empty string search |
Date: |
Wed, 31 Mar 2010 12:04:38 +0200 |
Paolo Bonzini wrote:
...
> Subject: [PATCH 5/5] tests: improve empty test
>
> * tests/empty: Add more tests, note expected failure.
> ---
> tests/empty | 42 +++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 41 insertions(+), 1 deletions(-)
>
> diff --git a/tests/empty b/tests/empty
> index cd0d3fa..9e8f335 100755
> --- a/tests/empty
> +++ b/tests/empty
> @@ -16,7 +16,7 @@ require_timeout_
> failures=0
>
> for locale in C en_US.UTF-8; do
> - for options in '-E' '-E -w' '-F -x' '-G -w -x'; do
> + for options in '-E' '-F'; do
>
> # should return 0 found a match
> echo "" | LC_ALL=$locale timeout 10s grep $options -e ''
> @@ -38,6 +38,46 @@ for locale in C en_US.UTF-8; do
> echo "Status: Wrong status code, test \#3 failed ($options
> $locale)"
> failures=1
> fi
...
> + # -F -w omitted because it fails test #6, will be revisited after 2.6
> + # stabilizes.
I'm sure this bug you're documenting here will be fixed soon,
[I've confirmed it's present all the way back to at least grep-2.0]
but it'd be nice to make it a little clearer. You could say that
echo | src/grep -Fw '' exits with status 1 (no match), while without -F,
echo | src/grep -w '' works fine and prints the empty line.
I was tempted to add a separate test, since it's locale-independent,
but it's probably not worth it.
...
> + for options in '-E -w' '-E -x' '-E -w -x' '-F -x' '-F -w -x'; do
> +
> + # should return 0 found a match
> + echo "" | LC_ALL=$locale timeout 10s grep $options -e ''
> + if test $? -ne 0 ; then
> + echo "Status: Wrong status code, test \#6 failed ($options
> $locale)"
> + failures=1
> + fi
Thanks for the additions!