unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#55911] [PATCH] channels: Print backtrace when generating package cache fails.
@ 2022-06-11 16:30 Josselin Poiret via Guix-patches via
  2022-06-11 16:59 ` [bug#55911] [PATCH v2] " Josselin Poiret via Guix-patches via
  0 siblings, 1 reply; 3+ messages in thread
From: Josselin Poiret via Guix-patches via @ 2022-06-11 16:30 UTC (permalink / raw)
  To: 55911; +Cc: Josselin Poiret

* 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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#55911] [PATCH v2] channels: Print backtrace when generating package cache fails.
  2022-06-11 16:30 [bug#55911] [PATCH] channels: Print backtrace when generating package cache fails Josselin Poiret via Guix-patches via
@ 2022-06-11 16:59 ` Josselin Poiret via Guix-patches via
  2022-06-16  9:10   ` bug#55911: [PATCH] " Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Josselin Poiret via Guix-patches via @ 2022-06-11 16:59 UTC (permalink / raw)
  To: Josselin Poiret; +Cc: 55911

* 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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#55911: [PATCH] channels: Print backtrace when generating package cache fails.
  2022-06-11 16:59 ` [bug#55911] [PATCH v2] " Josselin Poiret via Guix-patches via
@ 2022-06-16  9:10   ` Ludovic Courtès
  0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2022-06-16  9:10 UTC (permalink / raw)
  To: Josselin Poiret; +Cc: 55911-done

Hi Josselin,

Josselin Poiret <dev@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’.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-16  9:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11 16:30 [bug#55911] [PATCH] channels: Print backtrace when generating package cache fails Josselin Poiret via Guix-patches via
2022-06-11 16:59 ` [bug#55911] [PATCH v2] " Josselin Poiret via Guix-patches via
2022-06-16  9:10   ` bug#55911: [PATCH] " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).