mawk 1.3.3-17ubuntu2 incorrectly handles "/" in "[ ]" expressions

Bug #490736 reported by Tom Parkin
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
mawk (Debian)
Fix Released
Unknown
mawk (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Binary package hint: mawk

Description: Ubuntu 9.04
Release: 9.04

Package version: mawk 1.3.3-13ubuntu1

Whilst attempting to run a shell script to automate the build procedure for an embedded platform I came across a parsing error in the mawk installation on my Ubuntu 9.04 box. I followed this up with the script author, and then the mawk maintainer, and determined that:

  (a). The behavior of mawk 1.3.3-13ubuntu1 is incorrect
  (b). The incorrect behavior exhibited by mawk 1.3.3-13ubuntu1 is not exhibited by the upstream sources mawk-1.3.3-20090920 when built on my Ubuntu box

The error case can be demonstrated using this script fragment:

for interpretter in gawk mawk;
do
echo "Running with $interpretter..."
echo
echo "diecimila.name=Arduino Diecimila, Duemilanove, or Nano w/ATmega168" | \
$interpretter -v FS== '{boardname=$2; gsub(/[^a-zA-Z0-9_,./():-]/, "", boardname); print boardname }'
echo
done

When run using my system's mawk installation I get the following output:

Running with gawk...

ArduinoDiecimila,Duemilanove,orNanow/ATmega168

Running with mawk...

mawk: line 1: regular expression compile failed (bad class -- [], [^] or [)
[^a-zA-Z0-9_,.
mawk: line 1: syntax error at or near )
bash: echo: write error: Broken pipe

When run using the upstream mawk I get the following output:

Running with gawk...

ArduinoDiecimila,Duemilanove,orNanow/ATmega168

Running with ./mawk...

ArduinoDiecimila,Duemilanove,orNanow/ATmega168

For reference, I built the upstream mawk package as follows:

./compile && make

That is, I used whatever defaults the autoconf script picked for my system.

Tags: wily
Revision history for this message
Gert Hulselmans (hulselmansgert) wrote :

The problem is still in mawk of Ubuntu 10.10

I found a version of mawk, maintained by a new developer:
  http://invisible-island.net/mawk/

New mawk changelog (debian patches included + new things):
  http://invisible-island.net/mawk/CHANGES

This version works as expected too:

for interpretter in gawk mawk ../mawk-1.3.4-20100625/mawk ; do
  echo "Running with $interpretter...";
  echo;
  echo "diecimila.name=Arduino Diecimila, Duemilanove, or Nano w/ATmega168" | $interpretter -v FS== '{boardname=$2; gsub(/[^a-zA-Z0-9_,./():-]/, "", boardname); print boardname }';
  echo;
done

------------------------------------------------------------
Running with gawk...

ArduinoDiecimila,Duemilanove,orNanow/ATmega168

Running with mawk...

mawk: line 1: regular expression compile failed (bad class -- [], [^] or [)
[^a-zA-Z0-9_,.
mawk: line 1: syntax error at or near )

Running with ../mawk-1.3.4-20100625/mawk...

ArduinoDiecimila,Duemilanove,orNanow/ATmega168

------------------------------------------------------------

Changed in mawk (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Jarno Suni (jarnos) wrote :

Package 1.3.3-17ubuntu2 has this bug, too. It is part of the latest release of Ubuntu.

summary: - mawk 1.3.3-13ubuntu1 incorrectly handles "/" in "[ ]" expressions
+ mawk 1.3.3-17ubuntu2 incorrectly handles "/" in "[ ]" expressions
tags: added: wily
Revision history for this message
Mantas Kriaučiūnas (mantas) wrote :

mawk in Ubuntu and Debian is 18 years, see LP bug #1332114
Many bugs of Mawk are fixed in a new upstream versions 1.3.4-2010nnnn-2015nnnn, but the Debian maintainer does not want to update for an obscure reason.
We need to push here: http://bugs.debian.org/554167

Changed in mawk (Debian):
status: Unknown → New
Changed in mawk (Debian):
status: New → Confirmed
Changed in mawk (Debian):
status: Confirmed → Fix Released
Revision history for this message
madbiologist (me-again) wrote :

This bug is finally fixed in mawk 1.3.4.20200120-2 which is available in Ubuntu 20.04 LTS "Focal Fossa" and later releases. ✔️

Changed in mawk (Ubuntu):
status: Confirmed → 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.