1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 11:00:45 -08:00

* Fix `byte-compile-file' for native compilation (bug#45442)

* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Fix logic for
	native compilation.
This commit is contained in:
Andrea Corallo 2020-12-26 20:16:26 +01:00
parent d893952053
commit 271fb8a269

View file

@ -2020,16 +2020,16 @@ See also `emacs-lisp-byte-compile-and-load'."
(insert "\n") ; aaah, unix. (insert "\n") ; aaah, unix.
(cond (cond
((null target-file) nil) ;We only wanted the warnings! ((null target-file) nil) ;We only wanted the warnings!
((and (or (file-writable-p target-file) ((or byte-native-compiling
byte-native-compiling) (and (file-writable-p target-file)
;; We attempt to create a temporary file in the ;; We attempt to create a temporary file in the
;; target directory, so the target directory must be ;; target directory, so the target directory must be
;; writable. ;; writable.
(file-writable-p (file-writable-p
(file-name-directory (file-name-directory
;; Need to expand in case TARGET-FILE doesn't ;; Need to expand in case TARGET-FILE doesn't
;; include a directory (Bug#45287). ;; include a directory (Bug#45287).
(expand-file-name target-file)))) (expand-file-name target-file)))))
;; We must disable any code conversion here. ;; We must disable any code conversion here.
(let* ((coding-system-for-write 'no-conversion) (let* ((coding-system-for-write 'no-conversion)
;; Write to a tempfile so that if another Emacs ;; Write to a tempfile so that if another Emacs
@ -2037,7 +2037,8 @@ See also `emacs-lisp-byte-compile-and-load'."
;; parallel bootstrap), it does not risk getting a ;; parallel bootstrap), it does not risk getting a
;; half-finished file. (Bug#4196) ;; half-finished file. (Bug#4196)
(tempfile (tempfile
(make-temp-file (expand-file-name target-file))) (make-temp-file (when (file-writable-p target-file)
(expand-file-name target-file))))
(default-modes (default-file-modes)) (default-modes (default-file-modes))
(temp-modes (logand default-modes #o600)) (temp-modes (logand default-modes #o600))
(desired-modes (logand default-modes #o666)) (desired-modes (logand default-modes #o666))