[grep]backport patch from upstream
This commit is contained in:
parent
b0266bfe84
commit
46a1b37d75
67
backport-grep-bug-backref-in-last-of-multiple-patter.patch
Normal file
67
backport-grep-bug-backref-in-last-of-multiple-patter.patch
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
From b061d24916fb9a14da37a3f2a05cb80dc65cfd38 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
Date: Mon, 5 Dec 2022 14:16:45 -0800
|
||||||
|
Subject: [PATCH] backport: grep: bug backref in last of multiple patterns
|
||||||
|
|
||||||
|
---
|
||||||
|
src/dfasearch.c | 25 ++++++++++++-------------
|
||||||
|
tests/backref | 8 ++++++++
|
||||||
|
2 files changed, 20 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dfasearch.c b/src/dfasearch.c
|
||||||
|
index d6afa8d..2d0e861 100644
|
||||||
|
--- a/src/dfasearch.c
|
||||||
|
+++ b/src/dfasearch.c
|
||||||
|
@@ -267,20 +267,19 @@ GEAcompile (char *pattern, size_t size, reg_syntax_t syntax_bits,
|
||||||
|
if (compilation_failed)
|
||||||
|
exit (EXIT_TROUBLE);
|
||||||
|
|
||||||
|
- if (prev <= patlim)
|
||||||
|
+ if (patlim < prev)
|
||||||
|
+ buflen--;
|
||||||
|
+ else if (pattern < prev)
|
||||||
|
{
|
||||||
|
- if (pattern < prev)
|
||||||
|
- {
|
||||||
|
- ptrdiff_t prevlen = patlim - prev;
|
||||||
|
- buf = xrealloc (buf, buflen + prevlen);
|
||||||
|
- memcpy (buf + buflen, prev, prevlen);
|
||||||
|
- buflen += prevlen;
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- buf = pattern;
|
||||||
|
- buflen = size;
|
||||||
|
- }
|
||||||
|
+ ptrdiff_t prevlen = patlim - prev;
|
||||||
|
+ buf = xrealloc (buf, buflen + prevlen);
|
||||||
|
+ memcpy (buf + buflen, prev, prevlen);
|
||||||
|
+ buflen += prevlen;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ buf = pattern;
|
||||||
|
+ buflen = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* In the match_words and match_lines cases, we use a different pattern
|
||||||
|
diff --git a/tests/backref b/tests/backref
|
||||||
|
index 947981b..5cc3060 100755
|
||||||
|
--- a/tests/backref
|
||||||
|
+++ b/tests/backref
|
||||||
|
@@ -43,4 +43,12 @@ if test $? -ne 2 ; then
|
||||||
|
failures=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
+# https://bugs.gnu.org/36148#13
|
||||||
|
+echo 'Total failed: 2 (1 ignored)' |
|
||||||
|
+ grep -e '^Total failed: 0$' -e '^Total failed: \([0-9]*\) (\1 ignored)$'
|
||||||
|
+if test $? -ne 1 ; then
|
||||||
|
+ echo "Backref: Multiple -e test, test #5 failed"
|
||||||
|
+ failures=1
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
Exit $failures
|
||||||
|
--
|
||||||
|
2.30.1 (Apple Git-130)
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: grep
|
Name: grep
|
||||||
Version: 3.7
|
Version: 3.7
|
||||||
Release: 4
|
Release: 5
|
||||||
Summary: A string search utility
|
Summary: A string search utility
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: http://www.gnu.org/software/grep/
|
URL: http://www.gnu.org/software/grep/
|
||||||
@ -11,6 +11,7 @@ Source3: grepconf.sh
|
|||||||
|
|
||||||
Patch1: backport-grep-avoid-sticky-problem-with-f-f.patch
|
Patch1: backport-grep-avoid-sticky-problem-with-f-f.patch
|
||||||
Patch2: backport-grep-s-does-not-suppress-binary-file-matches.patch
|
Patch2: backport-grep-s-does-not-suppress-binary-file-matches.patch
|
||||||
|
Patch3: backport-grep-bug-backref-in-last-of-multiple-patter.patch
|
||||||
|
|
||||||
BuildRequires: gcc pcre-devel >= 3.9-10 texinfo gettext libsigsegv-devel automake
|
BuildRequires: gcc pcre-devel >= 3.9-10 texinfo gettext libsigsegv-devel automake
|
||||||
Provides: /bin/egrep /bin/fgrep /bin/grep bundled(gnulib)
|
Provides: /bin/egrep /bin/fgrep /bin/grep bundled(gnulib)
|
||||||
@ -55,8 +56,12 @@ make check
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Dec 26 2022 gaoruoshu <gaoruoshu@huawei.com> - 3.7-5
|
||||||
|
- backport patch from upstream
|
||||||
|
|
||||||
* Thu May 19 2022 licihua <licihua@huawei.com> -3.7-4
|
* Thu May 19 2022 licihua <licihua@huawei.com> -3.7-4
|
||||||
- Added coloring aliases to fgrep egrep and grep
|
- Added coloring aliases to fgrep egrep and grep
|
||||||
|
|
||||||
* Fri Mar 18 2022 yangzhuangzhuang <yangzhuangzhuang1@h-partners.com> - 3.7-3
|
* Fri Mar 18 2022 yangzhuangzhuang <yangzhuangzhuang1@h-partners.com> - 3.7-3
|
||||||
- The -s option no longer suppresses "binary file matches" messages
|
- The -s option no longer suppresses "binary file matches" messages
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user