aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2020-08-20 12:36:39 +0200
committerAndrea Corallo2020-08-20 12:46:52 +0200
commitc818c29771d3cb51875643b2f6c894073e429dd2 (patch)
tree03111a6e9c917daefd63daa7efa3f029ae6485af
parent8a931a97b8dd19a38d6f719f810280a07ba76438 (diff)
downloademacs-c818c29771d3cb51875643b2f6c894073e429dd2.tar.gz
emacs-c818c29771d3cb51875643b2f6c894073e429dd2.zip
Revert "Fix native code uneffective loads after recompilation" (bug#42944)
This reverts commit 8a931a97b8dd19a38d6f719f810280a07ba76438. This introduced bug#42944.
-rw-r--r--src/comp.c19
-rw-r--r--src/lread.c20
2 files changed, 15 insertions, 24 deletions
diff --git a/src/comp.c b/src/comp.c
index a00088bb7f8..ff73245b8de 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'. */)
3872{ 3872{
3873 CHECK_STRING (filename); 3873 CHECK_STRING (filename);
3874 3874
3875 if (NILP (Ffile_exists_p (filename)))
3876 xsignal1 (Qfile_missing, filename);
3877
3878 Lisp_Object last_mod_time =
3879 Fnth (make_fixnum (5), Ffile_attributes (filename, Qnil));
3880
3881 if (suffix_p (filename, ".gz")) 3875 if (suffix_p (filename, ".gz"))
3882 filename = Fsubstring (filename, Qnil, make_fixnum (-3)); 3876 filename = Fsubstring (filename, Qnil, make_fixnum (-3));
3883 filename = Fexpand_file_name (filename, Qnil); 3877 filename = Fexpand_file_name (filename, Qnil);
3884 3878
3885 /* We create eln filenames with an hash in order to look-up these 3879 /* We create eln filenames with an hash in order to look-up these
3886 starting from the source filename, IOW have a relation 3880 starting from the source filename, IOW have a relation
3887 3881 /absolute/path/filename.el -> eln-cache/filename-hash.eln.
3888 /absolute/path/filename.el + last_mod_time ->
3889 eln-cache/filename-hash.eln.
3890
3891 'dlopen' can return the same handle if two shared with the same
3892 filename are loaded in two different times (even if the first was
3893 deleted!). To prevent this scenario the last modification time
3894 of the source file is included in the hashing algorithm.
3895 3882
3896 As installing .eln files compiled during the build changes their 3883 As installing .eln files compiled during the build changes their
3897 absolute path we need an hashing mechanism that is not sensitive 3884 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'. */)
3923 } 3910 }
3924 } 3911 }
3925 3912
3926 Lisp_Object hash_input = 3913 Lisp_Object hash = Fsubstring (comp_hash_string (filename), Qnil,
3927 concat2 (filename, Fprin1_to_string (last_mod_time, Qnil));
3928 Lisp_Object hash = Fsubstring (comp_hash_string (hash_input), Qnil,
3929 make_fixnum (ELN_FILENAME_HASH_LEN)); 3914 make_fixnum (ELN_FILENAME_HASH_LEN));
3930 filename = concat2 (Ffile_name_nondirectory (Fsubstring (filename, Qnil, 3915 filename = concat2 (Ffile_name_nondirectory (Fsubstring (filename, Qnil,
3931 make_fixnum (-3))), 3916 make_fixnum (-3))),
diff --git a/src/lread.c b/src/lread.c
index 6b585fcaccc..521da4e1d81 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)
1635 emacs_close (eln_fd); 1635 emacs_close (eln_fd);
1636 else 1636 else
1637 { 1637 {
1638 *filename = eln_name; 1638 struct timespec eln_mtime = get_stat_mtime (&eln_st);
1639 emacs_close (*fd); 1639 if (timespec_cmp (eln_mtime, mtime) > 0)
1640 *fd = eln_fd; 1640 {
1641 /* Store the eln -> el relation. */ 1641 *filename = eln_name;
1642 Fputhash (Ffile_name_nondirectory (eln_name), 1642 emacs_close (*fd);
1643 el_name, Vcomp_eln_to_el_h); 1643 *fd = eln_fd;
1644 return; 1644 /* Store the eln -> el relation. */
1645 Fputhash (Ffile_name_nondirectory (eln_name),
1646 el_name, Vcomp_eln_to_el_h);
1647 return;
1648 }
1649 else
1650 emacs_close (eln_fd);
1645 } 1651 }
1646 } 1652 }
1647 } 1653 }