Subject: Re: bin/17340: the meaning of the "-c" option to /usr/bin/su is overloaded
To: None <>
From: Greg A. Woods <>
List: netbsd-bugs
Date: 06/21/2002 14:03:32
[ On Thursday, June 20, 2002 at 16:48:50 (-0700), wrote: ]
> Subject: 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.
> 	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))

I think the mistake is to assume the "su -c command" form will work.

It's officially not supported according to the manual page synopsis.
You must supply the login name if you're supplying shell arguments, as
deomstrated in the examples section.

Bad habits can be changed, especially when relatively few people have
them, but keeping backwards compatability to this degree will be a never
ending and thankless chore -- there are many more valid shell
command-line options than just '-c'.

(and assuming 'su -c command' would imply 'su root', just because 'su'
implies 'su root', was never really correct in the first place :-)

								Greg A. Woods

+1 416 218-0098;  <>;  <>;  <>
Planix, Inc. <>; VE3TCP; Secrets of the Weird <>