Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150427170856.GB17573@brightrain.aerifal.cx>
Date: Mon, 27 Apr 2015 13:08:56 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: getopt_long incompatibility

On Mon, Apr 27, 2015 at 09:56:53AM -0700, Michael Forney wrote:
> On Mon, Apr 27, 2015 at 12:18:16PM -0400, Rich Felker wrote:
> > I read the gnulib code but I don't see why it expects a match. From
> > the glibc code it looks to me like the ambig_list should have length 2
> > and produce an error. I don't see any reasonable way getopt_long could
> > choose between the two choices for the user without violating a
> > principle of least surprise. Do you get what's going on?
> > 
> > Rich
> 
> glibc only adds to ambig_list if the following condition is met:
> 
>     if (long_only
>         || pfound->has_arg != p->has_arg
>         || pfound->flag != p->flag
>         || pfound->val != p->val)
> 
> so I guess if all the matching option structs are the same, you're
> allowed to pick any matching option for longindex (unless you're in
> getopt_long_only).

OK, I think this behavior could be allowed. Seems useless but
harmless. I'll look at what it takes to implement it.

Rich

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.