Bug 100466 - Bug in gawk regular expression interval processing
Bug in gawk regular expression interval processing
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gawk (Show other bugs)
9
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Florian La Roche
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-07-22 14:49 EDT by Mike Kistler
Modified: 2007-04-18 12:55 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-08-11 11:39:09 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mike Kistler 2003-07-22 14:49:46 EDT
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-24 20:28:02 EDT
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.