mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: More GNU semantics for getopt_long?
Date: Sat, 26 Jul 2014 14:34:13 -0400	[thread overview]
Message-ID: <20140726183413.GO4038@brightrain.aerifal.cx> (raw)
In-Reply-To: <20140726174730.GA11205@euler>

On Sat, Jul 26, 2014 at 07:48:30PM +0200, Felix Janda wrote:
> Rich Felker wrote:
> > On Sat, Jul 26, 2014 at 11:12:36AM +0200, Felix Janda wrote:
> > > 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
> > 
> > This has been discussed a few times and could possibly be changed.
> > Some consideration is needed for whether it leads to problematic
> > inconsistency between getopt and getopt_long, but I don't think so.
> > The worst part is that it makes it impossible to get conforming
> > behavior from GNU coreutils since there would be no way to override
> > the reordering (whereas, if they replace getopt_long with their own
> > version, it can be overridden by setting the POSIXLY_CORRECT
> > environment variable).
> 
> The BSDs seem to have this inconsistency between getopt and getopt_long
> as well. Their getopt_long also respects POSIXLY_CORRECT, though. This
> is IMO something musl should do as well when possibly introducing the
> reordering of arguments in future.

Yes, that may be reasonable. Since getopt_long is not standard anyway
there's no reason it has to avoid reading the environment. For
standard functions, they can't read the environment unless they're
specified to because doing so introduces a usage limitation (they
can't be called when the environment could be being modified); glibc's
getopt doing so is a bug, I think.

Rich


  reply	other threads:[~2014-07-26 18:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-26  9:12 Felix Janda
2014-07-26  9:31 ` Rich Felker
2014-07-26 17:48   ` Felix Janda
2014-07-26 18:34     ` Rich Felker [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140726183413.GO4038@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).