From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7524 Path: news.gmane.org!not-for-mail From: Michael Forney Newsgroups: gmane.linux.lib.musl.general Subject: Re: getopt_long incompatibility Date: Mon, 27 Apr 2015 09:56:53 -0700 Message-ID: <20150427165653.GB30394@mforney.org> References: <20150427062432.GA30394@mforney.org> <20150427161816.GY17573@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qlTNgmc+xy1dBmNv" X-Trace: ger.gmane.org 1430153867 31834 80.91.229.3 (27 Apr 2015 16:57:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Apr 2015 16:57:47 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7537-gllmg-musl=m.gmane.org@lists.openwall.com Mon Apr 27 18:57:47 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YmmLi-00085W-3y for gllmg-musl@m.gmane.org; Mon, 27 Apr 2015 18:57:38 +0200 Original-Received: (qmail 13486 invoked by uid 550); 27 Apr 2015 16:57:36 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 13465 invoked from network); 27 Apr 2015 16:57:35 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=c1y6JENjUT6HgQv++QbAinU0Ss8CvzkR++ECIysVAjY=; b=XG/tyQ2I04F4ekCG6f6qgftLJvzl22JjQJt6AyHXnIQkELpyQV//a9wX8lqhwMAK8w DURz2FZZP0o3ROBEuwe0QH9UAtFikfwFPJ2G6/hXZXgXbqjFRoBcRCQjP5wH3Pr085CI ZMQFb6GPTrYKK00/z11y8TWLaDlE1j6CUEPl6PIg8IfZcIhfdM4x7wiSEnkuvfW93Qot 39NPe31s0pAF8a5xP2zJvIvEDFiqebx7CkuVA0DhHIzdZ5ZnEuZ4UgWrIbR8xoJ9O+ro lOxXbgXa5jMj6lQryWGpWZn3R/X4g1N0lf1+r6oyvKUMguZGz05e1jxKRj7QtfHfrc8c HXqg== X-Gm-Message-State: ALoCoQnsLeZI8v6Pcw1az29sjSKsibkOqmfVUYG5dfZJhT9bq30PxW1X8Bx+xpqUCnjJBqq+cNS9 X-Received: by 10.68.218.9 with SMTP id pc9mr23667121pbc.2.1430153843419; Mon, 27 Apr 2015 09:57:23 -0700 (PDT) X-Google-Original-From: Michael Forney Content-Disposition: inline In-Reply-To: <20150427161816.GY17573@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:7524 Archived-At: --qlTNgmc+xy1dBmNv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 27, 2015 at 12:18:16PM -0400, Rich Felker wrote: > I read the gnulib code but I don't see why it expects a match. From > the glibc code it looks to me like the ambig_list should have length 2 > and produce an error. I don't see any reasonable way getopt_long could > choose between the two choices for the user without violating a > principle of least surprise. Do you get what's going on? >=20 > Rich glibc only adds to ambig_list if the following condition is met: if (long_only || pfound->has_arg !=3D p->has_arg || pfound->flag !=3D p->flag || pfound->val !=3D p->val) so I guess if all the matching option structs are the same, you're allowed to pick any matching option for longindex (unless you're in getopt_long_only). --qlTNgmc+xy1dBmNv Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJVPmpVAAoJEKzi1cRTxFmA2gUIAIFEQAyCu9Ee+baUFGR/wrbN /Uc+cloIh8FlEzivL2P9rSgBihb7HM57lulunJ7kIsKesFWoYOaUFoCbQZnjDxPW 6/4A6Yn8RxdCs/9EgPiogpiFYkFqdC6UBxUpyUMjo+X3Q/eDscmRzuW0BmZbfky7 sq/wTdv5YBMrAJsdGB6SL648A7WEsKpXY+O+Kayo/S8I2A53af6andvJjpYXsofw dUssOjpVzoKJYRD34KzYcxrg7y0lgK42YOnrBpLzZNCW5+uu9+Rpov0AMwZ0zFg0 XxvR8f17gdtGRFuFS1xzNI9tB1G3m4FB4BI+20blvg41BiCiTF6x/P2/dXbLhvc= =Ji1D -----END PGP SIGNATURE----- --qlTNgmc+xy1dBmNv--