Red Hat Bugzilla – Bug 81820
emacs gets into loop trying to create /root/.emacs.d
Last modified: 2015-01-07 19:02:56 EST
I used "sudo -s" to get a root shell and then "su news" to get a news shell, and
then ran "emacs -nw /etc/news/incoming.conf" to edit a configuration file.
Part-way through that editing task, Emacs started beeping repeatedly and
displaying a message in the minibuffer indicating that it could not create
/root/.emacs.d. I finally had to send a kill signal to the Emacs process, at
which point it coredumped.
I'm current WRT Raw Hide, including emacs-21.2-27.
I don't have an "/etc/news/incoming" files, but I just tried editting
a new file in "/etc/news" and emacs created an autosave backup file in
"/etc/news" without any problems.
Further I should have said "/etc/news/.emacs.d/auto-save-list/"
was created in the process. Is your "/etc/news" owned by news?
The sequence of steps I used to get to where the problem exhibited itself is
significant. Using "sudo -s" followed by "su news" leaves the environment in a
state where some environment variables say that the user is root rather than
news. If you used some other mechanism to become news before editing the file
in /etc/news, the environment probably wasn't set up in such a way as to confuse
How did you become "news" before attempting to edit the file in /etc/news?
Whether or not my /etc/news is owned by news is irrelevant, since as I said, the
infinite loop was while Emacs was trying to create a directory in /root, not in
% sudo -s
% su news
% emacs /etc/news/test.file
My default shell is zsh, if that matters?
Aha. I forgot a crucial fact. I used "su -m", not "su", which means that
root's environment was preserved, including the HOME environment variable, which
is probably the culprit. Try that.
(Please don't say this is the fault of using "su -m"; Emacs needs to be able to
cope with an unwritable HOME without going into an infinite loop. :-)
Yep, reproduced from a bash login shell. (Fwiw this problem doesn't
to occur if one starts from zsh AFAICT.)
With "sudo -s" the error seems to be in the original user's homedir;
with "su" the error is in /root.
Any better with 21.3? I can't seem to reproduce it any more.
I can no longer duplicate the problem with emacs-21.3-7.