Subject: Re: bin/29226: /etc/daily pipes >32bit integers from netstat to awk, which can't deal with them
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Ben Harris <bjh21@netbsd.org>
List: netbsd-bugs
Date: 02/04/2005 14:03:01
The following reply was made to PR bin/29226; it has been noted by GNATS.

From: Ben Harris <bjh21@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: Klaus Klein <kleink@mibh.de>
Subject: Re: bin/29226: /etc/daily pipes >32bit integers from netstat to awk, which can't deal with them
Date: Fri, 04 Feb 2005 14:02:40 +0000

 In article <20050204135301.5E08463B400@narn.netbsd.org> you write:
 > I wouldn't mind awk(1) using intmax_t internally; however, there is
 > a showstopper in IEEE Std 1003.1-2001 section 1.7.2:
 > 
 > 	"Integer variables and constants, including the values of
 > 	 operands and option-arguments, used by the standard
 > 	 utilities [...] shall be implemented as equivalent to
 > 	 the ISO C standard _signed long_ data type [...]"
 
 I think you're missing the fact that overflow behaviour of signed integer
 types in C is undefined, so the application can do anything it wants in case
 of overflow, including magically continuing to return arithmetically correct
 results.  XRAT explicitly mentions that this was intended:
 
 # The behavior on overflow is undefined for ISO C standard arithmetic.
 # Therefore, the standard utilities can use "bignum'' representation for
 # integers so that there is no fixed maximum unless otherwise stated in the
 # utility description. Similarly, standard utilities can use
 # infinite-precision representations for floating-point arithmetic, as long
 # as these representations exceed the ISO C standard requirements.
 
 <http://www.opengroup.org/onlinepubs/009695399/xrat/xcu_chap01.html
  #tag_02_01_07_04>
 
 > Having an alternate, conforming version in, say, /usr/posix/bin and
 > adjusting _CS_PATH accordingly might do the trick for this one (and
 > a couple of similar issues).
 
 Please, let's not turn into Solaris.  At least, not in that regard.
 
 -- 
 Ben Harris                                                   <bjh21@NetBSD.org>
 Portmaster, NetBSD/acorn26           <URL:http://www.NetBSD.org/Ports/acorn26/>