branch: main
commit 04ef8cab05c213ca0c4c750f0d9d2905672a436a
Author: Ludovic Courtès <[email protected]>
AuthorDate: Thu Jul 25 23:05:31 2024 +0200

    store: ‘ensure-path/retry’ catches ‘&nar-error’.
    
    This addresses the case where ‘guix substitute’ crashes, as in this
    case:
    
       guix substitute: error: failed to find alternative substitute for 
'/gnu/store/…-zfs-2.2.4-builder'
       fetching path `/gnu/store/…-zfs-2.2.4-builder' (empty status: '')
       @ substituter-failed /gnu/store/…-zfs-2.2.4-builder  fetching path 
`/gnu/store/…-zfs-2.2.4-builder' (empty status: '')
       fetching path 
`/gnu/store/ghc2cx9dlpjbbprid5ginzav90f6fajg-linux-libre-module-builder-6.9.7.drv'...
       Uncaught exception in task:
       In fibers.scm:
           172:8 12 (_)
       In cuirass/scripts/remote-worker.scm:
          431:20 11 (_)
       In ice-9/boot-9.scm:
         1752:10 10 (with-exception-handler _ _ #:unwind? _ # _)
       In guix/store.scm:
          689:37  9 (thunk)
       In cuirass/scripts/remote-worker.scm:
          244:11  8 (_ #<store-connection 256.99 ffff6e9920a0>)
       In ice-9/exceptions.scm:
          406:15  7 (ensure-path/retry #<store-connection 256.99 ffff6e992?> ?)
       In ice-9/boot-9.scm:
         1752:10  6 (with-exception-handler _ _ #:unwind? _ # _)
       In guix/store.scm:
          1487:0  5 (ensure-path #<store-connection 256.99 ffff6e9920a0> _)
          746:11  4 (process-stderr #<store-connection 256.99 ffff6e9920a0> _)
       In guix/serialization.scm:
            79:6  3 (read-int #<closed: file ffff6f1de7e0>)
       In ice-9/boot-9.scm:
         1685:16  2 (raise-exception _ #:continuable? _)
         1683:16  1 (raise-exception _ #:continuable? _)
         1685:16  0 (raise-exception _ #:continuable? _)
       ice-9/boot-9.scm:1685:16: In procedure raise-exception:
       ERROR:
         1. &nar-error:
             file: #f
             port: #<closed: file ffff6f1de7e0>
    
    * src/cuirass/store.scm (ensure-path/retry)[available-item?]: Catch
    ‘nar-error?’.
---
 src/cuirass/store.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/cuirass/store.scm b/src/cuirass/store.scm
index 69babab..86d3e82 100644
--- a/src/cuirass/store.scm
+++ b/src/cuirass/store.scm
@@ -22,6 +22,7 @@
   #:autoload   (guix derivations) (build-derivations
                                    derivation-path->output-paths)
   #:use-module ((guix config) #:select (%state-directory))
+  #:autoload   (guix serialization) (nar-error? nar-error-file)
   #:autoload   (cuirass logging) (log-info log-warning log-error)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-34)
@@ -163,6 +164,10 @@ substituting it as necessary.  Retry up to MAX-RETRIES 
times upon
     (guard (c ((store-protocol-error? c)
                (log-warning "failed to substitute ~a: ~a"
                             item (store-protocol-error-message c))
+               #f)
+              ((nar-error? c)              ;substituter terminated prematurely
+               (log-warning "failed to substitute ~a: error while restoring 
'~a'"
+                            item (nar-error-file c))
                #f))
       (ensure-path store item)))
 

Reply via email to