emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp cb293cf 2/2: * Guard against trying to rename files


From: Andrea Corallo
Subject: feature/native-comp cb293cf 2/2: * Guard against trying to rename files into eln sys directory
Date: Thu, 10 Sep 2020 05:00:45 -0400 (EDT)

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

    * Guard against trying to rename files into eln sys directory
    
        * src/comp.c (file_in_eln_sys_dir): New function.
        (Fnative_elisp_load): Make use of.
---
 src/comp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/comp.c b/src/comp.c
index 4550833..d7966d4 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -4912,6 +4912,18 @@ DEFUN ("comp--late-register-subr", 
Fcomp__late_register_subr,
   return Qnil;
 }
 
+static bool
+file_in_eln_sys_dir (Lisp_Object filename)
+{
+  Lisp_Object eln_sys_dir = Qnil;
+  Lisp_Object tmp = Vcomp_eln_load_path;
+  FOR_EACH_TAIL (tmp)
+    eln_sys_dir = XCAR (tmp);
+  return !NILP (Fstring_match (Fregexp_quote (Fexpand_file_name (eln_sys_dir,
+                                                                Qnil)),
+                              Fexpand_file_name (filename, Qnil), Qnil));
+}
+
 /* Load related routines.  */
 DEFUN ("native-elisp-load", Fnative_elisp_load, Snative_elisp_load, 1, 2, 0,
        doc: /* Load native elisp code FILENAME.
@@ -4926,6 +4938,7 @@ DEFUN ("native-elisp-load", Fnative_elisp_load, 
Snative_elisp_load, 1, 2, 0,
   struct Lisp_Native_Comp_Unit *comp_u = allocate_native_comp_unit ();
 
   if (!NILP (Fgethash (filename, all_loaded_comp_units_h, Qnil))
+      && !file_in_eln_sys_dir (filename)
       && !NILP (Ffile_writable_p (filename)))
     {
       /* If in this session there was ever a file loaded with this



reply via email to

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