Subject: Re: su(1) not working?
To: Arto Huusko <firstname.lastname@example.org>
From: David Laight <email@example.com>
Date: 06/19/2002 18:38:09
On Wed, Jun 19, 2002 at 07:45:25PM +0300, Arto Huusko wrote:
> Jeremy C. Reed wrote:
> > On Tue, 18 Jun 2002, Richard Grace wrote:
> >>This seems to be a change in the last week or two (sorry I can't be
> >>more specific) which affects the '-' option in su(1)
> >>I looked at the CVS repository, but there doesn't seem to be any
> >>change to the su(1) code which would affect this.
> > Same here. I wonder why I don't see this via CVS web?
> IIRc, there were some changes to getopt(3). Hmm, indeed:
> According to POSIX, "-" (the string) is an exception and should not
> be parsed as option. Restore behaviour broken by previous commit.
> Mirrors second part of patch from lib/17248.
> Fix '-' handling. POSIX only recognizes "--" as end-of-options.
> Problem noted in lib/17248 by David Laight, including a patch.
> Part of this patch was used.
There are two deltas because TPTB (the powers that be) only incorporated
half of (one of my) two patches.
It seems that su(1) requires a broken (non posix conformant) getopt(3),
however it doesn't require one that is as broken as the old code!
I'd discovered that 'ls -l-' is equivalent to 'ls -l -- -l-'
instead of being an error because ls doesn't specify '-' to getopt.
I have done another version - which makes 'su -' work ok.
(attached to bin/17274).
OTOH maybe su's command line parsing should work with a conformant
David Laight: firstname.lastname@example.org