mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Felix Janda <felix.janda@posteo.de>
To: musl@lists.openwall.com
Subject: getopt_long_only and slightly unambiguous options
Date: Sun, 18 Jan 2015 18:51:59 +0100	[thread overview]
Message-ID: <20150118175159.GA4901@euler> (raw)

Hello,

since widl from wine uses the combination, get_opt_long_only seems to
be supposed to be able to differentiate between a short option "-h"
and a long option "--help". Together with the possibility of option
abbreviations, the behavior we are trying to copy is:

-h     -> -h
--help -> --help
-help  -> --help
-he    -> --help
--h    -> --help

However musl maps all of them to --help.

The man page is ambiguous about this aspect and I'm not sure if the
BSDs have the same behavior here. (However I would suspect that the
breakage in widl, when the --help option was added in 2012, would
have been noticed.) As always, it is hard to measure how many
applications (and scripts written against these applications) might
depend on this behavior. Since getopt_long_only is discouraged
maybe these are actually quite few, though.

All in all I think that this a bug in musl which should be fixed.


For the implementation, is it maybe enough in __getopt_long_core to
pass options starting with '-' and of exactly two characters
directly to getopt?

Thanks,
Felix


             reply	other threads:[~2015-01-18 17:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-18 17:51 Felix Janda [this message]
2015-01-18 18:14 ` Rich Felker
2015-01-18 18:27   ` Felix Janda
2015-01-19  6:24     ` Rich Felker

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=20150118175159.GA4901@euler \
    --to=felix.janda@posteo.de \
    --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).