From nobody Sat Feb 11 05:33:00 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PDK4r5PnZz3pyRC; Sat, 11 Feb 2023 05:33:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PDK4r35pLz3kh1; Sat, 11 Feb 2023 05:33:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676093580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dDKeI2uUBXzbeLq1C4GpijO7U45n9Q+Mup+hgx/rXb8=; b=nycHMwRaodxhASadWl78vNrHneZ1u63+3f5O3QoaooF1tHCif6YhQ3UZoJzqxFPIGaPTFp utystkQhZWAGjxE9RDctH8bf9zaWxWQ6Lypl+SdnreWD2kZhAK7bsj/Atvnvn0qLcd6A3L SaOKKODmNm5brprcIrt+IldECW9zFAQv4+9ojaZqPQh0GmVQ/yyphSHSHUjFoLgHEMfxW6 R9ZJF0QHAZRPGlnkenkjMf/GYYh9GFO/2RDt5suDPuhRkSiowAPnndOVmRcLESZXMyARyp uMQcxcR6JYCZQZlsjs1OdSIPt1q/6y9zUpu6sCnpUADtJSf2TZYvfEl3SjStWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676093580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dDKeI2uUBXzbeLq1C4GpijO7U45n9Q+Mup+hgx/rXb8=; b=NwQsW6ysaya6aGU7KstrPMFZEp56HzsWj/iSOgep+nHw18xV9n6zqb7eWglZLExItwymMx 5rd6fH4DvT6LaK/+pC/MByPqKhKjq8VKiL7PNVA4sIQbEzEhVG3gisg07YK06qwW5DEyXk c6I1UEdrZBCnI28WKgPgodZu3KRgY5iQCtI4rxITW0uOgMl2aeccxcSO4LTcl7KpFkx/s3 duPcUZHt7+QEswoHQcqExd14ezHIrL2FXWdjRmclq81ZLMR1BWtDjv6P8Jb3Sofrr7ED5I X8ELGuEZQJFNVO1KGMXejyL1ehsp9k5NoKNZyjT7ORJ+50WFDOBbhyZ1NKU3QQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676093580; a=rsa-sha256; cv=none; b=rsTlVhb8++Z6zw7l5/El86/ltA1x2yosa3Gi3Q5/0rzmphueX4K0tIYg8v63KuI689AMe+ X9E8Z4mE9xucyRBazCmms6g1+Qka3rpK6S6NwNxlk3uU4RMwmjfm75ELeqEXLWiuPhuuqL ZeGUz0emj1jEO+9kxI6PInu/m6Ua+HNA1oeT5OV6bn84L90TuJAdhXoqVbfgN8k2vl/59M waIet3Tt3Btyu3j7DR8+RG4AtadEt9iheY7EOLJywLvpb0hkqCbtTvzQ02lt/KnhL2JK3o 0JfmirWpKg432ILIH6yDxgf9BGvy5Nj90pQ4p0wZ5JvoYRYfrYy7kFenJf+evA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PDK4r2BRnzmWf; Sat, 11 Feb 2023 05:33:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31B5X07H017633; Sat, 11 Feb 2023 05:33:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31B5X0T0017632; Sat, 11 Feb 2023 05:33:00 GMT (envelope-from git) Date: Sat, 11 Feb 2023 05:33:00 GMT Message-Id: <202302110533.31B5X0T0017632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: d646513e57c9 - main - getopt_long(3): note an inconsistency with getopt(3) in BUGS List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d646513e57c9d59a7c0cc27a4d41518110db4359 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d646513e57c9d59a7c0cc27a4d41518110db4359 commit d646513e57c9d59a7c0cc27a4d41518110db4359 Author: Kyle Evans AuthorDate: 2023-02-11 05:31:13 +0000 Commit: Kyle Evans CommitDate: 2023-02-11 05:32:50 +0000 getopt_long(3): note an inconsistency with getopt(3) in BUGS getopt_long(3) will not allow an `optind` setting of 0 to be bug-for-bug compatible with the GNU implementation, as some software does rely on it. Document it as a BUG, since it affects previous declarations of compatibility with getopt(3). Reviewed by: pauamma (markup) Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37867 --- lib/libc/stdlib/getopt_long.3 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/libc/stdlib/getopt_long.3 b/lib/libc/stdlib/getopt_long.3 index ab5da7387a45..0ac5d574c38e 100644 --- a/lib/libc/stdlib/getopt_long.3 +++ b/lib/libc/stdlib/getopt_long.3 @@ -31,7 +31,7 @@ .\" @(#)getopt.3 8.5 (Berkeley) 4/27/95 .\" $FreeBSD$ .\" -.Dd May 2, 2018 +.Dd December 24, 2022 .Dt GETOPT_LONG 3 .Os .Sh NAME @@ -546,3 +546,19 @@ is set). The implementation can completely replace .Xr getopt 3 , but right now we are using separate code. +.Pp +.Nm +makes the assumption that the first argument should always be skipped because +it's typically the program name. +As a result, setting +.Va optind +to 0 will indicate that +.Nm +should reset, and +.Va optind +will be set to 1 in the process. +This behavior differs from +.Xr getopt 3 , +which will handle an +.Va optind +value of 0 as expected and process the first element.