Subject: Re: bug#21700: new snapshot available: grep-2.21.78-7da30

From: Jim Meyering <[email-masked]>
Date: Sat, 24 Oct 2015 18:34:43 -0700

On Sat, Oct 17, 2015 at 10:26 PM, Jim Meyering <[email-masked]> wrote:
> I want to release grep-2.22 in just a couple of days.
> This release is motivated largely by the discovery that there has
> been a bug in versions 2.19, 2.20 and 2.21 that made grep mistakenly
> print some lines that did not match. However, there have also been
> several other bug fixes and notable performance improvements.
>
> Any testing you can do would be most welcome.
> Feedback, even the report that you "built and passed tests on XYZ,"
> would be appreciated.

I'm about to push the following three small patches and make another
test release, hoping a few more people will run tests. So far, very
few people have actually run tests, if the replies to this
announcement are any indication. Let's be optimistic and presume that
many have built and run the tests, but didn't bother to write in
because all of the test passed.
From 5f84d762fae5eafd57295982e7034c7fe12f689a Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Tue, 20 Oct 2015 07:44:44 -0700
Subject: [PATCH 1/3] tests: avoid spurious failure on OpenBSD 5.8

* tests/fedora: Don't rely on "diff - FILE" reading from stdin.
Reported privately by Nelson Beebe.
---
 tests/fedora | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tests/fedora b/tests/fedora
index d26b40e..e7e7463 100755
--- a/tests/fedora
+++ b/tests/fedora
@@ -33,17 +33,20 @@ cat > 116909.out <<EOF
 a
 c
 EOF
-grep -F -w -f 116909.list 116909.in | diff - 116909.out && ok || fail
+grep -F -w -f 116909.list 116909.in > actual || fail
+compare 116909.out actual && ok || fail

 U=https://bugzilla.redhat.com/show_bug.cgi?id=123362
 printf 'bad handling of brackets in UTF-8: '
 echo Y > 123362.out
-echo Y | LC_ALL=de_DE.UTF-8 grep -i '[y,Y]' | diff - 123362.out && ok || fail
+echo Y | LC_ALL=de_DE.UTF-8 grep -i '[y,Y]' > actual || fail
+compare 123362.out actual && ok || fail

 U=https://bugzilla.redhat.com/show_bug.cgi?id=112869
 printf 'crash with \\W: '
 echo '<form>' > 112869.out
-LANG=it_IT grep -iE '\Wform\W' 112869.out | diff - 112869.out && ok || fail
+LANG=it_IT grep -iE '\Wform\W' 112869.out > actual || fail
+compare 112869.out actual && ok || fail

 if ( timeout --version ) > /dev/null 2>&1; then

@@ -67,12 +70,14 @@ fi
 U=https://bugzilla.redhat.com/show_bug.cgi?id=161700
 printf 'grep -Fw fails to match anything: '
 echo test > 161700.out
-grep -Fw test 161700.out | diff - 161700.out && ok || fail
+grep -Fw test 161700.out > actual || fail
+compare 161700.out actual && ok || fail

 U=https://bugzilla.redhat.com/show_bug.cgi?id=179698
 printf 'grep -w broken in non-utf8 multibyte locales: '
 echo za a > 179698.out
-LANG=ja_JP.eucjp grep -w a 179698.out | diff - 179698.out && ok || fail
+LANG=ja_JP.eucjp grep -w a 179698.out > actual || fail
+compare 179698.out actual && ok || fail

 # Skip the rest of tests in compiled without PCRE
 echo a |grep -P a >/dev/null || Exit $failures
@@ -80,7 +85,8 @@ echo a |grep -P a >/dev/null || Exit $failures
 U=https://bugzilla.redhat.com/show_bug.cgi?id=171379
 printf 'grep -P crashes on whitespace lines: '
 echo '   ' > 171379.out
-grep -P '^\s+$' 171379.out | diff - 171379.out && ok || fail
+grep -P '^\s+$' 171379.out > actual || fail
+compare 171379.out actual && ok || fail

 U=https://bugzilla.redhat.com/show_bug.cgi?id=204255
 printf '%s' "-e '' does not work if not a first parameter: "
-- 
2.6.0

From 7905d176c4247bd722eb8e44f8cf05cbbb248fba Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Tue, 20 Oct 2015 08:20:38 -0700
Subject: [PATCH 2/3] maint: NEWS: correct/amend

* NEWS: Move the long-regexp-performance-improvement from
"Bug fixes" to "Improvements."  Say more and include an example.
The -Fw degradation was introduced in commit v2.18-125-g94555dd
---
 NEWS | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 91db25d..1b2f4e4 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,13 @@ GNU grep NEWS                                    -*- outline -*-

 ** Improvements

+  Performance has improved for patterns containing very long strings,
+  reducing preprocessing time for an N-byte regexp from O(N^2) to
+  only slightly superlinear for most patterns.  Before, a command like
+  the following would take over a minute, but now, it takes less than
+  a second:
+  : | grep -f <(seq -s '' 99999)
+
   When building grep, 'configure' now uses PCRE's pkg-config module for
   configuration information, rather than attempting to guess it by hand.

@@ -17,6 +24,7 @@ GNU grep NEWS                                    -*- outline -*-

   grep no longer reads from uninitialized memory or from beyond the end
   of the heap-allocated input buffer.  This fix addressed CVE-2015-1345.
+  [bug introduced in grep-2.19 ]

   With -z, '.' and '[^x]' in a pattern now consistently match newline.
   Previously, they sometimes matched newline, and sometimes did not.
@@ -32,8 +40,8 @@ GNU grep NEWS                                    -*- outline -*-
   command-line arguments, not against command-line components.
   [bug introduced in grep-2.6]

-  Performance has improved for patterns containing very long strings,
-  and for grep -Fw in unibyte locales.
+  Fix performance degradation of grep -Fw in unibyte locales.
+  [bug introduced in grep-2.19 ]

 * Noteworthy changes in release 2.21 (2014-11-23) [stable]
-- 
2.6.0

From 76ef49ebd0476bbbbc262f48572d3be9411ffb8a Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Sat, 24 Oct 2015 13:03:22 -0700
Subject: [PATCH 3/3] gnulib: update to latest, for portability fixes

* gnulib: Pull in changes like these:
  fts: port to C11 alignof
  stdalign: work around pre-4.9 GCC x86 bug
---
 gnulib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnulib b/gnulib
index 37c054a..937ba96 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 37c054af09357276eb560990eba1f20cdc489bfc
+Subproject commit 937ba966ec93bc62c58a27293e817752d94a9fa8
-- 
2.6.0