diff options
| author | Paul Eggert | 2019-09-18 23:53:46 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-09-18 23:54:15 -0700 |
| commit | dff4f9c759f5cf19047719716ea5ee8ffdc3006e (patch) | |
| tree | 6f139a6efa38b31b75ef987c2322c446488b5cd0 | |
| parent | 6eb122c8db9d6a445b2002f025e01215ab560843 (diff) | |
| download | emacs-dff4f9c759f5cf19047719716ea5ee8ffdc3006e.tar.gz emacs-dff4f9c759f5cf19047719716ea5ee8ffdc3006e.zip | |
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.
| -rw-r--r-- | src/emacs.c | 14 | ||||
| -rw-r--r-- | src/lread.c | 11 |
2 files changed, 12 insertions, 13 deletions
diff --git a/src/emacs.c b/src/emacs.c index eb732810db4..8a8d8b558e4 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -479,9 +479,6 @@ init_cmdargs (int argc, char **argv, int skip_args, char const *original_pwd) | |||
| 479 | 479 | ||
| 480 | if (!NILP (Vinvocation_directory)) | 480 | if (!NILP (Vinvocation_directory)) |
| 481 | { | 481 | { |
| 482 | if (NILP (Vpurify_flag) && !NILP (Ffboundp (Qfile_truename))) | ||
| 483 | Vinvocation_directory = call1 (Qfile_truename, Vinvocation_directory); | ||
| 484 | |||
| 485 | dir = Vinvocation_directory; | 482 | dir = Vinvocation_directory; |
| 486 | #ifdef WINDOWSNT | 483 | #ifdef WINDOWSNT |
| 487 | /* If we are running from the build directory, set DIR to the | 484 | /* 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) | |||
| 490 | if (SBYTES (dir) > sizeof ("/i386/") - 1 | 487 | if (SBYTES (dir) > sizeof ("/i386/") - 1 |
| 491 | && 0 == strcmp (SSDATA (dir) + SBYTES (dir) - sizeof ("/i386/") + 1, | 488 | && 0 == strcmp (SSDATA (dir) + SBYTES (dir) - sizeof ("/i386/") + 1, |
| 492 | "/i386/")) | 489 | "/i386/")) |
| 493 | dir = Fexpand_file_name (build_string ("../.."), dir); | 490 | { |
| 494 | #else /* !WINDOWSNT */ | 491 | if (NILP (Vpurify_flag)) |
| 492 | { | ||
| 493 | Lisp_Object file_truename = intern ("file-truename"); | ||
| 494 | if (!NILP (Ffboundp (file_truename))) | ||
| 495 | dir = call1 (file_truename, dir); | ||
| 496 | } | ||
| 497 | dir = Fexpand_file_name (build_string ("../.."), dir); | ||
| 498 | } | ||
| 495 | #endif | 499 | #endif |
| 496 | name = Fexpand_file_name (Vinvocation_name, dir); | 500 | name = Fexpand_file_name (Vinvocation_name, dir); |
| 497 | while (1) | 501 | while (1) |
diff --git a/src/lread.c b/src/lread.c index 99e0ce30ba6..4f3446b09db 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1999,11 +1999,10 @@ readevalloop (Lisp_Object readcharfun, | |||
| 1999 | (NILP (lex_bound) || EQ (lex_bound, Qunbound) | 1999 | (NILP (lex_bound) || EQ (lex_bound, Qunbound) |
| 2000 | ? Qnil : list1 (Qt))); | 2000 | ? Qnil : list1 (Qt))); |
| 2001 | 2001 | ||
| 2002 | /* Try to ensure sourcename is a truename, except whilst preloading. */ | 2002 | /* Ensure sourcename is absolute, except whilst preloading. */ |
| 2003 | if (!will_dump_p () | 2003 | if (!will_dump_p () |
| 2004 | && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename)) | 2004 | && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename))) |
| 2005 | && !NILP (Ffboundp (Qfile_truename))) | 2005 | sourcename = Fexpand_file_name (sourcename, Qnil); |
| 2006 | sourcename = call1 (Qfile_truename, sourcename) ; | ||
| 2007 | 2006 | ||
| 2008 | LOADHIST_ATTACH (sourcename); | 2007 | LOADHIST_ATTACH (sourcename); |
| 2009 | 2008 | ||
| @@ -4678,9 +4677,6 @@ load_path_default (void) | |||
| 4678 | void | 4677 | void |
| 4679 | init_lread (void) | 4678 | init_lread (void) |
| 4680 | { | 4679 | { |
| 4681 | if (NILP (Vpurify_flag) && !NILP (Ffboundp (Qfile_truename))) | ||
| 4682 | Vsource_directory = call1 (Qfile_truename, Vsource_directory); | ||
| 4683 | |||
| 4684 | /* First, set Vload_path. */ | 4680 | /* First, set Vload_path. */ |
| 4685 | 4681 | ||
| 4686 | /* Ignore EMACSLOADPATH when dumping. */ | 4682 | /* Ignore EMACSLOADPATH when dumping. */ |
| @@ -5100,7 +5096,6 @@ this variable will become obsolete. */); | |||
| 5100 | DEFSYM (Qload, "load"); | 5096 | DEFSYM (Qload, "load"); |
| 5101 | DEFSYM (Qload_file_name, "load-file-name"); | 5097 | DEFSYM (Qload_file_name, "load-file-name"); |
| 5102 | DEFSYM (Qeval_buffer_list, "eval-buffer-list"); | 5098 | DEFSYM (Qeval_buffer_list, "eval-buffer-list"); |
| 5103 | DEFSYM (Qfile_truename, "file-truename"); | ||
| 5104 | DEFSYM (Qdir_ok, "dir-ok"); | 5099 | DEFSYM (Qdir_ok, "dir-ok"); |
| 5105 | DEFSYM (Qdo_after_load_evaluation, "do-after-load-evaluation"); | 5100 | DEFSYM (Qdo_after_load_evaluation, "do-after-load-evaluation"); |
| 5106 | 5101 | ||