NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/48017: awk(1) fails to treat var as integer (may be related to #47840)
>Number: 48017
>Category: bin
>Synopsis: awk(1) fails to treat var as integer (may be related to #47840)
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jul 05 18:55:00 +0000 2013
>Originator: Steffen
>Release: 6.99.19 (shouldn't matter)
>Organization:
>Environment:
NetBSD nhead 6.99.19 NetBSD 6.99.19 (GENERIC) #0: Sun Apr 28 17:23:09 UTC 2013
... (amd64)
>Description:
Note first that i see this also on Mac OS X Snow Leopard and FreeBSD 10. I've
not tested GNU awk yet.
I have code (the S-CText thing) that uses awk(1) to generate test data.
The problem in question happens for UnicodeData.txt, which is parsed like that:
## Input producers
io_unicode_data() {
< unicode/UnicodeData.txt ${TAWK} '
BEGIN {FS = ";" ; OFS = ";"}
# There are no comments in this, but..
/^[[:space:]]*[^#]+$/ {
i = $2
# Ranges must become unrolled, otherwise step on
if (i !~ /, First>/) {
$2 = ""
print
next
}
r1 = sprintf("%d", "0x" $1)
getline
r2 = sprintf("%d", "0x" $1)
$2 = ""
# This gets around a bug in at least "awk version 20070501" as found
# on Slow Leopard: there the range F0000-FFFFD, and only that one,
# will *not* be evaluated unless we do this (once property test came)
# XXX presumably the type system is a bit weird; check other AWKs!
sprintf("%X %X", r1, r2)
[
This exact problem also occurs for the NetBSD awk(1).
Note that there are half a dozen or so ranges, and all get expanded properly,
yet this very and only range not (the while() doesn't execute).
]
while (r1 <= r2) {
$1 = sprintf("%X", r1)
printf "%s\n", $0
++r1
}
}
'
}
>How-To-Repeat:
Well; git clone S-CText and type `make ucd' with and without `sprintf("%X %X",
r1, r2)', see the difference.
>Fix:
Home |
Main Index |
Thread Index |
Old Index