GNU bug report logs - #36583
26.1; emacs 26 tries loading original user's .emacs after su to root

Previous Next

Package: emacs;

Reported by: Steinar Bang <sb <at> dod.no>

Date: Wed, 10 Jul 2019 20:24:02 UTC

Severity: minor

Merged with 19477, 36604

Found in version 26.1

Full log


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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Glenn Morris <rgm <at> gnu.org>, 36583 <at> debbugs.gnu.org, Steinar Bang <sb <at> dod.no>
Subject: Re: bug#36583: 26.1;
 emacs 26 tries loading original user's .emacs after su to root
Date: Fri, 12 Jul 2019 16:34:05 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> [...hhhmmm...]  Ha!  Found it!
>
>     commit a726e0d12ccb1c49ca1f3e1fbe64addea9b7d3b4
>     Author: Jim Blandy <jimb <at> redhat.com>
>     Date:   Thu Jul 11 23:17:40 1991 +0000
>
>         Initial revision
>
>     diff --git a/lisp/startup.el b/lisp/startup.el
>     --- /dev/null
>     +++ b/lisp/startup.el
>     @@ -0,0 +160,6 @@
>     +    ;; Figure out which user's init file to load,
>     +    ;; either from the environment or from the options.
>     +    (setq init-file-user (if noninteractive nil (user-login-name)))
>     +    ;; If user has not done su, use current $HOME to find .emacs.
>     +    (and init-file-user (string= init-file-user (user-real-login-name))
>     +        (setq init-file-user ""))
>
> So yes, goes back pretty far.

Oh, wow.  :-)

There was a similar bug report for "sudo" the other week where the
conclusion was "well, just use -i" (because then $HOME would be set
correctly).  Does this mean that su and sudo behaves differently in
Emacs in this area?  Let's see...

sudo -i:

root <at> sandy:~# echo $HOME
/root

(user-real-login-name)
"root"

sudo bash:

root <at> sandy:~# echo $HOME
/home/larsi

(user-real-login-name)
"root"

[larsi <at> stories ~]$ su
Password: 
root <at> stories:/home/larsi# echo $HOME
/root

(user-real-login-name)
"root"


Uhm...

So when I su on this machine, I'm not getting /home/larsi/.emacs?

This is kinda confusing.


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 123 days ago.

Previous Next


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