Subject: [PATCH] substitutes: Tolerate GnuTLS push/pull errors when fetching narinfos.
From: Ludovic Courtès <[email-masked]>
To: [email-masked]
Cc: Ludovic Courtès <[email-masked]>, Timo Wilken <[email-masked]>
Date: Tue, 25 Feb 2025 16:58:52 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Fixes <https://issues.guix.gnu.org/75679>.

Fixes this infamous error:

  substitute: looking for substitutes on 'https://bordeaux.guix.gnu.org'...   0.0%guix substitute: error: TLS error in procedure 'write_to_session_record_port': Error in the push function.
  guix system: error: `/gnu/store/…-guix-1.4.0-32.5f6fdad/bin/guix substitute' died unexpectedly

* guix/substitutes.scm (call-with-connection-error-handling): Report
‘error/push-error’ and ‘error/pull-error’ as mere warnings.

Reported-by: Timo Wilken <[email-masked]>
Change-Id: Ibc507cb88b164cbb91dff95aa18d9974c573f7c9
---
 guix/substitutes.scm | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Hi!

At long last.  Note that we'll need to update the ‘guix’ package
to make this change effective.

Ludo’.

diff --git a/guix/substitutes.scm b/guix/substitutes.scm
index e31b3940203..7ca55788d5e 100644
--- a/guix/substitutes.scm
+++ b/guix/substitutes.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013-2021, 2023-2024 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2013-2021, 2023-2025 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2014 Nikita Karetnikov <[email-masked]>
 ;;; Copyright © 2018 Kyle Meyer <[email-masked]>
 ;;; Copyright © 2020 Christopher Baines <[email-masked]>
@@ -35,7 +35,10 @@ (define-module (guix substitutes)
                 #:select ((open-connection-for-uri
                            . guix:open-connection-for-uri)
                           resolve-uri-reference))
-  #:autoload   (gnutls) (error->string error/premature-termination)
+  #:autoload   (gnutls) (error->string
+                         error/premature-termination
+                         error/pull-error
+                         error/push-error)
   #:use-module (guix progress)
   #:use-module (ice-9 match)
   #:use-module (ice-9 format)
@@ -154,7 +157,9 @@ (define* (call-with-connection-error-handling uri proc)
                    (system-error-errno `(system-error ,@args)))))
        #f)
       (('gnutls-error error proc . rest)
-       (if (eq? error error/premature-termination)
+       (if (memq error (list error/premature-termination
+                             error/pull-error
+                             error/push-error))
            (begin
              (warning (G_ "~a: TLS connection failed: in ~a: ~a~%") host
                       proc (error->string error))

base-commit: 8e5094497ccb187d712bb3dfcddb87c6be5698f7
-- 
2.48.1