From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5616 Path: news.gmane.org!not-for-mail From: Felix Janda Newsgroups: gmane.linux.lib.musl.general Subject: More GNU semantics for getopt_long? Date: Sat, 26 Jul 2014 11:12:36 +0200 Message-ID: <20140726091236.GA6011@euler> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1406366021 19042 80.91.229.3 (26 Jul 2014 09:13:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Jul 2014 09:13:41 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5621-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jul 26 11:13:35 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XAy2o-00027e-QV for gllmg-musl@plane.gmane.org; Sat, 26 Jul 2014 11:13:34 +0200 Original-Received: (qmail 1779 invoked by uid 550); 26 Jul 2014 09:13:25 -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 1765 invoked from network); 26 Jul 2014 09:13:25 -0000 X-Virus-Scanned: amavisd-new at posteo.de Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline User-Agent: Mutt/1.5.22 (2013-10-16) Xref: news.gmane.org gmane.linux.lib.musl.general:5616 Archived-At: I have had two problems with the fact that musl's getopt_long() does not behave as applications expect. No argument reordering: musl's getopt_long() behaves similarly to POSIX getopt() and therefore stops after the first non-option argument. This for example makes the utilities widl and wrc from wine when compiled with musl libc behave differently than for everyone else. In particular, this breaks the (git) wine build itself, since its generated Makefiles call widl with mixed option and non-option arguments. Should wine use a (runtime) config test detecting whether getopt_long() does argument reordering and use its internal copy of getopt_long() if not? Should the Makefile generation be carefully rewritten such that non-options are given last? It seems difficult to upstream any of these. The config test seems like a test specific to exclude musl and the second is likely to break in the future and who knows what scripts might depend on the argument reordering of widl. No abbreviations: musl's getopt_long() does not support abbreviation of long options. Ironically this breaks util-linux' (or busybox') getopt(1) itself. Most scripts use "getopt --long" instead of "getopt --longoptions" (likely because getopt includes an example script using "getopt --long"). I noticed this on my gentoo system when glib would fail at configure because /etc/xml/catalog was empty because the gentoo specific script build-docbook-catalog was broken because it used "getopt --long". I noticed that there is a patch from Michael Forney on the mailing list implementing the abbreviated options but there were not any comments on it. These problems make me question the usefulness of musl having getopt_long() at all in its current form. There is no way to know which programs depend on the GNU getopt_long() behavior. Furthermore, musl seems to have the only implementation behaving differently. Felix