Package: release.debian.org Severity: normal Tags: bullseye User: release.debian.org@packages.debian.org Usertags: pu X-Debbugs-Cc: grep@packages.debian.org, 1029235@bugs.debian.org Control: affects -1 + src:grep [ Reason ] 3.6-1 is affected by https://bugs.debian.org/1029235#19 [ Impact ] Not fixing this means continue to have a POSIX-non-compliant behaviour. [ Tests ] I made similar tests as for https://bugs.debian.org/1029595: This is a build job including only the upstream test: https://salsa.debian.org/santiago/grep/-/jobs/3848015#L3199 And this is the pipeline of a fixed grep in stable: https://salsa.debian.org/santiago/grep/-/pipelines/490293 reprotest fails, but that's independent of the fix. It also fails for 3.6-1: https://salsa.debian.org/debian/grep/-/pipelines/490296 [ 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 stable [x] the issue is verified as fixed in unstable [ Changes ] There are mainly two changes: + * Fix sometimes mistakenly matches lines when last of multiple patterns + includes backref (Closes: #1029235) + * debian/salsa-ci.yml set RELEASE: bullseye The latter is the simplest change, to make salsa-ci's pipeline build grep on bullseye: diff -Nru grep-3.6/debian/salsa-ci.yml grep-3.6/debian/salsa-ci.yml --- grep-3.6/debian/salsa-ci.yml 2020-11-09 21:37:02.000000000 +0100 +++ grep-3.6/debian/salsa-ci.yml 2023-01-25 09:23:20.000000000 +0100 @@ -1,3 +1,6 @@ include: - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml + +variables: + RELEASE: 'bullseye' The other change is the actual fix, that fixes the comparison between multiple patterns when there are back-references-free patterns. [ Other info ] Null.
diff -Nru grep-3.6/debian/changelog grep-3.6/debian/changelog
--- grep-3.6/debian/changelog 2020-11-09 21:37:02.000000000 +0100
+++ grep-3.6/debian/changelog 2023-01-25 09:23:20.000000000 +0100
@@ -1,3 +1,11 @@
+grep (3.6-1+deb11u1) bullseye; urgency=medium
+
+ * Fix sometimes mistakenly matches lines when last of multiple patterns
+ includes backref (Closes: #1029235)
+ * debian/salsa-ci.yml set RELEASE: bullseye
+
+ -- Santiago Ruano Rincón <santiago@debian.org> Wed, 25 Jan 2023 09:23:20 +0100
+
grep (3.6-1) unstable; urgency=low
[ Debian Janitor ]
diff -Nru grep-3.6/debian/patches/1029235-grep-bug-backref-in-last-of-multiple-patterns.patch grep-3.6/debian/patches/1029235-grep-bug-backref-in-last-of-multiple-patterns.patch
--- grep-3.6/debian/patches/1029235-grep-bug-backref-in-last-of-multiple-patterns.patch 1970-01-01 01:00:00.000000000 +0100
+++ grep-3.6/debian/patches/1029235-grep-bug-backref-in-last-of-multiple-patterns.patch 2023-01-25 09:23:20.000000000 +0100
@@ -0,0 +1,73 @@
+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
+Author: Santiago Ruano Rincón <santiago@debian.org>
+Last-Update: 2023-01-24
+
+* 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
+@@ -267,20 +267,19 @@ GEAcompile (char *pattern, size_t size,
+ 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
+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.6/debian/patches/series grep-3.6/debian/patches/series
--- grep-3.6/debian/patches/series 2020-11-09 21:37:02.000000000 +0100
+++ grep-3.6/debian/patches/series 2023-01-25 09:23:20.000000000 +0100
@@ -1,2 +1,3 @@
02-man_rgrep.patch
05-grep-wrapper-sh.patch
+1029235-grep-bug-backref-in-last-of-multiple-patterns.patch
diff -Nru grep-3.6/debian/salsa-ci.yml grep-3.6/debian/salsa-ci.yml
--- grep-3.6/debian/salsa-ci.yml 2020-11-09 21:37:02.000000000 +0100
+++ grep-3.6/debian/salsa-ci.yml 2023-01-25 09:23:20.000000000 +0100
@@ -1,3 +1,6 @@
include:
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
+
+variables:
+ RELEASE: 'bullseye'
Attachment:
signature.asc
Description: PGP signature