From 97a081551e6ad0fa5b2636cd7b4bcee2fad8b10f Mon Sep 17 00:00:00 2001 From: Jaroslav Škarvada Date: Jan 06 2016 16:53:20 +0000 Subject: Used latest upstream patch for bug 1269014 to fix regression, fixed order of patches Resolves: rhbz#1269014 --- diff --git a/grep-2.22-Pc-consistent-results.patch b/grep-2.22-Pc-consistent-results.patch index 7c5ef2f..fcef49a 100644 --- a/grep-2.22-Pc-consistent-results.patch +++ b/grep-2.22-Pc-consistent-results.patch @@ -1,24 +1,81 @@ diff --git a/src/grep.c b/src/grep.c +index eac540a..9fabeb8 100644 --- a/src/grep.c +++ b/src/grep.c -@@ -1415,13 +1415,13 @@ grep (int fd, struct stat const *st) +@@ -1386,7 +1386,8 @@ grep (int fd, struct stat const *st) + has_nulls = true; + if (binary_files == WITHOUT_MATCH_BINARY_FILES) + return 0; +- done_on_match = out_quiet = true; ++ if (!count_matches) ++ done_on_match = out_quiet = true; + nul_zapper = eol; + skip_nuls = skip_empty_lines; } - - /* Detect whether leading context is adjacent to previous output. */ -- if (lastout) -- { -- if (textbin == TEXTBIN_UNKNOWN) -- textbin = TEXTBIN_TEXT; -- if (beg != lastout) -- lastout = 0; -- } -+ if (beg != lastout) -+ lastout = 0; +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 2ade5be..2079ae5 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -106,6 +106,7 @@ TESTS = \ + pcre \ + pcre-abort \ + pcre-context \ ++ pcre-count \ + pcre-infloop \ + pcre-invalid-utf8-input \ + pcre-jitstack \ +diff --git a/tests/Makefile.in b/tests/Makefile.in +index b5bd7b5..ee516da 100644 +--- a/tests/Makefile.in ++++ b/tests/Makefile.in +@@ -1442,6 +1442,7 @@ TESTS = \ + pcre \ + pcre-abort \ + pcre-context \ ++ pcre-count \ + pcre-infloop \ + pcre-invalid-utf8-input \ + pcre-jitstack \ +@@ -2250,6 +2251,13 @@ pcre-context.log: pcre-context + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) ++pcre-count.log: pcre-count ++ @p='pcre-count'; \ ++ b='pcre-count'; \ ++ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ ++ --log-file $$b.log --trs-file $$b.trs \ ++ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ ++ "$$tst" $(AM_TESTS_FD_REDIRECT) + pcre-infloop.log: pcre-infloop + @p='pcre-infloop'; \ + b='pcre-infloop'; \ +diff --git a/tests/pcre-count b/tests/pcre-count +new file mode 100755 +index 0000000..78e1c7c +--- /dev/null ++++ b/tests/pcre-count +@@ -0,0 +1,23 @@ ++#! /bin/sh ++# grep -P / grep -Pc are inconsistent results ++# This bug affected grep versions 2.21 through 2.22. ++# ++# Copyright (C) 2015 Free Software Foundation, Inc. ++# ++# Copying and distribution of this file, with or without modification, ++# are permitted in any medium without royalty provided the copyright ++# notice and this notice are preserved. + -+ /* If the file's textbin has not been determined yet, assume -+ it's text if has found any matched line already. */ -+ if (textbin == TEXTBIN_UNKNOWN && nlines) -+ textbin = TEXTBIN_TEXT; - - /* Handle some details and read more data to scan. */ - save = residue + lim - beg; ++. "${srcdir=.}/init.sh"; path_prepend_ ../src ++require_pcre_ ++ ++fail=0 ++ ++printf 'a\n%032768d\nb\x0\n%032768d\na\n' 0 0 > in ++ ++LC_ALL=C grep -P 'a' in | wc -l > exp ++ ++LC_ALL=C grep -Pc 'a' in > out || fail=1 ++compare exp out || fail=1 ++ ++Exit $fail diff --git a/grep-2.22-better-encoding-errors-handling.patch b/grep-2.22-better-encoding-errors-handling.patch index 71d935c..623ce21 100644 --- a/grep-2.22-better-encoding-errors-handling.patch +++ b/grep-2.22-better-encoding-errors-handling.patch @@ -31,7 +31,7 @@ index e3495bb..41f4fa5 100644 If @var{type} is @samp{text}, diff --git a/src/grep.c b/src/grep.c -index 9ae6af8..eac540a 100644 +index 2748fd3..eac540a 100644 --- a/src/grep.c +++ b/src/grep.c @@ -377,7 +377,6 @@ bool match_icase; @@ -454,18 +454,22 @@ index 9ae6af8..eac540a 100644 lastnl = bufbeg; if (lastout) lastout = bufbeg; -@@ -1418,11 +1444,6 @@ grep (int fd, struct stat const *st) - if (beg != lastout) - lastout = 0; +@@ -1415,13 +1441,8 @@ grep (int fd, struct stat const *st) + } + + /* Detect whether leading context is adjacent to previous output. */ +- if (lastout) +- { +- if (textbin == TEXTBIN_UNKNOWN) +- textbin = TEXTBIN_TEXT; +- if (beg != lastout) +- lastout = 0; +- } ++ if (beg != lastout) ++ lastout = 0; -- /* If the file's textbin has not been determined yet, assume -- it's text if has found any matched line already. */ -- if (textbin == TEXTBIN_UNKNOWN && nlines) -- textbin = TEXTBIN_TEXT; -- /* Handle some details and read more data to scan. */ save = residue + lim - beg; - if (out_byte) @@ -1434,22 +1455,6 @@ grep (int fd, struct stat const *st) suppressible_error (filename, errno); goto finish_grep; diff --git a/grep.spec b/grep.spec index fd5c721..39115fa 100644 --- a/grep.spec +++ b/grep.spec @@ -3,7 +3,7 @@ Summary: Pattern matching utilities Name: grep Version: 2.22 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/grep/ Group: Applications/Text @@ -17,10 +17,15 @@ Source4: grepconf.sh Patch0: grep-2.22-man-fix-gs.patch # upstream ticket 39445 Patch1: grep-2.22-help-align.patch +# Backported from upstream, mb-non-UTF8-performance and long-pattern-perf tests +# marked as expensive and not run by default. The result is decided according +# to measured runtime, which doesn't work reliable on the builders with +# variable load. Patch2: grep-2.22-disable-performance-related-tests.patch +# backported from upstream +Patch3: grep-2.22-better-encoding-errors-handling.patch # backported from upstream, upstream bug#22028 -Patch3: grep-2.22-Pc-consistent-results.patch -Patch4: grep-2.22-better-encoding-errors-handling.patch +Patch4: grep-2.22-Pc-consistent-results.patch Requires(post): /sbin/install-info Requires(preun): /sbin/install-info @@ -40,15 +45,12 @@ GNU grep is needed by many scripts, so it shall be installed on every system. %setup -q %patch0 -p1 -b .man-fix-gs %patch1 -p1 -b .help-align -# Backported from upstream, mb-non-UTF8-performance and long-pattern-perf tests -# marked as expensive and not run by default. The result is decided according -# to measured runtime, which doesn't work reliable on the builders with -# variable load. %patch2 -p1 -b .disable-performance-related-tests -%patch3 -p1 -b .Pc-consistent-results -%patch4 -p1 -b .better-encoding-errors-handling +%patch3 -p1 -b .better-encoding-errors-handling +%patch4 -p1 -b .Pc-consistent-results chmod 755 tests/encoding-error +chmod 755 tests/pcre-count %build %global BUILD_FLAGS $RPM_OPT_FLAGS @@ -99,6 +101,11 @@ fi %{_libexecdir}/grepconf.sh %changelog +* Wed Jan 6 2016 Jaroslav Škarvada - 2.22-5 +- Used latest upstream patch for bug 1269014 to fix regression, + fixed order of patches + Resolves: rhbz#1269014 + * Tue Jan 5 2016 Jaroslav Škarvada - 2.22-4 - Improved encoding errors handling (by better-encoding-errors-handling patch) Resolves: rhbz#1219141