Subject: Re: Switching from old-style getopt to new-style one
To: Chris G. Demetriou <>
From: Thomas Klausner <>
List: tech-userlevel
Date: 11/03/2000 21:15:05
Hi again!

Mutt made me believe that Chris G. Demetriou wrote:
> Thomas Klausner <> writes:
> > Is it okay if getopt reacts to an environment variable like
> > "GETOPT_SWAP_ARGS" (better names are appreciated) for the users who
> > want to have the new functionality? (If not, please argue the point --
> > I'd try to fix all in-tree programs to work with both behaviours, of
> > course.)
> If you're going to do something like this, you need to be very careful
> of security-related concerns.
> for instance, say a set-id program execs another program, with a
> certain set of arguments.  Are those arguments going to behave
> properly if, effectively, randomly reordered?

They aren't "randomly reordered", not even "effectively"; this is very
deterministic, and doesn't even change the relative order of the
non-option arguments; options without arguments get parsed in the same
order, and options with arguments get their correct arguments.  The
only programs where one can expect problems are those that don't use
the standard getopt behaviour (like find).

But I won't bother with this, you've convinced me of that.


Thomas Klausner -
I think...I think it's in my basement. Let me go upstairs and check.
 -- M.C. Escher (1898-1972)