Subject: Re: bin/17340: the meaning of the "-c" option to /usr/bin/su is overloaded
To: David Laight <email@example.com>
From: Greg A. Woods <firstname.lastname@example.org>
Date: 06/21/2002 18:22:04
[ On Friday, June 21, 2002 at 21:11:25 (+0100), David Laight wrote: ]
> Subject: Re: bin/17340: the meaning of the "-c" option to /usr/bin/su is overloaded
> > > The command 'su -c "random command"' no longer functions,
> > > though 'su root -c "random command"' does act as before.
> If it's not a silly question, when, and of what version did this
That's a good question -- I don't know that it ever did in *BSD, at
least not after the introduction of getopt() to su.c.
> > > A likely mistake was the use of the "-c" argument to reflect
> > > changes in login class along with its traditional usage as the
> > > prefix specifier to the command to be executed..
> > (I think the cause was probably a more careful options parser in getopt(3))
> Don't think so - I've just reinstated libc.so.12.83, makes no difference.
That's good to hear!
> > I think the mistake is to assume the "su -c command" form will work.
> I can't see a version of su where it would. getopts() returning
> '?' has always made netbsd's su exit.
> OTOH a SYSV/Solaris su might behave differently.
When the '-' option was introduced (before System III), it was
implemented with a silly non-getopt() hack. It was still that way in
SysVr3.2. I don't know what happened when '-' was deprecated and '-l'
was introduced to replace it in order to bring 'su' closer to POSIX
Greg A. Woods
+1 416 218-0098; <email@example.com>; <firstname.lastname@example.org>; <email@example.com>
Planix, Inc. <firstname.lastname@example.org>; VE3TCP; Secrets of the Weird <email@example.com>