all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: 50238@debbugs.gnu.org
Subject: [bug#50238] [PATCH v2] build-self: Try printing nicer error messages
Date: Tue, 22 Mar 2022 23:24:02 +0100	[thread overview]
Message-ID: <ef71cec4d9915f8a1b1dff6d08af7c444fc20caa.camel@telenet.be> (raw)
In-Reply-To: <b8eaa03230227033135d919aaafe76ad5af1eefc.camel@telenet.be>


[-- Attachment #1.1: Type: text/plain, Size: 193 bytes --]

The revised patch allows time travelling from v1.1.0 to
(master + patch), by not always setting #:unwind?.  Next step: test
some older versions (v1.0.0, v0.2?, ...?)?

Greetings,
Maxime.

[-- Attachment #1.2: 0001-build-self-Try-printing-nicer-error-messages.patch --]
[-- Type: text/x-patch, Size: 5089 bytes --]

From 78d8f1c69f39103f23e72f438f23a708d5388a77 Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximedevos@telenet.be>
Date: Sat, 28 Aug 2021 14:42:32 +0200
Subject: [PATCH] build-self: Try printing nicer error messages.

This prevents daunting backtraces like in
<https://issues.guix.gnu.org/50232> by only printing
the relevant information: that 'subversion' fails to
build.

* build-aux/self.scm (build-program): Wrap the 'run-with-store'
  in a 'with-error-handling'.
* guix/ui.scm (guard*): Don't explode on old Guiles.
---
 build-aux/build-self.scm | 23 +++++++++++++++--------
 guix/ui.scm              | 16 +++++++++++-----
 2 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index 02822a2ee8..25a7b1e618 100644
--- a/build-aux/build-self.scm
+++ b/build-aux/build-self.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -280,6 +281,7 @@ interface (FFI) of Guile.")
 
                            ,@(source-module-closure `((guix store)
                                                       (guix self)
+                                                      (guix ui)
                                                       (guix derivations)
                                                       (gnu packages bootstrap))
                                                     (list source)
@@ -316,6 +318,7 @@ interface (FFI) of Guile.")
                         (read-disable 'positions))
 
                       (use-modules (guix store)
+                                   (guix ui)
                                    (guix self)
                                    (guix derivations)
                                    (srfi srfi-1))
@@ -347,14 +350,18 @@ interface (FFI) of Guile.")
                              (parameterize ((current-warning-port
                                              (%make-void-port "w"))
                                             (current-build-output-port sock))
-                               (run-with-store store
-                                 (guix-derivation source version
-                                                  #$guile-version
-                                                  #:channel-metadata
-                                                  '#$channel-metadata
-                                                  #:pull-version
-                                                  #$pull-version)
-                                 #:system system))
+                               ;; Use 'with-error-handling' to prevent scary
+                               ;; backtraced like
+                               ;; <https://issues.guix.gnu.org/50232>.
+                               (with-error-handling
+                                 (run-with-store store
+                                   (guix-derivation source version
+                                                    #$guile-version
+                                                    #:channel-metadata
+                                                    '#$channel-metadata
+                                                    #:pull-version
+                                                    #$pull-version)
+                                   #:system system)))
                              derivation-file-name))))))
                   #:module-path (list source))))
 
diff --git a/guix/ui.scm b/guix/ui.scm
index 238952723e..0afe75bbad 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2018 Steve Sprang <scs@stevesprang.com>
+;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -677,11 +678,16 @@ or remove one of them from the profile.")
 (define-syntax-rule (guard* (var clauses ...) exp ...)
   "This variant of SRFI-34 'guard' does not unwind the stack before
 evaluating the tests and bodies of CLAUSES."
-  (with-exception-handler
-      (lambda (var)
-        (cond clauses ... (else (raise var))))
-    (lambda () exp ...)
-    #:unwind? #f))
+  (apply with-exception-handler
+         (lambda (var)
+           (cond clauses ... (else (raise var))))
+         (lambda () exp ...)
+         ;; Some old Guiles used by old versions of Guix don't support
+         ;; #:unwind.  Avoid breaking "guix pull" from an old Guix to
+         ;; a new Guix, see <https://issues.guix.gnu.org/50238>.
+         (if (>= (string->number (major-version)) 3)
+             '(#:unwind? #f)
+             '())))
 
 (define (call-with-error-handling thunk)
   "Call THUNK within a user-friendly error handler."

base-commit: 29091731a0c6cb649cdfd72297575fe2bb2a9591
prerequisite-patch-id: e2faf5cdf72f293aca0aff5c89cc1f0dd874d29c
-- 
2.30.2


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  parent reply	other threads:[~2022-03-22 22:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-28 14:36 [bug#50238] [PATCH] build-self: Try printing nicer error messages Maxime Devos
2021-09-24 11:59 ` Ludovic Courtès
2022-03-08 19:22   ` zimoun
2022-03-09 13:18     ` Maxime Devos
2022-03-08 18:58 ` Maxime Devos
2022-03-19  9:13 ` [bug#50238] [PATCH] build-self: Try printing nicer error messages --- verifying if it doesn't break anything Maxime Devos
2022-03-22 20:46   ` Maxime Devos
2022-03-22 20:55     ` Maxime Devos
2022-03-22 20:57     ` Maxime Devos
2022-03-22 22:24 ` Maxime Devos [this message]
2022-03-27 20:17   ` [bug#50238] [PATCH v2] build-self: Try printing nicer error messages Maxime Devos
2022-05-06 12:48 ` [bug#50238] [PATCH] " Maxime Devos
2022-06-13  2:03 ` Maxime Devos
2022-07-09 20:39 ` [bug#50238] Bug in compute-guix-derivation Maxime Devos via Guix-patches
2022-07-30 11:18 ` [bug#50238] [PATCH] build-self: Try printing nicer error messages Maxime Devos
2022-08-13 19:38 ` Maxime Devos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef71cec4d9915f8a1b1dff6d08af7c444fc20caa.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=50238@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.