diff --git a/grep-2.22-Pc-consistent-results.patch b/grep-2.22-Pc-consistent-results.patch new file mode 100644 index 0000000..7c5ef2f --- /dev/null +++ b/grep-2.22-Pc-consistent-results.patch @@ -0,0 +1,24 @@ +diff --git a/src/grep.c b/src/grep.c +--- a/src/grep.c ++++ b/src/grep.c +@@ -1415,13 +1415,13 @@ 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; diff --git a/grep.spec b/grep.spec index 6b59d3f..88cae3a 100644 --- a/grep.spec +++ b/grep.spec @@ -3,7 +3,7 @@ Summary: Pattern matching utilities Name: grep Version: 2.22 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/grep/ Group: Applications/Text @@ -18,6 +18,8 @@ Patch0: grep-2.22-man-fix-gs.patch # upstream ticket 39445 Patch1: grep-2.22-help-align.patch Patch2: grep-2.22-disable-performance-related-tests.patch +# backported from upstream, upstream bug#22028 +Patch3: grep-2.22-Pc-consistent-results.patch Requires(post): /sbin/install-info Requires(preun): /sbin/install-info @@ -42,6 +44,7 @@ GNU grep is needed by many scripts, so it shall be installed on every system. # 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 chmod 755 tests/kwset-abuse @@ -94,6 +97,10 @@ fi %{_libexecdir}/grepconf.sh %changelog +* Tue Dec 1 2015 Jaroslav Škarvada - 2.22-3 +- Fixed grep to be consistent in 'grep -Pc' and 'grep -P | wc -l' + Resolves: rhbz#1269014 + * Thu Nov 5 2015 Jaroslav Škarvada - 2.22-2 - Disabled performance related tests (by disable-performance-related-tests patch), patch backported from upstream