bug-grep
[Top][All Lists]
Advanced

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

[PATCH 5/6] fix cross-line matching in PCRE backend


From: Jim Meyering
Subject: [PATCH 5/6] fix cross-line matching in PCRE backend
Date: Sat, 06 Mar 2010 09:56:28 +0100

Paolo Bonzini wrote:
> Subject: [PATCH 5/6] fix cross-line matching in PCRE backend
> * search.c (Pexecute): Split the buffer in lines and match each line
> separately.
> * tests/fedora.sh: Add regression testsuite.

Won't this induce a large performance penalty for a buffer
with no matches but with many lines?
Eventually we should do the right thing and iteratively
match through the full buffer and post-process each to eliminate
any that span lines.

But correctness trumps performance, so go ahead.

> diff --git a/tests/fedora.sh b/tests/fedora.sh
> index d08bfce..a179271 100644
> --- a/tests/fedora.sh
> +++ b/tests/fedora.sh
> @@ -85,4 +85,12 @@ echo test | grep -e 'HighlightThis' -e '' > 204255.first
>  echo test | grep -e '' -e 'HighlightThis' > 204255.second
>  diff 204255.first 204255.second && ok || fail
>
> +U=https://bugzilla.redhat.com/show_bug.cgi?id=324781
> +echo -n "bad handling of line breaks with grep -P #1: "
> +echo -ne "a\na" | ${GREP} -P '[^a]' >/dev/null && fail || ok
> +
> +# This is mostly a check that fix for above doesn't break -P further
> +echo -n "bad handling of line breaks with grep -P #2: "
> +echo -ne "a\na" | ${GREP} -P '[^b].[^b]' >/dev/null && fail || ok

That this new script introduces uses of echo -n is a regression.
echo -n is not portable, and I recently replaced the sole then-remaining
use with a use of printf.

That said, I don't mind if you push this, as long as you
clean up afterward.




reply via email to

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