~ruther/guix-local

b9a31d90e907db0a593ec80aacc35a0523a009f6 — Ludovic Courtès 11 years ago b1e48f2
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.
1 files changed, 11 insertions(+), 2 deletions(-)

M guix/scripts/offload.scm
M guix/scripts/offload.scm => guix/scripts/offload.scm +11 -2
@@ 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)))))