mailing list of musl libc
 help / color / mirror / code / Atom feed
* More GNU semantics for getopt_long?
@ 2014-07-26  9:12 Felix Janda
  2014-07-26  9:31 ` Rich Felker
  0 siblings, 1 reply; 10+ messages in thread
From: Felix Janda @ 2014-07-26  9:12 UTC (permalink / raw)
  To: musl

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-11-21 18:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-26  9:12 More GNU semantics for getopt_long? Felix Janda
2014-07-26  9:31 ` Rich Felker
2014-07-26 17:48   ` Felix Janda
2014-07-26 18:34     ` Rich Felker
2014-07-27 18:35     ` Rich Felker
2014-07-27 22:30       ` Felix Janda
2014-11-19 17:42         ` Rich Felker
2014-11-19 18:44           ` Felix Janda
2014-11-19 22:50             ` Rich Felker
2014-11-21 18:49               ` Felix Janda

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).