emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp c818c29: Revert "Fix native code uneffective loads a


From: Andrea Corallo
Subject: feature/native-comp c818c29: Revert "Fix native code uneffective loads after recompilation" (bug#42944)
Date: Thu, 20 Aug 2020 06:48:00 -0400 (EDT)

branch: feature/native-comp
commit c818c29771d3cb51875643b2f6c894073e429dd2
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    Revert "Fix native code uneffective loads after recompilation" (bug#42944)
    
    This reverts commit 8a931a97b8dd19a38d6f719f810280a07ba76438.
    
    This introduced bug#42944.
---
 src/comp.c  | 19 ++-----------------
 src/lread.c | 20 +++++++++++++-------
 2 files changed, 15 insertions(+), 24 deletions(-)

diff --git a/src/comp.c b/src/comp.c
index a00088b..ff73245 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -3872,26 +3872,13 @@ If BASE-DIR is nil use the first entry in 
`comp-eln-load-path'.  */)
 {
   CHECK_STRING (filename);
 
-  if (NILP (Ffile_exists_p (filename)))
-    xsignal1 (Qfile_missing, filename);
-
-  Lisp_Object last_mod_time =
-    Fnth (make_fixnum (5), Ffile_attributes (filename, Qnil));
-
   if (suffix_p (filename, ".gz"))
     filename = Fsubstring (filename, Qnil, make_fixnum (-3));
   filename = Fexpand_file_name (filename, Qnil);
 
   /* We create eln filenames with an hash in order to look-up these
      starting from the source filename, IOW have a relation
-
-     /absolute/path/filename.el + last_mod_time ->
-     eln-cache/filename-hash.eln.
-
-     'dlopen' can return the same handle if two shared with the same
-     filename are loaded in two different times (even if the first was
-     deleted!).  To prevent this scenario the last modification time
-     of the source file is included in the hashing algorithm.
+     /absolute/path/filename.el -> eln-cache/filename-hash.eln.
 
      As installing .eln files compiled during the build changes their
      absolute path we need an hashing mechanism that is not sensitive
@@ -3923,9 +3910,7 @@ If BASE-DIR is nil use the first entry in 
`comp-eln-load-path'.  */)
        }
     }
 
-  Lisp_Object hash_input =
-    concat2 (filename, Fprin1_to_string (last_mod_time, Qnil));
-  Lisp_Object hash = Fsubstring (comp_hash_string (hash_input), Qnil,
+  Lisp_Object hash = Fsubstring (comp_hash_string (filename), Qnil,
                                 make_fixnum (ELN_FILENAME_HASH_LEN));
   filename = concat2 (Ffile_name_nondirectory (Fsubstring (filename, Qnil,
                                                           make_fixnum (-3))),
diff --git a/src/lread.c b/src/lread.c
index 6b585fc..521da4e 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1635,13 +1635,19 @@ maybe_swap_for_eln (Lisp_Object *filename, int *fd, 
struct timespec mtime)
            emacs_close (eln_fd);
          else
            {
-             *filename = eln_name;
-             emacs_close (*fd);
-             *fd = eln_fd;
-             /* Store the eln -> el relation.  */
-             Fputhash (Ffile_name_nondirectory (eln_name),
-                       el_name, Vcomp_eln_to_el_h);
-             return;
+             struct timespec eln_mtime = get_stat_mtime (&eln_st);
+             if (timespec_cmp (eln_mtime, mtime) > 0)
+               {
+                 *filename = eln_name;
+                 emacs_close (*fd);
+                 *fd = eln_fd;
+                 /* Store the eln -> el relation.  */
+                 Fputhash (Ffile_name_nondirectory (eln_name),
+                           el_name, Vcomp_eln_to_el_h);
+                 return;
+               }
+             else
+               emacs_close (eln_fd);
            }
        }
     }



reply via email to

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