From: Andrea Corallo Date: Thu, 10 Sep 2020 07:59:29 +0000 (+0200) Subject: * Guard against trying to rename files into eln sys directory X-Git-Tag: emacs-28.0.90~2727^2~450 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cb293cfb929dfbecb3057dde2115399b89350a9b;p=emacs.git * 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. --- diff --git a/src/comp.c b/src/comp.c index 4550833a6a2..d7966d42221 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