bin/180328: awk(1) fails to treat var as integer
Steffen
sdaoden at gmail.com
Fri Jul 5 17:20:02 UTC 2013
>Number: 180328
>Category: bin
>Synopsis: awk(1) fails to treat var as integer
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Jul 05 17:20:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Steffen
>Release: 10
>Organization:
>Environment:
FreeBSD fbsd10 10.0-CURRENT FreeBSD 10.0-CURRENT #0: Sun Jun 23 02:55:37 UTC 2013 root at snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
Note first that this problem also occurs for Mac OS X Snow Leopard and NetBSD current. I have not yet tested GNU awk.
I use awk(1) to generate test data from Unicode text files.
. i think the best is i show it:
## 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 is it; UnicodeData.txt contains multiple ranges, but only this one will be "omitted" without sprintf(), the while() will simply not execute otherwise.
]
while (r1 <= r2) {
$1 = sprintf("%X", r1)
printf "%s\n", $0
++r1
}
}
'
}
>How-To-Repeat:
well..; git clone my S-CText and run `make ucd' with and without the line `sprintf("%X %X", r1, r2)', compare the resulting `test/sa/t_props.dat' files.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list