txt2regex autopkgtest regression with bash 5.2

Bug #1988481 reported by Nick Rosbrook
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
txt2regex (Ubuntu)
Fix Released
Undecided
Nick Rosbrook

Bug Description

Here is a link to a failed autopkgtest log: https://autopkgtest.ubuntu.com/results/autopkgtest-kinetic/kinetic/amd64/t/txt2regex/20220827_144122_eb850@/log.gz. The relevant snippet is this:

[FAILED #53, line 77] txt2regex --all --history '241¤\'
@@ -1,23 +1,23 @@
- Regex awk : [\\]
- Regex chicken : [\\\\]
+ Regex awk : [\]
+ Regex chicken : [\\]
  Regex ed : [\]
  Regex egrep : [\]
- Regex emacs : [\\\\]
- Regex expect : [\\]
+ Regex emacs : [\\]
+ Regex expect : [\]
  Regex find : [\]
- Regex gawk : [\\]
+ Regex gawk : [\]
  Regex grep : [\]
- Regex javascript: [\\]
- Regex lex : [\\]
- Regex mawk : [\\]
- Regex mysql : [\\\\]
- Regex perl : [\\]
- Regex php : [\\\\]
- Regex postgres : [\\]
+ Regex javascript: [\]
+ Regex lex : [\]
+ Regex mawk : [\]
+ Regex mysql : [\\]
+ Regex perl : [\]
+ Regex php : [\\]
+ Regex postgres : [\]
  Regex procmail : [\]
- Regex python : [\\]
+ Regex python : [\]
  Regex sed : [\]
- Regex tcl : [\\]
+ Regex tcl : [\]
  Regex vi : [\]
- Regex vim : [\\]
+ Regex vim : [\]

The issue comes down to how the following expression -- which is simulating a section of txt2regex.sh -- is evaluated in bash 5.2 vs prior versions:

$ uin='[\]'; escape_metachar='\\'; echo ${uin/\\/$escape_metachar$escape_metachar}

Namely, we have:

  $ 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}
  [\\\\]

Nick Rosbrook (enr0n)
Changed in txt2regex (Ubuntu):
status: New → In Progress
assignee: nobody → Nick Rosbrook (enr0n)
tags: added: update-excuse
Revision history for this message
Nick Rosbrook (enr0n) wrote :
Revision history for this message
Graham Inggs (ginggs) wrote :

Your upstream PR was picked up by txt2regex's Debian maintainer, and someone else already sync'd it.

Changed in txt2regex (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.