Bug#390910: [Pkg-shadow-devel] Bug#390910: login: Packaging arguments for su doesn't work as advertised

Nicolas François nicolas.francois at centraliens.net
Tue Oct 3 17:52:11 UTC 2006


On Tue, Oct 03, 2006 at 12:44:05PM -0400, Ian Zimmerman wrote:
> 
> quoth man su:
> You can use the -- argument to separate su options from the arguments
> supplied to the shell.

The arguments are supplied *to the shell*.

thus "su -- -x" will start a shell session in debug mode.

> $ su -c vi -- /etc/fstab
> Unknown id: /etc/fstab
> $ su root -c vi -- /etc/fstab
> (... root vi session with no file loaded ...)

su executes a shell, and supplies the command to the shell's -c option.
Thus we would have to quote all the command and arguments, and we are not
smarted than the caller for quoting.
This was done in the past but is no more the case (see #276419).

> I am trying to switch to su from sudo in most cases, because I am afraid
> of the latter's complexity; but running stuff with arguments is _such_
> a pain with su!

su root -c "$@" may be a replacement, but it will fail sometimes.

Do you agree in closing this bug?

Kind Regards,
-- 
Nekral




More information about the Pkg-shadow-devel mailing list