Bug 147746 - awk: incorrect results when using $(NF)
awk: incorrect results when using $(NF)
Product: Fedora
Classification: Fedora
Component: gawk (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Karel Zak
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2005-02-10 16:56 EST by Timo Lindfors
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-02-13 13:33:32 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Timo Lindfors 2005-02-10 16:56:49 EST
Description of problem:

Awk in fedora core 3 seems to behave oddly. For example it fails to
run the tests in ./autogen.sh of cairo's cvs HEAD as of today. I am
not really familiar with awk but I hope the reduced testcase in 'steps
to reproduce' is enough to help you to fix this bug. I have seen no
other system return "0" but fedora core 3. (At least debian
stable/unstable, suse and redhat seem to return the correct result, "1").

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

GNU Awk 3.1.3
linux 2.6.10-1.760_FC3

How reproducible:


Steps to Reproduce:
1. echo -ne "2.59\n" | awk 'NR==1 { if( $(NF) >= 2.54) exit 1; exit 0;
}'; echo $?
Actual results:


Expected results:


Additional info:

The component is of course not "sed" but I don't know how to find out
what's the right component for awk. There could be a search form in
bugzilla that would accept name of binary and return component name.
Comment 1 Karel Zak 2005-02-13 13:33:32 EST
Please, check your locale setting if you work with decimal point.

Tested with gawk-3.1.4d, gawk-3.1.4 (devel), gawk-3.1.3 (FC-3, RHEL-4),
gawk-3.1.0 (RHEL-2.1):

$ export LANG=en_US 
$ echo -ne "2.59\n" | awk 'NR==1 { if( $(NF) >= 2.54) exit 1; exit 0; }'; echo $? 

$ export LANG=cs_CZ.UTF-8 
$ echo -ne "2.59\n" | awk 'NR==1 { if( $(NF) >= 2.54) exit 1; exit 0; }'; echo $?

Comment 2 Timo Lindfors 2005-02-13 13:56:51 EST
Oh, good point. Seems I need to unset some variables in my ~/.bashrc.

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