summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-10-12 15:11:50 +0200
committerLudovic Courtès <ludo@gnu.org>2018-10-12 15:18:41 +0200
commit8036b0942b89022147aaf9cd9940988fdbcc19ef (patch)
tree519e9c1a1247cb22b1db451ca7abc7cefd5968c6
parentdde49cfe5312b95f44060155256036532f3cb22a (diff)
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.
-rw-r--r--guix/scripts/pull.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 8e0595076a0..660a2b91106 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -239,7 +239,7 @@ Download and deploy the latest version of Guix.\n"))
239 (string-append (config-directory #:ensure? #f) "/current")) 239 (string-append (config-directory #:ensure? #f) "/current"))
240 240
241(define (migrate-generations profile directory) 241(define (migrate-generations profile directory)
242 "Migration the generations of PROFILE to DIRECTORY." 242 "Migrate the generations of PROFILE to DIRECTORY."
243 (format (current-error-port) 243 (format (current-error-port)
244 (G_ "Migrating profile generations to '~a'...~%") 244 (G_ "Migrating profile generations to '~a'...~%")
245 %profile-directory) 245 %profile-directory)
@@ -251,7 +251,10 @@ Download and deploy the latest version of Guix.\n"))
251 (target (string-append directory "/current-guix-" 251 (target (string-append directory "/current-guix-"
252 (number->string generation) 252 (number->string generation)
253 "-link"))) 253 "-link")))
254 (rename-file source target))) 254 ;; Note: Don't use 'rename-file' as SOURCE and TARGET might
255 ;; live on different file systems.
256 (symlink (readlink source) target)
257 (delete-file source)))
255 (profile-generations profile)) 258 (profile-generations profile))
256 (symlink current (string-append directory "/current-guix")))) 259 (symlink current (string-append directory "/current-guix"))))
257 260