Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 27 Apr 2015 09:56:53 -0700
From: Michael Forney <>
Subject: Re: getopt_long incompatibility

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

Content of type "application/pgp-signature" skipped

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.