diff options
| author | Aaron Jensen | 2023-12-30 18:06:45 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2024-01-01 22:10:27 +0200 |
| commit | 6e2e34a5caa75a3430a1fb0d89900f9911c50436 (patch) | |
| tree | 3d6959d3ac8bfa0053988803d043c11773494486 | |
| parent | 69c98b0e70ba763df481e6ee7b1c73fbd8754050 (diff) | |
| download | emacs-6e2e34a5caa75a3430a1fb0d89900f9911c50436.tar.gz emacs-6e2e34a5caa75a3430a1fb0d89900f9911c50436.zip | |
Avoid race condition in parallel native-compilation
* lisp/emacs-lisp/comp.el (comp-delete-or-replace-file): Avoid
race condition by relying on 'rename-file' being an atomic
operation on Posix filesystems. (Bug#68083)
| -rw-r--r-- | lisp/emacs-lisp/comp.el | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 3b2fd25e61c..f9eeef1b9e8 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el | |||
| @@ -3339,9 +3339,9 @@ session." | |||
| 3339 | ;; Remove the old eln instead of copying the new one into it | 3339 | ;; Remove the old eln instead of copying the new one into it |
| 3340 | ;; to get a new inode and prevent crashes in case the old one | 3340 | ;; to get a new inode and prevent crashes in case the old one |
| 3341 | ;; is currently loaded. | 3341 | ;; is currently loaded. |
| 3342 | (t (delete-file oldfile) | 3342 | (t (if newfile |
| 3343 | (when newfile | 3343 | (rename-file newfile oldfile t) |
| 3344 | (rename-file newfile oldfile))))) | 3344 | (delete-file oldfile))))) |
| 3345 | 3345 | ||
| 3346 | (defun comp--native-compile (function-or-file &optional with-late-load output) | 3346 | (defun comp--native-compile (function-or-file &optional with-late-load output) |
| 3347 | "Compile FUNCTION-OR-FILE into native code. | 3347 | "Compile FUNCTION-OR-FILE into native code. |