On Thu, May 23, 2013 at 12:57:05PM +0200, Bernhard Voelker wrote: > 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. Thanks for the report, I have added note to the man page as well as warning to the code. Karel >From 3e5c0a2db233b726ca80d37aad9eeca8bae144d4 Mon Sep 17 00:00:00 2001 From: Karel Zak <kzak@xxxxxxxxxx> 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 Reported-by: Bernhard Voelker <mail@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Karel Zak <kzak@xxxxxxxxxx> --- login-utils/su-common.c | 5 +++++ login-utils/su.1 | 1 + 2 files changed, 6 insertions(+) diff --git a/login-utils/su-common.c b/login-utils/su-common.c index ba2a616..a41d015 100644 --- a/login-utils/su-common.c +++ b/login-utils/su-common.c @@ -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) { diff --git a/login-utils/su.1 b/login-utils/su.1 index c82b941..eab1a6f 100644 --- a/login-utils/su.1 +++ b/login-utils/su.1 @@ -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 -- 1.8.1.4 -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html