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.
This commit is contained in:
		
							parent
							
								
									dde49cfe53
								
							
						
					
					
						commit
						8036b0942b
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		|  | @ -239,7 +239,7 @@ Download and deploy the latest version of Guix.\n")) | ||||||
|   (string-append (config-directory #:ensure? #f) "/current")) |   (string-append (config-directory #:ensure? #f) "/current")) | ||||||
| 
 | 
 | ||||||
| (define (migrate-generations profile directory) | (define (migrate-generations profile directory) | ||||||
|   "Migration the generations of PROFILE to DIRECTORY." |   "Migrate the generations of PROFILE to DIRECTORY." | ||||||
|   (format (current-error-port) |   (format (current-error-port) | ||||||
|           (G_ "Migrating profile generations to '~a'...~%") |           (G_ "Migrating profile generations to '~a'...~%") | ||||||
|           %profile-directory) |           %profile-directory) | ||||||
|  | @ -251,7 +251,10 @@ Download and deploy the latest version of Guix.\n")) | ||||||
|                       (target (string-append directory "/current-guix-" |                       (target (string-append directory "/current-guix-" | ||||||
|                                              (number->string generation) |                                              (number->string generation) | ||||||
|                                              "-link"))) |                                              "-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)) |               (profile-generations profile)) | ||||||
|     (symlink current (string-append directory "/current-guix")))) |     (symlink current (string-append directory "/current-guix")))) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Reference in a new issue