Bug 100466

Summary: Bug in gawk regular expression interval processing
Product: [Retired] Red Hat Linux Reporter: Mike Kistler <mkistler>
Component: gawkAssignee: Florian La Roche <laroche>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-08-11 15:39:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike Kistler 2003-07-22 18:49:46 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
I believe there is a problem in gawk regular expression processing.
Below is a script that reproduces the problem:

#!/bin/bash
 
# This script reproduces an apparent bug in regex processing in awk.
# The problem is that interval expressions are not handled properly.
 
# This problem occurs on RedHat 8.0.  awk is packages in gawk-3.1.1-4
 
# The purpose of the awk script is to eliminate the first three space-delimited
fields from each
# input record and print the remaining contents.
 
cat > /tmp/awkbug.dat <<EOF
 token1  token2   token3   token4
 token1  token2   token3   token4  token5
 token1  token2   token3   token4  token5 token6
 token   token    token    token4
 token   token    token    token4  token5 token6
EOF
 
# This awk script fails ... apparently because of the interval.
awk --posix '{sub(/^[ ]*([^ ]+[ ]+){3}/, "", $0); print $0}' /tmp/awkbug.dat
 
# This awk script succeeds, but is equivalent to the one that fails.
awk --posix '{sub(/^[ ]*([^ ]+[ ]+)([^ ]+[ ]+)([^ ]+[ ]+)/, "", $0); print $0}'
/tmp/awkbug.dat

Note that the regex's in the two invocations are equivalent, but they produce
different results.


Version-Release number of selected component (if applicable):
gawk-3.1.1-9

How reproducible:
Always

Steps to Reproduce:
See Description.  

Actual Results:  

[mkistler@arlab112] ~>./awkbug.sh
 token1  token2   token3   token4
 token1  token2   token3   token4  token5
 token1  token2   token3   token4  token5 token6
 token   token    token    token4
 token   token    token    token4  token5 token6
token4
token4  token5
token4  token5 token6
token4
token4  token5 token6
[mkistler@arlab112]

Expected Results:  Output from both invocations should be the same.

Additional info:

Comment 1 Florian La Roche 2003-07-25 00:28:02 UTC
Seems to be fixed with 3.1.3 as currently in rawhide.

greetings,

Florian La Roche