diff options
| author | Andrea Corallo | 2020-12-26 20:16:26 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-12-26 20:38:36 +0100 |
| commit | 271fb8a269aff924070b188f23355d0c368356dd (patch) | |
| tree | 2a89a757c63d9df9ecfe786040e8fb66834fe440 | |
| parent | d8939520535224ccee663bba5b3da752f1648009 (diff) | |
| download | emacs-271fb8a269aff924070b188f23355d0c368356dd.tar.gz emacs-271fb8a269aff924070b188f23355d0c368356dd.zip | |
* Fix `byte-compile-file' for native compilation (bug#45442)
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Fix logic for
native compilation.
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 620f15c619d..9f5d121024a 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -2020,16 +2020,16 @@ See also `emacs-lisp-byte-compile-and-load'." | |||
| 2020 | (insert "\n") ; aaah, unix. | 2020 | (insert "\n") ; aaah, unix. |
| 2021 | (cond | 2021 | (cond |
| 2022 | ((null target-file) nil) ;We only wanted the warnings! | 2022 | ((null target-file) nil) ;We only wanted the warnings! |
| 2023 | ((and (or (file-writable-p target-file) | 2023 | ((or byte-native-compiling |
| 2024 | byte-native-compiling) | 2024 | (and (file-writable-p target-file) |
| 2025 | ;; We attempt to create a temporary file in the | 2025 | ;; We attempt to create a temporary file in the |
| 2026 | ;; target directory, so the target directory must be | 2026 | ;; target directory, so the target directory must be |
| 2027 | ;; writable. | 2027 | ;; writable. |
| 2028 | (file-writable-p | 2028 | (file-writable-p |
| 2029 | (file-name-directory | 2029 | (file-name-directory |
| 2030 | ;; Need to expand in case TARGET-FILE doesn't | 2030 | ;; Need to expand in case TARGET-FILE doesn't |
| 2031 | ;; include a directory (Bug#45287). | 2031 | ;; include a directory (Bug#45287). |
| 2032 | (expand-file-name target-file)))) | 2032 | (expand-file-name target-file))))) |
| 2033 | ;; We must disable any code conversion here. | 2033 | ;; We must disable any code conversion here. |
| 2034 | (let* ((coding-system-for-write 'no-conversion) | 2034 | (let* ((coding-system-for-write 'no-conversion) |
| 2035 | ;; Write to a tempfile so that if another Emacs | 2035 | ;; Write to a tempfile so that if another Emacs |
| @@ -2037,7 +2037,8 @@ See also `emacs-lisp-byte-compile-and-load'." | |||
| 2037 | ;; parallel bootstrap), it does not risk getting a | 2037 | ;; parallel bootstrap), it does not risk getting a |
| 2038 | ;; half-finished file. (Bug#4196) | 2038 | ;; half-finished file. (Bug#4196) |
| 2039 | (tempfile | 2039 | (tempfile |
| 2040 | (make-temp-file (expand-file-name target-file))) | 2040 | (make-temp-file (when (file-writable-p target-file) |
| 2041 | (expand-file-name target-file)))) | ||
| 2041 | (default-modes (default-file-modes)) | 2042 | (default-modes (default-file-modes)) |
| 2042 | (temp-modes (logand default-modes #o600)) | 2043 | (temp-modes (logand default-modes #o600)) |
| 2043 | (desired-modes (logand default-modes #o666)) | 2044 | (desired-modes (logand default-modes #o666)) |