Package: release.debian.org Severity: normal User: release.debian.org@packages.debian.org Usertags: unblock X-Debbugs-Cc: grep@packages.debian.org, 1029235@bugs.debian.org Control: affects -1 + src:grep Please unblock package grep [ Reason ] To fix RC bug https://bugs.debian.org/1029235#19 in unstable. The patch is in the grep upstream development branch and will be part of next release. [ Impact ] Not fixing this means continue to have a POSIX-non-compliant behaviour. [ Tests ] An upstream testcase is included in the patch. I've created a branch applying the test only (without the fix) https://salsa.debian.org/santiago/grep/-/commit/09c3b715e3fa1b21f9ec531781c8c0091db96f23 that fails: https://salsa.debian.org/santiago/grep/-/jobs/3824648#L3368 This is the pipeline with the fixed branch (uploaded to experimental): https://salsa.debian.org/santiago/grep/-/pipelines/487847 and this for the proposed release: https://salsa.debian.org/debian/grep/-/pipelines/489911 [ Risks ] grep is a key package. But the risks of introducing this release are low, according to the tests. [ Checklist ] [x] all changes are documented in the d/changelog [x] I reviewed all changes and I approve them [x] attach debdiff against the package in testing [ Other info ] Not sure about the version to use in the unblock tag/command below. unblock grep/3.8-4
diff -Nru grep-3.8/debian/changelog grep-3.8/debian/changelog
--- grep-3.8/debian/changelog 2022-10-25 21:24:11.000000000 +0200
+++ grep-3.8/debian/changelog 2023-01-24 15:43:00.000000000 +0100
@@ -1,3 +1,16 @@
+grep (3.8-5) unstable; urgency=medium
+
+ * Upload to unstable
+
+ -- Santiago Ruano Rincón <santiago@debian.org> Tue, 24 Jan 2023 15:43:00 +0100
+
+grep (3.8-4) experimental; urgency=medium
+
+ * Fix sometimes mistakenly matches lines when last of multiple patterns
+ includes backref (Closes: #1029235)
+
+ -- Santiago Ruano Rincón <santiago@debian.org> Fri, 20 Jan 2023 17:25:51 +0100
+
grep (3.8-3) unstable; urgency=low
* Temporarily add 1019724-handle-backslash-warning.patch to disable the
diff -Nru grep-3.8/debian/patches/1029235-grep-bug-backref-in-last-of-multiple-patterns.patch grep-3.8/debian/patches/1029235-grep-bug-backref-in-last-of-multiple-patterns.patch
--- grep-3.8/debian/patches/1029235-grep-bug-backref-in-last-of-multiple-patterns.patch 1970-01-01 01:00:00.000000000 +0100
+++ grep-3.8/debian/patches/1029235-grep-bug-backref-in-last-of-multiple-patterns.patch 2023-01-24 15:43:00.000000000 +0100
@@ -0,0 +1,71 @@
+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] grep: bug: backref in last of multiple patterns
+Bug-Debian: https://bugs.debian.org/1029235
+
+* NEWS: Mention this.
+* src/dfasearch.c (GEAcompile): Trim trailing newline from
+the last pattern, even if it has back-references and follows
+a pattern that lacks back-references.
+* tests/backref: Add test for this bug.
+---
+ NEWS | 6 ++++++
+ src/dfasearch.c | 25 ++++++++++++-------------
+ tests/backref | 8 ++++++++
+ 3 files changed, 26 insertions(+), 13 deletions(-)
+
+Index: grep/src/dfasearch.c
+===================================================================
+--- grep.orig/src/dfasearch.c
++++ grep/src/dfasearch.c
+@@ -281,20 +281,19 @@ GEAcompile (char *pattern, idx_t size, r
+ 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
+Index: grep/tests/backref
+===================================================================
+--- grep.orig/tests/backref
++++ grep/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
diff -Nru grep-3.8/debian/patches/series grep-3.8/debian/patches/series
--- grep-3.8/debian/patches/series 2022-10-25 21:23:21.000000000 +0200
+++ grep-3.8/debian/patches/series 2023-01-24 15:43:00.000000000 +0100
@@ -4,3 +4,4 @@
05-grep-wrapper-sh.patch
upstream-0001-doc-improve-GREP_COLORS-doc-Bug-57696.patch
1019724-handle-backslash-warning.patch
+1029235-grep-bug-backref-in-last-of-multiple-patterns.patch
Attachment:
signature.asc
Description: PGP signature