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

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

bug#41242: Port feature/native-comp to Windows


From: Nicolas Bértolo
Subject: bug#41242: Port feature/native-comp to Windows
Date: Wed, 20 May 2020 12:46:32 -0300

> Can you explain what problem this solves, and how?  It is especially
> important to understand when will be emacs_root_dir first called
> during a session.  That's because it calls filename_from_ansi, which
> AFAIR needs some setup that happens at the beginning of a session.

When loading a dump file that contains native compiled elisp we try to find the
.eln file. This uses Ffile_exists_p(). This function, in turn, calls
Fexpand_file_name(). This function will use the root directory as
`default_directory' as a fallback.

Getting the root directory requires reading the $emacs_dir environment variable.
This is setup later in the initialization process. This caused a crash.

Fexpand_file_name() was trying to obtain the root directory even when it was not
necessary because `default-directory' was not nil. My patch makes sure that this
only happens when necessary.

It turns out that the dump loading process does not set `default-directory' to
nil, therefore Fexpand_file_name() does not need to find out the root directory
and we avoid reading an environment variable that is not set yet.

With this patch we avoid calling filename_from_ansi() too early (It is not the
reason why Emacs crashed, but it is still a good idea to call it after it has
been setup properly.

Nico

reply via email to

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