Version in base suite: 3.6-1 Base version: grep_3.6-1 Target version: grep_3.6-1+deb11u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/g/grep/grep_3.6-1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/g/grep/grep_3.6-1+deb11u1.dsc changelog | 8 + patches/1029235-grep-bug-backref-in-last-of-multiple-patterns.patch | 73 ++++++++++ patches/series | 1 salsa-ci.yml | 3 4 files changed, 85 insertions(+) diff -Nru grep-3.6/debian/changelog grep-3.6/debian/changelog --- grep-3.6/debian/changelog 2020-11-09 20:37:02.000000000 +0000 +++ grep-3.6/debian/changelog 2023-01-25 08:23:20.000000000 +0000 @@ -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 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 00:00:00.000000000 +0000 +++ grep-3.6/debian/patches/1029235-grep-bug-backref-in-last-of-multiple-patterns.patch 2023-01-25 08:23:20.000000000 +0000 @@ -0,0 +1,73 @@ +From b061d24916fb9a14da37a3f2a05cb80dc65cfd38 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +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 +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-01-29 12:09:17.000000000 +0000 +++ grep-3.6/debian/patches/series 2023-01-25 08:23:20.000000000 +0000 @@ -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-09-28 09:23:10.000000000 +0000 +++ grep-3.6/debian/salsa-ci.yml 2023-01-25 08:23:20.000000000 +0000 @@ -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'