From 3be93390fb6680d1e0c3256af72c86635a9eb327 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 20 Oct 2020 20:55:11 +0100 Subject: [PATCH] Sanitize eln filename when native compiling single functions * lisp/emacs-lisp/comp.el (comp-spill-lap-function): Fix temporary eln name generation. * test/src/comp-tests.el (free-fun-silly-name): New testcase. --- lisp/emacs-lisp/comp.el | 3 ++- test/src/comp-tests.el | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 6c54085750c..4967e8558b8 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -664,7 +664,8 @@ clashes." "Byte-compile FUNCTION-NAME spilling data from the byte compiler." (unless (comp-ctxt-output comp-ctxt) (setf (comp-ctxt-output comp-ctxt) - (make-temp-file (symbol-name function-name) nil ".eln"))) + (make-temp-file (comp-c-func-name function-name "freefn-") + nil ".eln"))) (let* ((f (symbol-function function-name)) (c-name (comp-c-func-name function-name "F")) (func (make-comp-func-l :name function-name diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index a13235b2039..b9a0a8771e5 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -369,6 +369,12 @@ Check that the resulting binaries do not differ." (should (equal (interactive-form #'comp-tests-free-fun-f) '(interactive)))) +(comp-deftest free-fun-silly-name () + "Check we are able to compile a single function." + (eval '(defun comp-tests/free\fun-f ()) t) + (native-compile #'comp-tests/free\fun-f) + (should (subr-native-elisp-p (symbol-function #'comp-tests/free\fun-f)))) + (comp-deftest bug-40187 () "Check function name shadowing. https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html." -- 2.39.5