This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: getopt() argument permuting considered risky


Simon Josefsson <jas@extundo.com> writes:

> Thought I could mention a story about the getopt argument permutation:
> For my fork of GNU InetUtils I received a patch that would add "+" to
> disable the permutation, because this command:
>
> rsh sol tail -f /var/log/mail
>
> Would get permuted into:
>
> rsh -f sol tail /var/log/mail
>
> And the getopt command line parser would try to interpret the '-f',
> which would fail.

Use "rsh -- sol tail -f /var/log/mail" instead.

> On the ranting side, I think it would have been better if this feature
> had originally been introduced via a separate API, say getopt_gnu,
> instead.  That would have minimized surprises, both pleasant and
> unpleasant ones.

Then programs using that function would not compile on non-glibc
systems.  Since there is no way a program be dependent on the
permutation being done, this would break portability for no reason
whatsoever.

-- 
Måns Rullgård
mru@kth.se


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]