getopt() argument permuting considered risky

Måns Rullgård mru@kth.se
Wed Aug 4 09:31:00 GMT 2004


"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.

>    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.

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



More information about the Libc-alpha mailing list