getopt() argument permuting considered risky
Roland McGrath
roland@redhat.com
Wed Aug 4 20:11:00 GMT 2004
> The problem is that many people porting scripts from Unix systems to
> glibc-based systems are likely to be unaware of this difference in
> getopt(), and therefore unaware of the need to set POSIXLY_CORRECT to
> protect against the risk that it creates. (Until something breaks.)
Anyone do porting should be aware of what the target system's documented
way to get a standard environment is.
> In my view a much better way to handle this extension would be for
> the default behaviour to be as per the standard, and for there to
> be an environment variable such as GNU_GETOPT_PERMUTING which can be
> set to enable the extension when it is wanted.
We don't agree. We have considered all the issues you are raising, with
great deliberation and quite a long time ago, and decided differently than
you have. Sorry. If you want to put together a system that behaves this
way, it is pretty easy to put POSIXLY_CORRECT=1 in /etc/profile and the like.
More information about the Libc-alpha
mailing list