Bug 100466 - Bug in gawk regular expression interval processing
Summary: Bug in gawk regular expression interval processing
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gawk
Version: 9
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Florian La Roche
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-07-22 18:49 UTC by Mike Kistler
Modified: 2007-04-18 16:55 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-08-11 15:39:09 UTC
Embargoed:


Attachments (Terms of Use)

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



Note You need to log in before you can comment on or make changes to this bug.