Subject: bug#55911: closed (Re: bug#55911: [PATCH] channels: Print backtrace when generating package cache fails.)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 16 Jun 2022 09:11:02 +0000

Your bug report

#55911: [PATCH] channels: Print backtrace when generating package cache fails.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
55911: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55911
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#55911: [PATCH] channels: Print backtrace when generating package cache fails.
From: Ludovic Courtès <[email-masked]>
To: Josselin Poiret <[email-masked]>
Cc: [email-masked]
Date: Thu, 16 Jun 2022 11:10:49 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Josselin,

Josselin Poiret <[email-masked]> skribis:

> * guix/channels.scm (package-cache-file): Add a throw handler around
> the generate-package-cache call, and print backtrace in it.
> ---
> IRC promptly pointed out that Guix has required Guile ver>=2 since way before
> guix repl and guix pull were ever a thing, thus drop the Guile 1 compatibility
> code.  Enjoy this v2

That’s a good idea.  Applied!

Thanks for the patch and for paying attention to compatibility!

Ludo’.

Subject: [PATCH] channels: Print backtrace when generating package cache fails.
From: Josselin Poiret <[email-masked]>
To: [email-masked]
Cc: Josselin Poiret <[email-masked]>
Date: Sat, 11 Jun 2022 18:30:31 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

* guix/channels.scm (package-cache-file): Add a throw handler around
the generate-package-cache call, and print backtrace in it.
---
 guix/channels.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/guix/channels.scm b/guix/channels.scm
index 20f347d34f..e3a4daf7b3 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -911,7 +911,17 @@ (define build
                 (format (current-error-port)
                         "Generating package cache for '~a'...~%"
                         #$profile)
-                (generate-package-cache #$output))
+                ;; This script runs through (primitive-load), which by default
+                ;; doesn't print backtraces when it encounters an exception,
+                ;; so manually do it.  Use with-throw-handler because it is
+                ;; supported by all Guile versions.
+                (with-throw-handler #t
+                  (lambda () (generate-package-cache #$output))
+                  (lambda (key . args)
+                    ;; Guile 1 prints the whole backtrace, and would need a
+                    ;; fluid set for the backtrace procedure to work, so ignore.
+                    (unless (string-prefix? "1" (version))
+                      (backtrace)))))
               (mkdir #$output))))
 
     (gexp->derivation-in-inferior "guix-package-cache" build
-- 
2.36.1