su: -l and -p should not be used together
tag 10317 wontfix
close 10317
stop
A while ago, there has been a bug report to coreutils regarding the unlucky use of the -p and the -l option (or a bare "-") with su:
http://bugs.gnu.org/10317
As su is not part of coreutils anymore, I'm hereby closing the bug there, and forward this issue to util-linux where su is now maintained.
@Karel:
do you think it's worth a warning/error?
However, the agreement was that the behaviour should at least be documented.
Have a nice day,
Berny
Karel Zak
maintainerQuoted 11 lines · Bernhard Voelker
A while ago, there has been a bug report to coreutils regarding the unlucky use of the -p and the -l option (or a bare "-") with su:
http://bugs.gnu.org/10317As su is not part of coreutils anymore, I'm hereby closing the bug there, and forward this issue to util-linux where su is now maintained.
@Karel:
do you think it's worth a warning/error?
However, the agreement was that the behaviour should at least be documented.
Thanks for the report, I have added note to the man page as well as warning to the code.
Karel
Quoted 1 line
From
3e5c0a2db233b726ca80d37aad9eeca8bae144d4Mon Sep 17 00:00:00 2001
From: Karel Zak <[email protected]>
Date: Wed, 29 May 2013 11:32:58 +0200
Subject: [PATCH] su: ignore --preserve-environment, it's mutually exclusive to
--login
Addresses: http://bugs.gnu.org/10317
--- login-utils/su-common.c | 5 +++++ login-utils/su.1 | 1 + 2 files changed, 6 insertions(+)
login-utils/su-common.c +5 -0
@@ -810,6 +810,11 @@ su_main (int argc, char **argv, int mode) ++optind; } +if (simulate_login && !change_environment) { +warnx (_ ("ignore --preserve-environment, it's mutually exclusive to --login." )); + change_environment = true; + } +switch (su_mode) {case RUNUSER_MODE :if (runuser_user) {
login-utils/su.1 +1 -0
@@ -98,6 +98,7 @@ Preserves the whole environment, ie does not set .B USER nor .BR LOGNAME . +The option is ignored if the option \fB\-\-login\fR is specified. .TP \fB\-s\fR \fISHELL\fR, \fB\-\-shell\fR=\fISHELL\fR Runs the specified shell instead of the default. The shell to run is
Signature · 6 lines
1.8.1.4 -- Karel Zak <[email protected]> http://karelzak.blogspot.com
Hi Karel,
login-utils/su-common.c su_main (int argc, char **argv, int mode) · line 817
Quoted 13 lines · Karel Zak
login-utils/su-common.c +5
-0@@ -810,6 +810,11 @@ su_main (int argc, char **argv, int mode) ++optind; } +if (simulate_login && !change_environment) { +warnx (_ ("ignore --preserve-environment, it's mutually exclusive to --login." )); + change_environment = true; + } +
thanks.
As the change was in su-common.c, this also affects runuser. I think this should then be documented in runuser.1, too, right?
Have a nice day,
Berny
Karel Zak
maintainerQuoted 2 lines · Bernhard Voelker
As the change was in
su-common.c, this also affects runuser. I think this should then be documented in runuser.1, too, right?
Good point, fixed.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com