problem with (ubuntu/cosmic)mawk /^[[:space:]]*</

Bug #1805115 reported by dub src on 2018-11-26
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mawk (Ubuntu)
Low
Unassigned

Bug Description

#lsb_release -rd

Description: Ubuntu 18.10
Release: 18.10

## package version
#apt-cache policy mawk

mawk:
  Installed: 1.3.3-17ubuntu3
  Candidate: 1.3.3-17ubuntu3
  Version table:
 *** 1.3.3-17ubuntu3 500
        500 http://archive.ubuntu.com/ubuntu cosmic/main amd64 Packages
        100 /var/lib/dpkg/status
###

more background @
https://github.com/whiteinge/ok.sh/issues/66# problem with (ubuntu/cosmic)mawk /^[[:space:]]*</

works as expected with literal ' ' white space
-----
printf %s '<https://api.github.com/repositories/3386088/issues?page=2>; rel="next", <https://api.github.com/repositories/3386088/issues?page=33>; rel="last"' | awk '
                BEGIN { RS=", "; FS="; "; OFS=": " }
                {
                    sub(/^rel="/, "", $2); sub(/"$/, "", $2)
                    sub(/^ *</, "", $1); sub(/>$/, "", $1)
                    print "Link_" $2, $1
                }'
Link_next: https://api.github.com/repositories/3386088/issues?page=2
Link_last: https://api.github.com/repositories/3386088/issues?page=33
-----

fails using [[:space:]]
eg
-----
printf %s '<https://api.github.com/repositories/3386088/issues?page=2>; rel="next", <https://api.github.com/repositories/3386088/issues?page=33>; rel="last"' | awk '
                BEGIN { RS=", "; FS="; "; OFS=": " }
                {
                    sub(/^rel="/, "", $2); sub(/"$/, "", $2)
                    sub(/^[[:space:]]*</, "", $1); sub(/>$/, "", $1)
                    print "Link_" $2, $1
                }'
Link_next: <https://api.github.com/repositories/3386088/issues?page=2
Link_last: <https://api.github.com/repositories/3386088/issues?page=33
-----

eg : https://github.com/dubiouscript/ok.sh/commit/1a6109704653279c21d0b50c34152f674228e1cf

perhaps also relevant
https://bugs.launchpad.net/debian/+source/mawk/+bug/69724
&
https://bugs.launchpad.net/ubuntu/+source/mawk/+bug/1332114#Please update mawk to latest upstream release

0.O

Andreas Hasenack (ahasenack) wrote :

Confirmed working with gawk, failing with mawk.

Andreas Hasenack (ahasenack) wrote :

Fails from trusty onwards, all the way to disco.

use this to test:
printf %s '<https://api.github.com/repositories/3386088/issues?page=2>; rel="next", <https://api.github.com/repositories/3386088/issues?page=33>; rel="last"' | mawk '
                BEGIN { RS=", "; FS="; "; OFS=": " }
                {
                    sub(/^rel="/, "", $2); sub(/"$/, "", $2)
                    sub(/^[[:space:]]*</, "", $1); sub(/>$/, "", $1)
                    print "Link_" $2, $1
                }'

Output should have no "<" char before the http link.

Changed in mawk (Ubuntu):
status: New → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers