Fix bug#45603

Reported and reduced by Mauricio Collares.

	* lisp/emacs-lisp/comp.el (comp-final): Fix coding system for the
	tmp file used to pass data the child processes.
	* test/src/comp-tests.el (45603-1): New testcase
	* test/src/comp-test-45603.el : New File.
This commit is contained in:
Andrea Corallo 2021-01-06 15:26:38 +01:00
parent 8ad983c4ac
commit 33b8ce865f
3 changed files with 34 additions and 0 deletions

View file

@ -3550,6 +3550,7 @@ Prepare every function for final compilation and drive the C back-end."
(file-name-base output) "-")
nil ".el")))
(with-temp-file temp-file
(insert ";; -*-coding: nil; -*-\n")
(insert (prin1-to-string expr)))
(with-temp-buffer
(unwind-protect

View file

@ -0,0 +1,28 @@
;;; -*- lexical-binding: t; -*-
;; Reduced from ivy.el.
(defvar comp-test-45603-last)
(defvar comp-test-45603-mark-prefix)
(defvar comp-test-45603-directory)
(defvar comp-test-45603-marked-candidates)
(defun comp-test-45603--call-marked (action)
(let* ((prefix-len (length comp-test-45603-mark-prefix))
(marked-candidates
(mapcar
(lambda (s)
(let ((cand (substring s prefix-len)))
(if comp-test-45603-directory
(expand-file-name cand comp-test-45603-directory)
cand)))
comp-test-45603-marked-candidates))
(multi-action (comp-test-45603--get-multi-action comp-test-45603-last)))))
(defalias 'comp-test-45603--file-local-name
(if (fboundp 'file-local-name)
#'file-local-name
(lambda (file)
(or (file-remote-p file 'localname) file))))
(provide 'comp-test-45603)

View file

@ -492,6 +492,11 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
(should (string= (comp-test-45635-f :height 180 :family "PragmataPro Liga")
"PragmataPro Liga")))
(comp-deftest 45603-1 ()
"<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01994.html>"
(load (native-compile (concat comp-test-directory "comp-test-45603.el")))
(should (fboundp #'comp-test-45603--file-local-name)))
;;;;;;;;;;;;;;;;;;;;;
;; Tromey's tests. ;;