aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-08-29 14:53:15 +0200
committerLudovic Courtès <ludo@gnu.org>2014-08-29 14:53:15 +0200
commitb9a31d90e907db0a593ec80aacc35a0523a009f6 (patch)
tree31de8ad5f7153e75d00aebc92057d5c8acaa47eb /guix
parentb1e48f222b4805012b4fd2ef5b4aa46884ee0a8d (diff)
downloadguix-b9a31d90e907db0a593ec80aacc35a0523a009f6.tar
guix-b9a31d90e907db0a593ec80aacc35a0523a009f6.tar.gz
offload: Ignore EEXIST when registering a .drv as a GC root.
Fixes <http://bugs.gnu.org/18115>. Reported by Mark H Weaver <mhw@netris.org>. * guix/scripts/offload.scm (register-gc-root)[script]: Wrap 'symlink' call in "catch 'system-error", and ignore EEXIST errors.
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/offload.scm13
1 files changed, 11 insertions, 2 deletions
diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm
index c17de34acc..b3b502425c 100644
--- a/guix/scripts/offload.scm
+++ b/guix/scripts/offload.scm
@@ -316,8 +316,17 @@ hook."
(let ((root-directory (string-append %state-directory
"/gcroots/tmp")))
(false-if-exception (mkdir root-directory))
- (symlink ,file
- (string-append root-directory "/" ,%gc-root-file)))))
+ (catch 'system-error
+ (lambda ()
+ (symlink ,file
+ (string-append root-directory "/" ,%gc-root-file)))
+ (lambda args
+ ;; If FILE already exists, we can assume that either it's a stale
+ ;; reference (which is fine), or another process is already
+ ;; building the derivation represented by FILE (which is fine
+ ;; too.) Thus, do nothing in that case.
+ (unless (= EEXIST (system-error-errno args))
+ (apply throw args)))))))
(let ((pipe (remote-pipe machine OPEN_READ
`("guile" "-c" ,(object->string script)))))