1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Omit some overenthusiastic file-truename calls

Problem reported by Tino Calancha (Bug#37445).
* src/emacs.c (init_cmdargs): Call file-truename only if
needed, i.e., if invocation-directory ends in "/i386/" on
WINDOWSNT.
* src/lread.c (readevalloop): If the sourcename is not
absolute, make it absolute.  There is no need to convert
non-absolute files into truenames, since absolute files are
not converted into truenames.
(init_lread): Do not convert source-directory into a truename
at startup.  There is no need to do so in a dumped Emacs since
an absolute file name suffices.  The source directory might
not even exist any more, or might have been replaced by an
interloper who takes advantage of the truename calculation.
(syms_of_lread): Remove Qfile_truename; no longer needed.
This commit is contained in:
Paul Eggert 2019-09-18 23:53:46 -07:00
parent 6eb122c8db
commit dff4f9c759
2 changed files with 12 additions and 13 deletions

View file

@ -479,9 +479,6 @@ init_cmdargs (int argc, char **argv, int skip_args, char const *original_pwd)
if (!NILP (Vinvocation_directory)) if (!NILP (Vinvocation_directory))
{ {
if (NILP (Vpurify_flag) && !NILP (Ffboundp (Qfile_truename)))
Vinvocation_directory = call1 (Qfile_truename, Vinvocation_directory);
dir = Vinvocation_directory; dir = Vinvocation_directory;
#ifdef WINDOWSNT #ifdef WINDOWSNT
/* If we are running from the build directory, set DIR to the /* If we are running from the build directory, set DIR to the
@ -490,8 +487,15 @@ init_cmdargs (int argc, char **argv, int skip_args, char const *original_pwd)
if (SBYTES (dir) > sizeof ("/i386/") - 1 if (SBYTES (dir) > sizeof ("/i386/") - 1
&& 0 == strcmp (SSDATA (dir) + SBYTES (dir) - sizeof ("/i386/") + 1, && 0 == strcmp (SSDATA (dir) + SBYTES (dir) - sizeof ("/i386/") + 1,
"/i386/")) "/i386/"))
dir = Fexpand_file_name (build_string ("../.."), dir); {
#else /* !WINDOWSNT */ if (NILP (Vpurify_flag))
{
Lisp_Object file_truename = intern ("file-truename");
if (!NILP (Ffboundp (file_truename)))
dir = call1 (file_truename, dir);
}
dir = Fexpand_file_name (build_string ("../.."), dir);
}
#endif #endif
name = Fexpand_file_name (Vinvocation_name, dir); name = Fexpand_file_name (Vinvocation_name, dir);
while (1) while (1)

View file

@ -1999,11 +1999,10 @@ readevalloop (Lisp_Object readcharfun,
(NILP (lex_bound) || EQ (lex_bound, Qunbound) (NILP (lex_bound) || EQ (lex_bound, Qunbound)
? Qnil : list1 (Qt))); ? Qnil : list1 (Qt)));
/* Try to ensure sourcename is a truename, except whilst preloading. */ /* Ensure sourcename is absolute, except whilst preloading. */
if (!will_dump_p () if (!will_dump_p ()
&& !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename)) && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename)))
&& !NILP (Ffboundp (Qfile_truename))) sourcename = Fexpand_file_name (sourcename, Qnil);
sourcename = call1 (Qfile_truename, sourcename) ;
LOADHIST_ATTACH (sourcename); LOADHIST_ATTACH (sourcename);
@ -4678,9 +4677,6 @@ load_path_default (void)
void void
init_lread (void) init_lread (void)
{ {
if (NILP (Vpurify_flag) && !NILP (Ffboundp (Qfile_truename)))
Vsource_directory = call1 (Qfile_truename, Vsource_directory);
/* First, set Vload_path. */ /* First, set Vload_path. */
/* Ignore EMACSLOADPATH when dumping. */ /* Ignore EMACSLOADPATH when dumping. */
@ -5100,7 +5096,6 @@ this variable will become obsolete. */);
DEFSYM (Qload, "load"); DEFSYM (Qload, "load");
DEFSYM (Qload_file_name, "load-file-name"); DEFSYM (Qload_file_name, "load-file-name");
DEFSYM (Qeval_buffer_list, "eval-buffer-list"); DEFSYM (Qeval_buffer_list, "eval-buffer-list");
DEFSYM (Qfile_truename, "file-truename");
DEFSYM (Qdir_ok, "dir-ok"); DEFSYM (Qdir_ok, "dir-ok");
DEFSYM (Qdo_after_load_evaluation, "do-after-load-evaluation"); DEFSYM (Qdo_after_load_evaluation, "do-after-load-evaluation");