From owner-freebsd-bugs  Tue Nov 20  1:20: 6 2001
Delivered-To: freebsd-bugs@hub.freebsd.org
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 6B7F237B419
	for <freebsd-bugs@hub.freebsd.org>; Tue, 20 Nov 2001 01:20:01 -0800 (PST)
Received: (from gnats@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id fAK9K1522868;
	Tue, 20 Nov 2001 01:20:01 -0800 (PST)
	(envelope-from gnats)
Received: from vestein.arb-phys.uni-dortmund.de (vestein.arb-phys.uni-dortmund.de [192.109.44.6])
	by hub.freebsd.org (Postfix) with ESMTP id 9823F37B417
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 20 Nov 2001 01:12:08 -0800 (PST)
Received: from yorikke.arb-phys.uni-dortmund.de (yorikke [192.109.44.12])
	by vestein.arb-phys.uni-dortmund.de (8.11.1/8.11.1) with ESMTP id fAK9C1d12264
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 20 Nov 2001 10:12:05 +0100 (MET)
	(envelope-from wb@vestein.arb-phys.uni-dortmund.de)
Received: (from wb@localhost)
	by yorikke.arb-phys.uni-dortmund.de (8.11.6/8.9.3) id fAK9CtJ03633;
	Tue, 20 Nov 2001 10:12:55 +0100 (MET)
	(envelope-from wb)
Message-Id: <200111200912.fAK9CtJ03633@yorikke.arb-phys.uni-dortmund.de>
Date: Tue, 20 Nov 2001 10:12:55 +0100 (MET)
From: "Wilhelm B. Kloke" <wb@vestein.arb-phys.uni-dortmund.de>
Reply-To: "Wilhelm B. Kloke" <wb@vestein.arb-phys.uni-dortmund.de>
To: FreeBSD-gnats-submit@freebsd.org
X-Send-Pr-Version: 3.113
Subject: bin/32126: getopt(3) not Unix-98 conformant
Sender: owner-freebsd-bugs@FreeBSD.ORG
Precedence: bulk
List-ID: <freebsd-bugs.FreeBSD.ORG>
List-Archive: <http://docs.freebsd.org/mail/> (Web Archive)
List-Help: <mailto:majordomo@FreeBSD.ORG?subject=help> (List Instructions)
List-Subscribe: <mailto:majordomo@FreeBSD.ORG?subject=subscribe%20freebsd-bugs>
List-Unsubscribe: <mailto:majordomo@FreeBSD.ORG?subject=unsubscribe%20freebsd-bugs>
X-Loop: FreeBSD.org


>Number:         32126
>Category:       bin
>Synopsis:       getopt(3) not Unix-98 conformant
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 20 01:20:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Wilhelm B. Kloke
>Release:        FreeBSD 4.4-RELEASE i386
>Organization:
>Environment:
System: FreeBSD yorikke 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Tue Oct 16 13:37:09 MET DST 2001 wb@yorikke:/usr/obj/usr/src-4.4/sys/YORIKKE i386

>Description:
	I have been hit by a non-conformance to Unix standard (whatever this
	may mean). FreeBSD uses a global optreset to re-initialize
	some internal data structure for getopt. This is not conformant to
	Unix 98 spec (see opengroup.org man page) nor to Linux usage.
>How-To-Repeat:
	
>Fix:
	I propose to silently dropping use of optreset, as the reset
	condition can normally be signaled via optind. No applications
	should be affected, anyway. Grep -F -R optreset shows that
	contrib/nvi crypto/heimdal/lib/roken crypto/kerberosIV/lib
	are coming with their own getopt.c. Other apps using optreset
	are bin/chio bin/sh sbin/camcontrol sbin/ipfw sbin/mount
	sys/boot/ usr.sbin/ancontrol usr.sbin/inetd usr.sbin/mlxcontrol
	usr.sbin/mptable usr.sbin/raycontrol usr.sbin/wicontrol
	
	Camcontrol may have a problem. There is a discussion in  the comments.
	Just let camcontrol have its own getopt.c.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message