Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPLrYES-Dt+op27HUXOHGGsjY4FQh8tkwb7F7_NDE+HDyKiyuA@mail.gmail.com>
Date: Sun, 30 Sep 2012 23:06:55 +0200
From: Daniel Cegiełka <daniel.cegielka@...il.com>
To: musl@...ts.openwall.com
Subject: Re: better compatibility with bsd getopt()

2012/9/30 John Spencer <maillist-musl@...fooze.de>:


> an application that relies on non-posix getopt behaviour should come with a
> configure check and use an alternate impl if the getopt detected is not
> compatible.
> almost any program does so already, but for those that don't (like iptables)
> you can use https://github.com/rofl0r/gnu-getopt (tarball available on
> sabotage mirror, or in downloads section of the page).
> this bundles the netbsd getopt into a standalone library that can easily be
> linked to programs.

Without optreset support some BSD programs will not be able to
compile, like patch:

	if (!Argc)
		return;
	optreset = optind = 1;
	while ((ch = getopt_long(Argc, Argv, options, longopts, NULL)) != -1) {
		switch (ch) {
		case 'b':

http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/patch/patch.c?rev=1.50;content-type=text%2Fplain

Your example shows that the gnu-getopt is also a problem. It may be
better to keep musl clean and solve these problems outside of musl. So
a good solution for us is to use a getopt() wrapper for problematic apps,
like gnu_getopt() or bsd_getopt().

Daniel

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.