guix-commits
[Top][All Lists]
Advanced

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

03/03: pull: Don't use rename(2) across potentially different devices.


From: Ludovic Courtès
Subject: 03/03: pull: Don't use rename(2) across potentially different devices.
Date: Fri, 12 Oct 2018 09:18:55 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 8036b0942b89022147aaf9cd9940988fdbcc19ef
Author: Ludovic Courtès <address@hidden>
Date:   Fri Oct 12 15:11:50 2018 +0200

    pull: Don't use rename(2) across potentially different devices.
    
    Reported by Formbi on #guix.
    
    * guix/scripts/pull.scm (migrate-generations): Use 'symlink' and
    'delete-file' instead of 'rename-file'.  The latter could lead to EXDEV
    when $HOME and /var were different partitions.
---
 guix/scripts/pull.scm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 8e05950..660a2b9 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -239,7 +239,7 @@ Download and deploy the latest version of Guix.\n"))
   (string-append (config-directory #:ensure? #f) "/current"))
 
 (define (migrate-generations profile directory)
-  "Migration the generations of PROFILE to DIRECTORY."
+  "Migrate the generations of PROFILE to DIRECTORY."
   (format (current-error-port)
           (G_ "Migrating profile generations to '~a'...~%")
           %profile-directory)
@@ -251,7 +251,10 @@ Download and deploy the latest version of Guix.\n"))
                       (target (string-append directory "/current-guix-"
                                              (number->string generation)
                                              "-link")))
-                  (rename-file source target)))
+                  ;; Note: Don't use 'rename-file' as SOURCE and TARGET might
+                  ;; live on different file systems.
+                  (symlink (readlink source) target)
+                  (delete-file source)))
               (profile-generations profile))
     (symlink current (string-append directory "/current-guix"))))
 



reply via email to

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