GNU bug report logs

#50238 [PATCH] build-self: Try printing nicer error messages.

PackageSource(s)Maintainer(s)
guix-patches PTS Buildd Popcon
Full log

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

Received: (at submit) by debbugs.gnu.org; 28 Aug 2021 14:37:14 +0000
From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 28 10:37:14 2021
Received: from localhost ([127.0.0.1]:54788 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1mJzSL-0002io-QZ
	for submit@debbugs.gnu.org; Sat, 28 Aug 2021 10:37:14 -0400
Received: from lists.gnu.org ([209.51.188.17]:45428)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@telenet.be>) id 1mJzSI-0002if-LZ
 for submit@debbugs.gnu.org; Sat, 28 Aug 2021 10:37:12 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:58844)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maximedevos@telenet.be>)
 id 1mJzSH-0001i0-S0
 for guix-patches@gnu.org; Sat, 28 Aug 2021 10:37:10 -0400
Received: from xavier.telenet-ops.be ([2a02:1800:120:4::f00:14]:42074)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <maximedevos@telenet.be>)
 id 1mJzSE-0004Xa-JX
 for guix-patches@gnu.org; Sat, 28 Aug 2021 10:37:09 -0400
Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be
 ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d])
 by xavier.telenet-ops.be with bizsmtp
 id n2d02500V0mfAB4012d1lQ; Sat, 28 Aug 2021 16:37:01 +0200
Message-ID: <b8eaa03230227033135d919aaafe76ad5af1eefc.camel@telenet.be>
Subject: [PATCH] build-self: Try printing nicer error messages.
From: Maxime Devos <maximedevos@telenet.be>
To: guix-patches@gnu.org
Date: Sat, 28 Aug 2021 16:36:48 +0200
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-YRO8J64N9O7W9hPfMPEj"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21;
 t=1630161421; bh=iUQSjfCL0Hqqm/ussyTUSoqilmna9aLxbXo50F/BM9Y=;
 h=Subject:From:To:Date;
 b=ak8B3JZPQS4oHGtbRyKHJ2MOsLfYLkzZnkHItwQfqF1zuBxW20trCwJxNrPbPutVl
 qkI4RIM2GyqFg2qJRr74MI8vQFQszSAOTOqWfNPwcSrI3V0cPfIWMwPWlK/vH1wGZF
 kM28JiJ3kMnIhfpmX5IzM/6Dmgos3qpB5plmNiJmmBmd/uwuRU/EEb6mR6WFdW2RFL
 LchMxCfEHFfMpkPV620AE7QpLfuJ/O9FdaYIypYUT2kzYaEtptO8ERIWcqhIfeg5YU
 6sMy4jRFF/Zg7rIPOgBFn7LWi3k9uO/kKl7FNSciCuxPWh32qmajno3z7qmEwWwpq9
 0MyyExnJvrjAQ==
Received-SPF: pass client-ip=2a02:1800:120:4::f00:14;
 envelope-from=maximedevos@telenet.be; helo=xavier.telenet-ops.be
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit@debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-Spam-Score: -2.3 (--)
[Message part 1 (text/plain, inline)]
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
[0001-build-self-Try-printing-nicer-error-messages.patch (text/x-patch, inline)]
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

[signature.asc (application/pgp-signature, inline)]

Send a report that this bug log contains spam.


debbugs.gnu.org maintainers <help-debbugs@gnu.org>. Last modified: Sun Dec 22 16:28:02 2024; Machine Name: wallace-server

GNU bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.