GNU bug report logs - #19477
24.4; Init script from su terminal

Previous Next

Package: emacs;

Reported by: ibeas <at> gmx.com (Álvar Ibeas)

Date: Wed, 31 Dec 2014 16:38:02 UTC

Severity: minor

Merged with 36583, 36604

Found in version 26.1

To reply to this bug, email your comments to 19477 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#19477; Package emacs. (Wed, 31 Dec 2014 16:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ibeas <at> gmx.com (Álvar Ibeas):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 31 Dec 2014 16:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: ibeas <at> gmx.com (Álvar Ibeas)
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4; Init script from su terminal
Date: Wed, 31 Dec 2014 17:36:58 +0100
Hello,

Working under Debian, when I switch to root using `su', Emacs doesn't
load the init script located in my user's home folder, as the manual
says:

``if you run Emacs from a shell started by `su', Emacs tries to find
your own `.emacs', not that of the user you are currently pretending
to be [...] It gets your user name from the environment variables
`LOGNAME' and `USER'.''

The variables LOGNAME and USER have both the value `root'. The command
`logname' returns instead my own user name.

Is this an Emacs bug?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19477; Package emacs. (Wed, 31 Dec 2014 18:37:01 GMT) Full text and rfc822 format available.

Message #8 received at 19477 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: ibeas <at> gmx.com (Álvar Ibeas)
Cc: 19477 <at> debbugs.gnu.org
Subject: Re: bug#19477: 24.4; Init script from su terminal
Date: Wed, 31 Dec 2014 13:36:26 -0500
Álvar Ibeas wrote:

> ``if you run Emacs from a shell started by `su', Emacs tries to find
> your own `.emacs', not that of the user you are currently pretending
> to be [...] It gets your user name from the environment variables
> `LOGNAME' and `USER'.''
>
> The variables LOGNAME and USER have both the value `root'. The command
> `logname' returns instead my own user name.

Emacs is behaving as documented.

The `su' programs from coreutils (it's since been removed in favour of
the util-linux one) and util-linux (as used by eg Red Hat) do not change
LOGNAME or USER when su'ing to root.

It seems that Debian's `su' comes from the `shadow' package and does
change them.

But all the `su' programs are behaving as documented too.
It's a shame they don't agree with each other...




Reply sent to ibeas <at> gmx.com (Álvar Ibeas):
You have taken responsibility. (Wed, 31 Dec 2014 19:35:01 GMT) Full text and rfc822 format available.

Notification sent to ibeas <at> gmx.com (Álvar Ibeas):
bug acknowledged by developer. (Wed, 31 Dec 2014 19:35:02 GMT) Full text and rfc822 format available.

Message #13 received at 19477-done <at> debbugs.gnu.org (full text, mbox):

From: ibeas <at> gmx.com (Álvar Ibeas)
To: 19477-done <at> debbugs.gnu.org
Subject: 24.4; Init script from su terminal
Date: Wed, 31 Dec 2014 20:34:13 +0100
Glenn Morris <rgm <at> gnu.org> writes:

> Emacs is behaving as documented.
>
> The `su' programs from coreutils (it's since been removed in favour of
> the util-linux one) and util-linux (as used by eg Red Hat) do not change
> LOGNAME or USER when su'ing to root.
>
> It seems that Debian's `su' comes from the `shadow' package and does
> change them.

Thanks for replying. I see now that most of the environment variables
are kept with the `-p' option.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19477; Package emacs. (Fri, 02 Jan 2015 19:02:01 GMT) Full text and rfc822 format available.

Message #16 received at 19477 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 19477 <at> debbugs.gnu.org
Cc: ibeas <at> gmx.com
Subject: Re: bug#19477: 24.4; Init script from su terminal
Date: Fri, 02 Jan 2015 14:01:44 -0500
I'm not sure this should be closed.
Perhaps there is a better way for Emacs to do what it wants
(get the name under which you logged in) than consulting LOGNAME.
Eg it could do what `logname' the program does.
Although reading the info page for that, what it does (check
/var/run/utmp etc) doesn't seem that great, or portable.

I'm not sure that what Debian's su does is "correct", but I could not
find a standard for su. In any case, this seems like one of those things
that is impossible to ever get changed, because people come to rely on
it behaving the way it does.

In any case, I think the Emacs documentation could stand to be tweaked a
bit. Eg util-linux/coreutils su only leaves LOGNAME alone if you change
to root, not if you change to a non-root user.




bug No longer marked as fixed in versions 24.4. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 02 Jan 2015 19:54:01 GMT) Full text and rfc822 format available.

Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 02 Jan 2015 19:54:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 02 Jan 2015 19:54:02 GMT) Full text and rfc822 format available.

Forcibly Merged 19477 36583 36604. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Jan 2022 13:41:01 GMT) Full text and rfc822 format available.

Removed tag(s) notabug. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 11 Feb 2025 07:25:02 GMT) Full text and rfc822 format available.

This bug report was last modified 125 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.