update to 3.11

This commit is contained in:
dillon_chen 2023-07-14 16:39:07 +08:00
parent 40b4a52cbc
commit 7c29d66a6f
4 changed files with 4 additions and 70 deletions

View File

@ -1,67 +0,0 @@
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)
- {
- idx_t prevlen = patlim - prev;
- buf = xirealloc (buf, buflen + prevlen);
- memcpy (buf + buflen, prev, prevlen);
- buflen += prevlen;
- }
- else
- {
- buf = pattern;
- buflen = size;
- }
+ idx_t prevlen = patlim - prev;
+ buf = xirealloc (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)

BIN
grep-3.11.tar.xz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
Name: grep
Version: 3.8
Version: 3.11
Release: 1
Summary: A string search utility
License: GPLv3+
@ -9,8 +9,6 @@ Source1: color_grep.sh
Source2: colorgrep.csh
Source3: grepconf.sh
Patch6000: backport-grep-bug-backref-in-last-of-multiple-patter.patch
BuildRequires: gcc pcre2-devel texinfo gettext libsigsegv-devel automake
Provides: /bin/egrep /bin/fgrep /bin/grep bundled(gnulib)
@ -55,6 +53,9 @@ make check
%changelog
* Fri Jul 14 2023 dillon chen <dillon.chen@gmail.com> - 3.11-1
- update version to 3.11
* Thu Jan 19 2023 gaoruoshu <gaoruoshu@huawei.com> - 3.8-1
- update version to 3.8