NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/47840: awk string comparison of integer constant
>Number: 47840
>Category: bin
>Synopsis: awk string comparison of integer constant
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon May 20 05:30:01 +0000 2013
>Originator: David A. Holland
>Release: NetBSD 6.99.17 (20130321)
>Organization:
>Environment:
System: NetBSD macaran 6.99.17 NetBSD 6.99.17 (MACARAN) #18: Thu Mar 21
13:12:01 EDT 2013 root@macaran:/usr/src/sys/arch/amd64/compile/MACARAN amd64
Architecture: x86_64
Machine: amd64
>Description:
Observe the following curious behavior:
macaran% jot 15 1 | awk '{ a[$1] = ($1 < 10); } END { for (k in a) { print k,
a[k], (k < 10); }}'
2 1 0
3 1 0
4 1 0
5 1 0
6 1 0
7 1 0
8 1 0
9 1 0
10 0 0
11 0 0
12 0 0
13 0 0
14 0 0
15 0 0
1 1 1
Note that k < 10 is evaluated as a string comparison.
Is this required by some standard? gawk does the same thing, but it
definitely violates the POLA.
>How-To-Repeat:
as above
>Fix:
dunno
Home |
Main Index |
Thread Index |
Old Index