From nobody@FreeBSD.org  Mon Sep 17 07:33:27 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ABA4416A417
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 17 Sep 2007 07:33:27 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 945A713C45E
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 17 Sep 2007 07:33:27 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l8H7XRWi067277
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 17 Sep 2007 07:33:27 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.1/8.14.1/Submit) id l8H7XRmS067276;
	Mon, 17 Sep 2007 07:33:27 GMT
	(envelope-from nobody)
Message-Id: <200709170733.l8H7XRmS067276@www.freebsd.org>
Date: Mon, 17 Sep 2007 07:33:27 GMT
From: Ighighi <ighighi@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: incorrect getconf(1) handling of unsigned constants gives -1 for ULLONG_MAX
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         116413
>Category:       bin
>Synopsis:       incorrect getconf(1) handling of unsigned constants gives -1 for ULLONG_MAX
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 17 07:40:01 GMT 2007
>Closed-Date:    
>Last-Modified:  Sun Mar 09 13:09:34 UTC 2008
>Originator:     Ighighi
>Release:        6.2-STABLE
>Organization:
>Environment:
FreeBSD orion 6.2-STABLE FreeBSD 6.2-STABLE #0: Fri Sep 14 09:58:01 VET 2007     root@orion:/usr/obj/usr/src/sys/CUSTOM  i386
>Description:
The code /usr/src/usr.bin/getconf/limits.gperf doesn't correctly handle
unsigned constants.  Since it uses an intmax_t for all included variables,
any value larger than INTMAX_MAX is printed incorrectly.  So, on my machine
it prints -1 for ULLONG_MAX when it should print:

18446744073709551615 (defined in <machine/_limits.h> to be 0xffffffffffffffffULL)
if the desktop calculator isn't fooling me

>How-To-Repeat:
getconf ULLONG_MAX
>Fix:
I could submit a patch if there's a minimal guarantee that I won't lose
my time...

>Release-Note:
>Audit-Trail:

From: Garrett Wollman <wollman@hergotha.csail.mit.edu>
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: bin/116413: incorrect getconf(1) handling of unsigned constants
	gives -1 for ULLONG_MAX
Date: Mon, 17 Sep 2007 12:45:14 -0400 (EDT)

 In article <mit.lcs.mail.freebsd-bugs/200709170733.l8H7XRmS067276@www.freebsd.org> you write:
 
 >The code /usr/src/usr.bin/getconf/limits.gperf doesn't correctly handle
 >unsigned constants.
 
 It is not clear to me that the POSIX specification allows it to
 "correctly handle unsigned constants".
 
 XCU6 page 516 lines 18634ff:
 
 	Otherwise, if the specified variable is defined on the system, its
 	value shall be written in the following format:
 
 	"%d\n", <value>
 
 The description of "%d\n" in XBD6 chapter 5 ("File Format Notation")
 clearly requires it to output <value> as a signed integer.  This fits
 with the definition of the sysconf() function as returning a signed
 long.
 
 Having said that, supporting these non-sysconf() limits such as these
 is a FreeBSD extension and we need not be bound by POSIX when (and
 only when) querying non-POSIX values.
 
 -GAWollman
 
 -- 
 Garrett A. Wollman   | The real tragedy of human existence is not that we are
 wollman@csail.mit.edu| nasty by nature, but that a cruel structural asymmetry
 Opinions not those   | grants to rare events of meanness such power to shape
 of MIT or CSAIL.     | our history. - S.J. Gould, Ten Thousand Acts of Kindness
Responsible-Changed-From-To: freebsd-bugs->freebsd-standards 
Responsible-Changed-By: rwatson 
Responsible-Changed-When: Sun Mar 9 13:08:39 UTC 2008 
Responsible-Changed-Why:  
Over to the standards folks as they may want to opine on the issue Garrett 
raised with this change request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116413 
>Unformatted:
