GNU bug report logs - #48578
28.0.50; Native-compiled files of some preloaded files not loaded at dump time

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Sat, 22 May 2021 07:21:01 UTC

Severity: normal

Found in version 28.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #26 received at 48578 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 48578 <at> debbugs.gnu.org
Subject: Re: bug#48578: 28.0.50; Native-compiled files of some preloaded
 files not loaded at dump time
Date: Tue, 25 May 2021 12:34:27 +0000
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Andrea Corallo <akrl <at> sdf.org>
>> Cc: 48578 <at> debbugs.gnu.org
>> Date: Mon, 24 May 2021 08:48:39 +0000
>>
>> > Suggestions for where to look for the reasons of the problem?
>>
>> I'd start verifying what given the el source file
>> `comp-el-to-eln-rel-filename' suggests as eln filename and if this is
>> present as native compiled file (I guess so if you recompiled manually).
>>
>> The next step would be verifying why when loading in lread.c
>> 'maybe_swap_for_eln' does not decide to load the eln file in place of
>> the elc one.
>
> Thanks.  The problem is in comp-el-to-eln-rel-filename, in this
> fragment at its beginning:
>
>   /* Use `file-truename' or fall back to `expand-file-name' when the
>      first is not available (bug#44701).
>
>      `file-truename' is not available only for a short phases of the
>      bootstrap before file.el is loaded, given we do not symlink
>      inside the build directory this should work.  */
>   filename = NILP (Ffboundp (intern_c_string ("file-truename")))
>     ? Fexpand_file_name (filename, Qnil)
>     : CALL1I (file-truename, filename);
>
> During loadup, file-truename is not available until files.elc/eln is
> loaded.  But the assumption above that it isn't a problem because "we
> do not symlink inside the build directory" in false in my case,
> because my home directory, where I build Emacs, is itself a symlink:
>
>   (expand-file-name "~") => "/home/e/eliz"
>   (file-truename "~") => "/srv/data/home/e/eliz"
>
> So every one of the *.eln files loaded before and including files.elc
> will fail in the above logic and will produce a different path_hash,
> thus failing the attempt to find the correct .eln file.
>
> We could use 'realpath' (and a suitable emulation on WINDOWSNT)
> instead of file-truename.

Hi Eli,

I see, it would then look something like the attached I guess.

It does bootstrap on GNU/Linux but I'm no expert on how to fill the
WINDOWSNT ifdef branch.

Thanks

  Andrea

[48578.patch (text/x-diff, inline)]
diff --git a/src/comp.c b/src/comp.c
index 340ed85038..e6debefa1d 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -4008,15 +4008,23 @@ DEFUN ("comp-el-to-eln-rel-filename", Fcomp_el_to_eln_rel_filename,
 {
   CHECK_STRING (filename);
 
-  /* Use `file-truename' or fall back to `expand-file-name' when the
-     first is not available (bug#44701).
-
-     `file-truename' is not available only for a short phases of the
-     bootstrap before file.el is loaded, given we do not symlink
-     inside the build directory this should work.  */
-  filename = NILP (Ffboundp (intern_c_string ("file-truename")))
-    ? Fexpand_file_name (filename, Qnil)
-    : CALL1I (file-truename, filename);
+  /* Use `file-truename' or fall back to 'realpath' `expand-file-name'
+     when the first is not available.  (`file-truename' is not
+     available only for a short phases of the bootstrap before file.el
+     is loaded).  */
+
+  if (NILP (Ffboundp (intern_c_string ("file-truename"))))
+    {
+#ifndef WINDOWSNT
+      char *file_normalized = realpath (SSDATA (filename), NULL);
+#else
+      char *file_normalized = ??? ;
+#endif
+      filename = Fexpand_file_name (build_string (file_normalized), Qnil);
+      xfree (file_normalized);
+    }
+  else
+    filename = CALL1I (file-truename, filename);
 
   if (NILP (Ffile_exists_p (filename)))
     xsignal1 (Qfile_missing, filename);

This bug report was last modified 3 years and 355 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.