bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su


From: Lars Ingebrigtsen
Subject: 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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> [...hhhmmm...]  Ha!  Found it!
>
>     commit a726e0d12ccb1c49ca1f3e1fbe64addea9b7d3b4
>     Author: Jim Blandy <jimb@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@sandy:~# echo $HOME
/root

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

sudo bash:

root@sandy:~# echo $HOME
/home/larsi

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

[larsi@stories ~]$ su
Password: 
root@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]