From owner-freebsd-bugs@FreeBSD.ORG Fri Jul 5 17:20:02 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 05B9EE97 for ; Fri, 5 Jul 2013 17:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id DCB5E1894 for ; Fri, 5 Jul 2013 17:20:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r65HK12G020090 for ; Fri, 5 Jul 2013 17:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r65HK1KM020089; Fri, 5 Jul 2013 17:20:01 GMT (envelope-from gnats) Resent-Date: Fri, 5 Jul 2013 17:20:01 GMT Resent-Message-Id: <201307051720.r65HK1KM020089@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Steffen Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 23E72CEC for ; Fri, 5 Jul 2013 17:17:43 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) by mx1.freebsd.org (Postfix) with ESMTP id 16366187F for ; Fri, 5 Jul 2013 17:17:43 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r65HHgiT020242 for ; Fri, 5 Jul 2013 17:17:42 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r65HHgLu020241; Fri, 5 Jul 2013 17:17:42 GMT (envelope-from nobody) Message-Id: <201307051717.r65HHgLu020241@oldred.freebsd.org> Date: Fri, 5 Jul 2013 17:17:42 GMT From: Steffen To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/180328: awk(1) fails to treat var as integer X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jul 2013 17:20:02 -0000 >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@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: