emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6e2e34a5caa: Avoid race condition in parallel native-compilation


From: Eli Zaretskii
Subject: master 6e2e34a5caa: Avoid race condition in parallel native-compilation
Date: Mon, 1 Jan 2024 15:11:39 -0500 (EST)

branch: master
commit 6e2e34a5caa75a3430a1fb0d89900f9911c50436
Author: Aaron Jensen <aaronjensen@gmail.com>
Commit: Eli Zaretskii <eliz@gnu.org>

    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)
---
 lisp/emacs-lisp/comp.el | 6 +++---
 1 file 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."
         ;; Remove the old eln instead of copying the new one into it
         ;; to get a new inode and prevent crashes in case the old one
         ;; is currently loaded.
-        (t (delete-file oldfile)
-           (when newfile
-             (rename-file newfile oldfile)))))
+        (t (if newfile
+               (rename-file newfile oldfile t)
+             (delete-file oldfile)))))
 
 (defun comp--native-compile (function-or-file &optional with-late-load output)
   "Compile FUNCTION-OR-FILE into native code.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]