GNU bug report logs -
#13930
Emacs doesn't cope well if it can't access/create .emacs.d
Previous Next
Reported by: Robert Prije <rprije <at> janestreet.com>
Date: Tue, 12 Mar 2013 01:47:01 UTC
Severity: normal
Merged with 16154
Fixed in version 24.4
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13930 in the body.
You can then email your comments to 13930 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Tue, 12 Mar 2013 01:47:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Robert Prije <rprije <at> janestreet.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 12 Mar 2013 01:47:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
If emacs can't reach or create .emacs.d it gets into a sort of half-loaded
state.
Here's an example of how this causes problems for me:
I often have processes spawn emacs for me using sudo.
My home directory has 700 permissions and exists on a root-squashed NFS
share. Consequently root can't reach it.
As a result, whenever I run sudo emacs on a file, it throws the error:
"Creating directory: Permission denied, /home/rprije/.emacs.d/"
in my minibuffer. It fails to load my file and I have to do C-x C-f on the
file to open it manually. If it's a temporarily created file, it often
loses the file completely and I can't regain it.
I'd have expected running with -Q or -q would help but it sadly makes no
difference.
$ emacs --version
GNU Emacs 23.2.1
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Tue, 12 Mar 2013 03:45:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 13930 <at> debbugs.gnu.org (full text, mbox):
> As a result, whenever I run sudo emacs on a file, it throws the error:
> "Creating directory: Permission denied, /home/rprije/.emacs.d/"
Can you run with --debug-init to hopefully get a backtrace showing in
which context this error is signaled?
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Tue, 12 Mar 2013 03:54:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 13930 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
It does exactly the same thing with --debug-init (says "creating directory:
permission denied...") and supplies no further information.
I think --debug-init is for debugging an init file, right? It's not getting
as far as loading the init file so it won't be able to debug it.
On Tue, Mar 12, 2013 at 11:43 AM, Stefan Monnier
<monnier <at> iro.umontreal.ca>wrote:
> > As a result, whenever I run sudo emacs on a file, it throws the error:
> > "Creating directory: Permission denied, /home/rprije/.emacs.d/"
>
> Can you run with --debug-init to hopefully get a backtrace showing in
> which context this error is signaled?
>
>
> Stefan
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Tue, 12 Mar 2013 05:13:03 GMT)
Full text and
rfc822 format available.
Message #14 received at 13930 <at> debbugs.gnu.org (full text, mbox):
> It does exactly the same thing with --debug-init (says "creating directory:
> permission denied...") and supplies no further information.
> I think --debug-init is for debugging an init file, right? It's not getting
> as far as loading the init file so it won't be able to debug it.
Can you try it with a more recent Emacs? E.g. 24.2 or 24.3?
I remember we fixed some bugs at some point that caused creation of
.emacs.d before there's a real need for it.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Tue, 12 Mar 2013 09:03:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 13930 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I built and reproduced the same problem with:
$ ./src/emacs --version
GNU Emacs 24.2.1
On Tue, Mar 12, 2013 at 1:11 PM, Stefan Monnier <monnier <at> iro.umontreal.ca>wrote:
> > It does exactly the same thing with --debug-init (says "creating
> directory:
> > permission denied...") and supplies no further information.
> > I think --debug-init is for debugging an init file, right? It's not
> getting
> > as far as loading the init file so it won't be able to debug it.
>
> Can you try it with a more recent Emacs? E.g. 24.2 or 24.3?
> I remember we fixed some bugs at some point that caused creation of
> .emacs.d before there's a real need for it.
>
>
> Stefan
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Tue, 12 Mar 2013 16:12:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 13930 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 12 Mar 2013 11:52:08 +0800
> From: Robert Prije <rprije <at> janestreet.com>
> Cc: 13930 <at> debbugs.gnu.org
>
> It does exactly the same thing with --debug-init (says "creating directory:
> permission denied...") and supplies no further information.
How about running it under GDB with a breakpoint on report_file_error
and on xsignal? If you start GDB from the src directory of the Emacs
sources, the .gdbinit file there defines a command xbacktrace which
will produce a Lisp-level backtrace in addition to the C-level
backtrace produced by the "bt" command of GDB.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Tue, 12 Mar 2013 16:31:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 13930 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii wrote:
>> It does exactly the same thing with --debug-init (says "creating directory:
>> permission denied...") and supplies no further information.
>
> How about running it under GDB with a breakpoint on report_file_error
> and on xsignal? If you start GDB from the src directory of the Emacs
> sources, the .gdbinit file there defines a command xbacktrace which
> will produce a Lisp-level backtrace in addition to the C-level
> backtrace produced by the "bt" command of GDB.
Why do we need to jump through such hoops, when locate-user-emacs-file,
which Stefan has just added all over the place, says:
Else return NEW-NAME in `user-emacs-directory', creating the
directory if it does not exist.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Tue, 12 Mar 2013 16:34:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 13930 <at> debbugs.gnu.org (full text, mbox):
On 2013-03-12 17:10 +0100, Eli Zaretskii wrote:
>> Date: Tue, 12 Mar 2013 11:52:08 +0800
>> From: Robert Prije <rprije <at> janestreet.com>
>> Cc: 13930 <at> debbugs.gnu.org
>>
>> It does exactly the same thing with --debug-init (says "creating directory:
>> permission denied...") and supplies no further information.
FWIW, this can be reproduced by creating ~/.emacs.d as a file rather
than a directory:
touch /tmp/.emacs.d
HOME=/tmp emacs --no-init-file
Than the error is "File exists: /tmp/.emacs.d/".
> How about running it under GDB with a breakpoint on report_file_error
> and on xsignal? If you start GDB from the src directory of the Emacs
> sources, the .gdbinit file there defines a command xbacktrace which
> will produce a Lisp-level backtrace in addition to the C-level
> backtrace produced by the "bt" command of GDB.
Done that and found out that locate-user-emacs-file tries to create the
directory:
,----
| (gdb) xbacktrace
| "make-directory-internal" (0xffffca98)
| "make-directory" (0xffffcc1c)
| "locate-user-emacs-file" (0xffffcd98)
| 0x82d3208 PVEC_COMPILED
| "funcall" (0xffffcf10)
| "eval" (0xffffd080)
| "custom-reevaluate-setting" (0xffffd1fc)
| "mapc" (0xffffd308)
| "command-line" (0xffffd4bc)
| "normal-top-level" (0xffffd5d0)
| (gdb)
`----
Cheers,
Sven
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Tue, 12 Mar 2013 16:50:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 13930 <at> debbugs.gnu.org (full text, mbox):
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: Robert Prije <rprije <at> janestreet.com>, 13930 <at> debbugs.gnu.org
> Date: Tue, 12 Mar 2013 12:29:23 -0400
>
> Eli Zaretskii wrote:
>
> >> It does exactly the same thing with --debug-init (says "creating directory:
> >> permission denied...") and supplies no further information.
> >
> > How about running it under GDB with a breakpoint on report_file_error
> > and on xsignal? If you start GDB from the src directory of the Emacs
> > sources, the .gdbinit file there defines a command xbacktrace which
> > will produce a Lisp-level backtrace in addition to the C-level
> > backtrace produced by the "bt" command of GDB.
>
> Why do we need to jump through such hoops, when locate-user-emacs-file,
> which Stefan has just added all over the place, says:
>
> Else return NEW-NAME in `user-emacs-directory', creating the
> directory if it does not exist.
If you mean that remembering this was all you needed to deduce that
locate-user-emacs-file is the culprit, then good for you. I never
remember such details (and this one I think I never knew about in the
first place). A debugger will show the truth even if the problem is
in some other place, so it is (IMO) a more efficient way of finding
the root cause.
IOW, more often than not I find that "jumping through hoops" is the
shortest and most reliable way to solution.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Sun, 12 May 2013 23:35:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 13930 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi, just checking what the status of this bug is?
Thanks.
On Wed, Mar 13, 2013 at 12:32 AM, Sven Joachim <svenjoac <at> gmx.de> wrote:
> On 2013-03-12 17:10 +0100, Eli Zaretskii wrote:
>
> >> Date: Tue, 12 Mar 2013 11:52:08 +0800
> >> From: Robert Prije <rprije <at> janestreet.com>
> >> Cc: 13930 <at> debbugs.gnu.org
> >>
> >> It does exactly the same thing with --debug-init (says "creating
> directory:
> >> permission denied...") and supplies no further information.
>
> FWIW, this can be reproduced by creating ~/.emacs.d as a file rather
> than a directory:
>
> touch /tmp/.emacs.d
> HOME=/tmp emacs --no-init-file
>
> Than the error is "File exists: /tmp/.emacs.d/".
>
> > How about running it under GDB with a breakpoint on report_file_error
> > and on xsignal? If you start GDB from the src directory of the Emacs
> > sources, the .gdbinit file there defines a command xbacktrace which
> > will produce a Lisp-level backtrace in addition to the C-level
> > backtrace produced by the "bt" command of GDB.
>
> Done that and found out that locate-user-emacs-file tries to create the
> directory:
>
> ,----
> | (gdb) xbacktrace
> | "make-directory-internal" (0xffffca98)
> | "make-directory" (0xffffcc1c)
> | "locate-user-emacs-file" (0xffffcd98)
> | 0x82d3208 PVEC_COMPILED
> | "funcall" (0xffffcf10)
> | "eval" (0xffffd080)
> | "custom-reevaluate-setting" (0xffffd1fc)
> | "mapc" (0xffffd308)
> | "command-line" (0xffffd4bc)
> | "normal-top-level" (0xffffd5d0)
> | (gdb)
> `----
>
> Cheers,
> Sven
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Tue, 14 May 2013 07:32:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 13930 <at> debbugs.gnu.org (full text, mbox):
Does this patch work for you?
*** lisp/subr.el 2013-04-27 21:12:17 +0000
--- lisp/subr.el 2013-05-14 07:27:31 +0000
***************
*** 2643,2648 ****
--- 2643,2655 ----
Note that this should end with a directory separator.
See also `locate-user-emacs-file'.")
+ (custom-declare-variable-early 'user-emacs-directory-warning t
+ "Non-nil means warn if cannot access `user-emacs-directory'.
+ Set this to nil at your own risk..."
+ :type 'boolean
+ :group 'initialization
+ :version "24.4")
+
(defun locate-user-emacs-file (new-name &optional old-name)
"Return an absolute per-user Emacs-specific file name.
If NEW-NAME exists in `user-emacs-directory', return it.
***************
*** 2658,2674 ****
(file-readable-p at-home))
at-home
;; Make sure `user-emacs-directory' exists,
! ;; unless we're in batch mode or dumping Emacs
(or noninteractive
purify-flag
! (file-accessible-directory-p
! (directory-file-name user-emacs-directory))
(let ((umask (default-file-modes)))
(unwind-protect
(progn
(set-default-file-modes ?\700)
! (make-directory user-emacs-directory))
(set-default-file-modes umask))))
bestname))))
;;;; Misc. useful functions.
--- 2665,2697 ----
(file-readable-p at-home))
at-home
;; Make sure `user-emacs-directory' exists,
! ;; unless we're in batch mode or dumping Emacs.
(or noninteractive
purify-flag
! (let (errtype)
! (if (file-directory-p user-emacs-directory)
! (or (file-accessible-directory-p user-emacs-directory)
! (setq errtype "access"))
(let ((umask (default-file-modes)))
(unwind-protect
(progn
(set-default-file-modes ?\700)
! (condition-case nil
! (make-directory user-emacs-directory)
! (error (setq errtype "create"))))
(set-default-file-modes umask))))
+ (when (and errtype
+ user-emacs-directory-warning
+ (not (get 'user-emacs-directory-warning 'this-session)))
+ ;; Only warn once per Emacs session.
+ (put 'user-emacs-directory-warning 'this-session t)
+ (display-warning 'initialization
+ (format "\
+ Unable to %s `user-emacs-directory' (%s).
+ Any data that would normally be written there may be lost!
+ If you never want to see this message again,
+ customize the variable `user-emacs-directory-warning'."
+ errtype user-emacs-directory)))))
bestname))))
;;;; Misc. useful functions.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13930
; Package
emacs
.
(Tue, 14 May 2013 08:47:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 13930 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
This is much better. I now get a separate window with the following error:
"Warning (initialization): Unable to create `user-emacs-directory'
(~/.emacs.d/).
Any data that would normally be written there may be lost!
If you never want to see this message again,
customize the variable `user-emacs-directory-warning'."
but the file I attempt to open still opens and I can edit it as usual. It
appears the patch works as intended. Which release is it likely to make it
to?
Thanks a bunch Glenn.
On Tue, May 14, 2013 at 3:30 PM, Glenn Morris <rgm <at> gnu.org> wrote:
>
> Does this patch work for you?
>
> *** lisp/subr.el 2013-04-27 21:12:17 +0000
> --- lisp/subr.el 2013-05-14 07:27:31 +0000
> ***************
> *** 2643,2648 ****
> --- 2643,2655 ----
> Note that this should end with a directory separator.
> See also `locate-user-emacs-file'.")
>
> + (custom-declare-variable-early 'user-emacs-directory-warning t
> + "Non-nil means warn if cannot access `user-emacs-directory'.
> + Set this to nil at your own risk..."
> + :type 'boolean
> + :group 'initialization
> + :version "24.4")
> +
> (defun locate-user-emacs-file (new-name &optional old-name)
> "Return an absolute per-user Emacs-specific file name.
> If NEW-NAME exists in `user-emacs-directory', return it.
> ***************
> *** 2658,2674 ****
> (file-readable-p at-home))
> at-home
> ;; Make sure `user-emacs-directory' exists,
> ! ;; unless we're in batch mode or dumping Emacs
> (or noninteractive
> purify-flag
> ! (file-accessible-directory-p
> ! (directory-file-name user-emacs-directory))
> (let ((umask (default-file-modes)))
> (unwind-protect
> (progn
> (set-default-file-modes ?\700)
> ! (make-directory user-emacs-directory))
> (set-default-file-modes umask))))
> bestname))))
>
> ;;;; Misc. useful functions.
> --- 2665,2697 ----
> (file-readable-p at-home))
> at-home
> ;; Make sure `user-emacs-directory' exists,
> ! ;; unless we're in batch mode or dumping Emacs.
> (or noninteractive
> purify-flag
> ! (let (errtype)
> ! (if (file-directory-p user-emacs-directory)
> ! (or (file-accessible-directory-p user-emacs-directory)
> ! (setq errtype "access"))
> (let ((umask (default-file-modes)))
> (unwind-protect
> (progn
> (set-default-file-modes ?\700)
> ! (condition-case nil
> ! (make-directory user-emacs-directory)
> ! (error (setq errtype "create"))))
> (set-default-file-modes umask))))
> + (when (and errtype
> + user-emacs-directory-warning
> + (not (get 'user-emacs-directory-warning
> 'this-session)))
> + ;; Only warn once per Emacs session.
> + (put 'user-emacs-directory-warning 'this-session t)
> + (display-warning 'initialization
> + (format "\
> + Unable to %s `user-emacs-directory' (%s).
> + Any data that would normally be written there may be lost!
> + If you never want to see this message again,
> + customize the variable `user-emacs-directory-warning'."
> + errtype user-emacs-directory)))))
> bestname))))
>
> ;;;; Misc. useful functions.
>
>
[Message part 2 (text/html, inline)]
Reply sent
to
Glenn Morris <rgm <at> gnu.org>
:
You have taken responsibility.
(Tue, 14 May 2013 16:03:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Robert Prije <rprije <at> janestreet.com>
:
bug acknowledged by developer.
(Tue, 14 May 2013 16:03:03 GMT)
Full text and
rfc822 format available.
Message #43 received at 13930-done <at> debbugs.gnu.org (full text, mbox):
Version: 24.4
Thanks for testing, applied to trunk. Barring unexpected, should be in 24.4.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 12 Jun 2013 11:24:03 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 15 Dec 2013 19:49:01 GMT)
Full text and
rfc822 format available.
Forcibly Merged 13930 16154.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 15 Dec 2013 19:49:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 14 Jan 2014 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 353 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.