Subject: bug#13930: Emacs doesn't cope well if it can't access/create .emacs.d

From: Sven Joachim <[email-masked]>
Date: Tue, 12 Mar 2013 17:32:32 +0100

On 2013-03-12 17:10 +0100, Eli Zaretskii wrote:

>> Date: Tue, 12 Mar 2013 11:52:08 +0800
>> From: Robert Prije <[email-masked]>
>> Cc: [email-masked]
>> 
>> 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