1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 22:41:06 -08:00

Ensure that byte compilation works for relative files (Bug#45287).

* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don’t fail if
target filename doesn’t contain a directory name.

* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--target-file-no-directory): New unit test.
This commit is contained in:
Philipp Stephani 2020-12-17 12:06:15 +01:00
parent 32d76c0cbc
commit 7fad959114
2 changed files with 20 additions and 1 deletions

View file

@ -1016,6 +1016,21 @@ mountpoint (Bug#44631)."
(set-file-modes directory #o700)
(delete-directory directory :recursive))))))
(ert-deftest bytecomp-tests--target-file-no-directory ()
"Check that Bug#45287 is fixed."
(let ((directory (make-temp-file "bytecomp-tests-" :directory)))
(unwind-protect
(let* ((default-directory directory)
(byte-compile-dest-file-function (lambda (_) "test.elc"))
(byte-compile-error-on-warn t))
(write-region "" nil "test.el" nil nil nil 'excl)
(should (byte-compile-file "test.el"))
(should (file-regular-p "test.elc"))
(should (cl-plusp (file-attribute-size
(file-attributes "test.elc")))))
(with-demoted-errors "Error cleaning up directory: %s"
(delete-directory directory :recursive)))))
;; Local Variables:
;; no-byte-compile: t
;; End: