diff -Nru txt2regex-0.9/debian/changelog txt2regex-0.9/debian/changelog --- txt2regex-0.9/debian/changelog 2021-12-13 17:04:13.000000000 -0500 +++ txt2regex-0.9/debian/changelog 2022-09-01 17:05:37.000000000 -0400 @@ -1,3 +1,10 @@ +txt2regex (0.9-4ubuntu1) kinetic; urgency=medium + + * d/p/Use-quotes-around-escape_metachar-in-escCharList.patch: Fix + autopkgtest regression with bash 5.2 (LP: #1988481). + + -- Nick Rosbrook Thu, 01 Sep 2022 17:05:37 -0400 + txt2regex (0.9-4) unstable; urgency=medium * use the dh sequencer in debian/rules (closes: #999059) diff -Nru txt2regex-0.9/debian/control txt2regex-0.9/debian/control --- txt2regex-0.9/debian/control 2020-09-27 08:26:41.000000000 -0400 +++ txt2regex-0.9/debian/control 2022-09-01 16:45:16.000000000 -0400 @@ -1,7 +1,8 @@ Source: txt2regex Section: utils Priority: optional -Maintainer: Rene Engelhard +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Rene Engelhard Build-Depends: debhelper (>> 9), gettext, txt2tags, clitest Standards-Version: 3.6.1 Homepage: https://github.com/aureliojargas/txt2regex diff -Nru txt2regex-0.9/debian/patches/series txt2regex-0.9/debian/patches/series --- txt2regex-0.9/debian/patches/series 2020-09-27 07:43:42.000000000 -0400 +++ txt2regex-0.9/debian/patches/series 2022-09-01 16:43:59.000000000 -0400 @@ -2,3 +2,4 @@ clitest_and_txt2tags_from_debian.diff clitest-show-progress.diff de_DE-typo.diff +Use-quotes-around-escape_metachar-in-escCharList.patch diff -Nru txt2regex-0.9/debian/patches/Use-quotes-around-escape_metachar-in-escCharList.patch txt2regex-0.9/debian/patches/Use-quotes-around-escape_metachar-in-escCharList.patch --- txt2regex-0.9/debian/patches/Use-quotes-around-escape_metachar-in-escCharList.patch 1969-12-31 19:00:00.000000000 -0500 +++ txt2regex-0.9/debian/patches/Use-quotes-around-escape_metachar-in-escCharList.patch 2022-09-01 17:05:34.000000000 -0400 @@ -0,0 +1,63 @@ +Description: Use quotes around $escape_metachar in escCharList +Author: Nick Rosbrook +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/txt2regex/+bug/1988481 +Forwarded: https://github.com/aureliojargas/txt2regex/pull/12 +Last-Update: 2022-09-01 +--- +From f88d45156ee20c1cdb1e70cb410a4d188a384341 Mon Sep 17 00:00:00 2001 +From: Nick Rosbrook +Date: Thu, 1 Sep 2022 16:22:29 -0400 +Subject: [PATCH] Use quotes around $escape_metachar in escCharList + +The expression uin="${uin/\\/$escape_metachar$escape_metachar}" has +different output on bash 5.2 then on earlier versions. Namely, +$escape_metachar is not treated as a string literal, so the escape +characters are applied which results in half as many escape chars in the +output: + + $ bash --version | head -1 + GNU bash, version 5.2.0(1)-rc2 (x86_64-pc-linux-gnu) + $ uin='[\]'; escape_metachar='\\'; echo ${uin/\\/$escape_metachar$escape_metachar} + [\\] + + vs. + + $ bash --version | head -1 + GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) + $ uin='[\]'; escape_metachar='\\'; echo ${uin/\\/$escape_metachar$escape_metachar} + [\\\\] + +To fix this, add quotes around $escape_metachar in this substitution, +which works on bash 5.2 as well as earlier versions: + + $ bash --version | head -1 + GNU bash, version 5.2.0(1)-rc2 (x86_64-pc-linux-gnu) + $ uin='[\]'; escape_metachar='\\'; echo ${uin/\\/"$escape_metachar$escape_metachar"} + [\\\\] + + and + + $ bash --version | head -1 + GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) + $ uin='[\]'; escape_metachar='\\'; echo ${uin/\\/"$escape_metachar$escape_metachar"} + [\\\\] +--- + txt2regex.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/txt2regex.sh b/txt2regex.sh +index 70a2028..fcf2114 100755 +--- a/txt2regex.sh ++++ b/txt2regex.sh +@@ -1204,7 +1204,7 @@ escCharList() { + # shellcheck disable=SC1003 + if [ "$(getMeta "ax_${progs[$1]}" 6)" == '\' ]; then + escape_metachar=$(getMeta "ax_${progs[$1]}" 4) +- uin="${uin/\\/$escape_metachar$escape_metachar}" ++ uin="${uin/\\/"$escape_metachar$escape_metachar"}" + fi + } + +-- +2.34.1 +