Bug 528623

Summary: awk assign syntax support
Product: [Fedora] Fedora Reporter: Yang Ren <ryang>
Component: gawkAssignee: Jan Zeleny <jzeleny>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: drepper, jlaska, kasal, llim
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: gawk-3.1.8-1.fc13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 607915 (view as bug list) Environment:
Last Closed: 2010-07-01 18:37:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 607915    

Description Yang Ren 2009-10-13 06:33:32 UTC
Description of problem:
awk should support this kind of syntax
y = $1 !~ /Get/ ~ /1/

Version-Release number of selected component (if applicable):
gawk-3.1.7-1.fc12.x86_64

How reproducible:
Always

Steps to Reproduce:

cat << "EOF" > file
0 1 2
EOF
cat << "EOF" > prog
{
  y = $1 !~ /Get/ ~ /1/
  z = $2 ~ /a/ !~ /[0-9]/
  print y
  print z
}
EOF
awk -f prog file > awk.stdout
cat awk.stdout

Actual results:
awk: prog:2:   y = $1 !~ /Get/ ~ /1/
awk: prog:2:                   ^ syntax error
awk: prog:3:   z = $2 ~ /a/ !~ /[0-9]/
awk: prog:3:                ^ syntax error

Expected results:
1
0

Additional info:

Comment 1 Bug Zapper 2009-11-16 13:35:05 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 2 Jan Zeleny 2010-05-27 15:26:30 UTC
I don't see this as an error. Operator ~ returns logical value, thus its result ($1 !~ /Get/) shouldn't be matched to regexp (or to be precise, it could be, but it makes no sense to me).

Do you have any manual reference saying this should be possible? Did you report this upstream? I didn't notice any mail in their mailing list regarding this. I certainly won't change this behavior without upstream supporting it.

Comment 5 Ulrich Drepper 2010-06-15 01:44:56 UTC
This is likely a bug.  I've contacted the upstream maintainer.  Will add comments when I get a reply.

Comment 8 Fedora Update System 2010-06-25 10:02:08 UTC
gawk-3.1.8-1.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/gawk-3.1.8-1.fc13

Comment 9 Fedora Update System 2010-06-25 18:19:42 UTC
gawk-3.1.8-1.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update gawk'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/gawk-3.1.8-1.fc13

Comment 10 James Laska 2010-06-30 14:40:11 UTC
Using the reproducer in comment#0, I confirmed that the reported problem is resolved using gawk-3.1.8-1.fc13

Comment 11 Fedora Update System 2010-07-01 18:36:49 UTC
gawk-3.1.8-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2010-11-02 15:37:28 UTC
gawk-3.1.8-3.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/gawk-3.1.8-3.fc14

Comment 13 Fedora Update System 2010-11-13 21:57:35 UTC
gawk-3.1.8-3.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.