GNU bug report logs - #55911
[PATCH] channels: Print backtrace when generating package cache fails.

Previous Next

Package: guix-patches;

Reported by: Josselin Poiret <dev <at> jpoiret.xyz>

Date: Sat, 11 Jun 2022 16:31:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55911 in the body.
You can then email your comments to 55911 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#55911; Package guix-patches. (Sat, 11 Jun 2022 16:31:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Josselin Poiret <dev <at> jpoiret.xyz>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 11 Jun 2022 16:31:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Josselin Poiret <dev <at> jpoiret.xyz>
To: guix-patches <at> gnu.org
Cc: Josselin Poiret <dev <at> jpoiret.xyz>
Subject: [PATCH] channels: Print backtrace when generating package cache fails.
Date: Sat, 11 Jun 2022 18:30:31 +0200
* 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





Information forwarded to guix-patches <at> gnu.org:
bug#55911; Package guix-patches. (Sat, 11 Jun 2022 17:00:02 GMT) Full text and rfc822 format available.

Message #8 received at 55911 <at> debbugs.gnu.org (full text, mbox):

From: Josselin Poiret <dev <at> jpoiret.xyz>
To: Josselin Poiret <dev <at> jpoiret.xyz>
Cc: 55911 <at> debbugs.gnu.org
Subject: [PATCH v2] channels: Print backtrace when generating package cache
 fails.
Date: Sat, 11 Jun 2022 18:59:38 +0200
* 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

Best,
Josselin
 guix/channels.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/channels.scm b/guix/channels.scm
index 20f347d34f..fde425327d 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -911,7 +911,14 @@ (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)
+                      (backtrace))))
               (mkdir #$output))))
 
     (gexp->derivation-in-inferior "guix-package-cache" build
-- 
2.36.1





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 16 Jun 2022 09:11:02 GMT) Full text and rfc822 format available.

Notification sent to Josselin Poiret <dev <at> jpoiret.xyz>:
bug acknowledged by developer. (Thu, 16 Jun 2022 09:11:02 GMT) Full text and rfc822 format available.

Message #13 received at 55911-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Josselin Poiret <dev <at> jpoiret.xyz>
Cc: 55911-done <at> debbugs.gnu.org
Subject: Re: bug#55911: [PATCH] channels: Print backtrace when generating
 package cache fails.
Date: Thu, 16 Jun 2022 11:10:49 +0200
Hi Josselin,

Josselin Poiret <dev <at> jpoiret.xyz> 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’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 14 Jul 2022 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 286 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.