[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: |
Stefan Monnier |
Subject: |
bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root |
Date: |
Thu, 11 Jul 2019 20:38:55 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
>> BTW, thinking about "dangerous" above, I guess the behavior might make
>> sense when you're `su`ing *from* root rather than the other way around.
> By default, /root on many systems isn't readable by anybody but root, so
> I don't think it makes much sense in any situation...
Good point.
> I think Emacs shouldn't do this at all. When was this introduced, and
> what was the reasoning behind it?
The Texinfo says:
[...]
@xref{Entering Emacs,,, emacs, The GNU Emacs Manual}. If neither
option is specified, Emacs uses the @env{LOGNAME} environment
variable, or the @env{USER} (most systems) or @env{USERNAME} (MS
systems) variable, to find your home directory and thus your init
file; this way, even if you have su'd, Emacs still loads your own init
file. If those environment variables are absent, though, Emacs uses
your user-id to find your home directory.
and it's at least as old as 2007 probably long before.
I still haven't found the corresponding code, so I can't confirm
the origin.
[...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.
Stefan
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Steinar Bang, 2019/07/10
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Glenn Morris, 2019/07/10
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Stefan Monnier, 2019/07/11
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Richard Stallman, 2019/07/12
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Andreas Schwab, 2019/07/13
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Stefan Kangas, 2019/07/13
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Richard Stallman, 2019/07/13
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Andreas Schwab, 2019/07/13
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Stefan Monnier, 2019/07/13
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Richard Stallman, 2019/07/13
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Stefan Monnier, 2019/07/15
- bug#36583: 26.1; emacs 26 tries loading original user's .emacs after su to root, Noam Postavsky, 2019/07/15