unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#50238] [PATCH] build-self: Try printing nicer error messages.
@ 2021-08-28 14:36 Maxime Devos
  2021-09-24 11:59 ` Ludovic Courtès
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Maxime Devos @ 2021-08-28 14:36 UTC (permalink / raw)
  To: 50238


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

Hi guix,

This patch improves the error message generated by "guix time-machine"
and presumably "guix pull" as well when the guix derivation fails to
compute.

Before: something like <https://issues.guix.gnu.org/50232>.
After: something like

[...]
substitute: lijst van substitutes van ?[...]? aan het bijwerken... 100.0%
/gnu/store/4yx3vms0rfpzd1430za3g4pa6jvjsfw9-nowhere.tar.bz2.drv bouwen...
/error: build of `/gnu/store/6s0cmkfa4hq7d9w8g08mv2rhq0cr7wqc-subversion-1.14.1.drv' failed
guix time-machine: fout: You found a bug: the program '/gnu/store/j07lizpjf7v65shdgxyxddz171g6vjvx-compute-guix-derivation'
failed to compute the derivation for Guix (version: "9fc551e089c25f510f918a2c52917ba4e842f1c3"; system: "x86_64-linux";
host version: "75a3413b4e5c1f7443eb944a36ff364f4c4085f4"; pull-version: 1).
Please report it by email to <bug-guix@gnu.org

To test, apply the patch, and introduce an error in the hash of subversion:

;;; (gnu packages version-control)
(define-public subversion
  (package
    (name "subversion")
    (version "1.14.1")
    (source (origin
             (method url-fetch)
             ;; Oops!
             (uri "http://localhost/nowhere.tar.bz2")
             #;(string-append "mirror://apache/subversion/"
                                 "subversion-" version ".tar.bz2")
             (sha256
              (base32
               ;; Oops! 1->0
               #;"1ag1hvcm9q92kgalzbbgcsq9clxnzmbj9nciz9lmabjx4lyajp9c"
               "0ag1hvcm9q92kgalzbbgcsq9clxnzmbj9nciz9lmabjx4lyajp9c"))))
    (build-system gnu-build-system)
    [...]

and commit that mistake.  Then run
  guix time-machine --branch=master --url=$PWD --disable-authentication

Repeat without the error in subversion.

Greetings,
Maxime

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

From 9dbcd5cedeb861c27aec2b41fcbe6aba92de6c2e 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'.
---
 build-aux/build-self.scm | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index f100ff4aae..1dbaf52061 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))))
 

base-commit: b4d132f98e03fae559db832e88897f1e166c4d47
prerequisite-patch-id: 91a26ba19372112a11a0eea2b066d2f63641deb1
-- 
2.33.0


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

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

end of thread, other threads:[~2022-08-13 19:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [bug#50238] [PATCH v2] build-self: Try printing nicer error messages Maxime Devos
2022-03-27 20:17   ` 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

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).