Thanks for the review and push.

I also submit a test case for this bug.  It fails in grep-2.18.146-ebf3,
and succeeds in current master.
From 52d1cf2be862d66beb4f0de420d750d6224e525e Mon Sep 17 00:00:00 2001
From: Norihiro Tanaka <[email protected]>
Date: Sun, 18 May 2014 07:45:40 +0900
Subject: [PATCH] tests: add test case previous fix previous change

* tests/count-newline: New test.
* tests/Makefile.am (TESTS): Add it.
---
 tests/Makefile.am   |  1 +
 tests/count-newline | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100755 tests/count-newline

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 626b25a..82a6d2d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -49,6 +49,7 @@ TESTS =                                               \
   char-class-multibyte                         \
   char-class-multibyte2                                \
   context-0                                    \
+  count-newline                                        \
   dfa-coverage                                 \
   dfa-heap-overrun                             \
   dfaexec-multibyte                            \
diff --git a/tests/count-newline b/tests/count-newline
new file mode 100755
index 0000000..278e74f
--- /dev/null
+++ b/tests/count-newline
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Test that newline is counted correctly even when transition table is
+# rebuild.
+
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+
+printf '%1024d\nb\n' 0 >in || framework_failure_
+
+grep -f in in >out || fail=1
+
+compare in out || fail=1
+
+Exit $fail
-- 
1.9.3

Reply via email to