This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: getopt() argument permuting considered risky
- From: "Michael T Kerrisk" <mtk-lists at gmx dot net>
- To: "Michael T Kerrisk" <mtk-lists at gmx dot net>
- Cc: mru at kth dot se,libc-alpha at sources dot redhat dot com
- Date: Wed, 4 Aug 2004 12:05:52 +0200 (MEST)
- Subject: Re: getopt() argument permuting considered risky
- References: <19941.1091612892@www49.gmx.net>
> > "Michael T Kerrisk" <mtk-lists@gmx.net> writes:
> >
> >
> > [why argument permutation is bad]
> >
> > > Some suggestions:
> > >
> > > 1. What are the chances of having this feature removed
> > > from glibc's getopt()?
> > >
> > > I realise that the argument is probably: "it will
> > > break existing applications". Some responses:
> > >
> > > a) Is that really true: are there really applications
> > > that depend on this non-standard behaviour?
> >
> > The only difference I see would be that the user would be required to
> > pass option arguments before non-option arguments.
>
> Yes, but I'm not sure what point you are making?
>
> > > b) The existing behaviour is a security risk, as
> > > described above.
> > >
> > > 2. Perhaps Linux distributors should be setting
> > > POSIXLY_CORRECT in their default shell start-up
> > > files?
> >
> > Doing so would also alter lots of useful behavior from various GNU
> > tools.
>
> This is what I'm not sure of. Do you know of specific examples?
>
> (Oops, maybe you're meaning behaviours not related to getopt().
> In that case I see your point, and, yes, it's true. On first read,
> I thought you were meaning that changing the getopt() behaviour
> would remove the "useful behaviour", but I guess you are
> making the more general point.)
Actually, this makes me think of a third suggestion:
3. Add an environment variable: GETOPT_POSIXLY_CORRECT (or
somesuch) to specifically affect the behavior of getopt().
Cheers,
Michael
--
Michael Kerrisk
mtk-lists@gmx.net
NEU: WLAN-Router für 0,- EUR* - auch für DSL-Wechsler!
GMX DSL = supergünstig & kabellos http://www.gmx.net/de/go/dsl