]> git.eshelyaron.com Git - emacs.git/commitdiff
Sanitize eln filename when native compiling single functions
authorAndrea Corallo <akrl@sdf.org>
Tue, 20 Oct 2020 19:55:11 +0000 (20:55 +0100)
committerAndrea Corallo <akrl@sdf.org>
Tue, 20 Oct 2020 20:29:05 +0000 (21:29 +0100)
* 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
test/src/comp-tests.el

index 6c54085750cc1e22d60380410bb371fb179fe587..4967e8558b8b534eeaf230741181c469286ad233 100644 (file)
@@ -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
index a13235b203999a60ebdd5ac86a9502efb82d1682..b9a0a8771e5fb0b1d62eca6506f42b884ae36a5f 100644 (file)
@@ -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."