From unknown Fri Jun 20 07:24:20 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#40016 <40016@debbugs.gnu.org> To: bug#40016 <40016@debbugs.gnu.org> Subject: Status: [PATCH] inferior: Distinguish inferior exceptions. Reply-To: bug#40016 <40016@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:24:20 +0000 retitle 40016 [PATCH] inferior: Distinguish inferior exceptions. reassign 40016 guix-patches submitter 40016 Ludovic Court=C3=A8s severity 40016 normal tag 40016 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 10 12:03:26 2020 Received: (at submit) by debbugs.gnu.org; 10 Mar 2020 16:03:26 +0000 Received: from localhost ([127.0.0.1]:53156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBhLp-0003ZF-QD for submit@debbugs.gnu.org; Tue, 10 Mar 2020 12:03:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:58072) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBhLn-0003Z5-LY for submit@debbugs.gnu.org; Tue, 10 Mar 2020 12:03:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43650) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBhLl-0008Ft-GK for guix-patches@gnu.org; Tue, 10 Mar 2020 12:03:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_40, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jBhLi-0006CV-MZ; Tue, 10 Mar 2020 12:03:19 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=59682 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jBhLf-0006c0-Fv; Tue, 10 Mar 2020 12:03:16 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH] inferior: Distinguish inferior exceptions. Date: Tue, 10 Mar 2020 17:03:05 +0100 Message-Id: <20200310160305.15865-1-ludo@gnu.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= , Christopher Baines X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This avoids ambiguities when looking at a backtrace where the exception was actually thrown by an inferior in a very different context. * guix/inferior.scm (&inferior-exception): New condition type. (read-repl-response): Add optional 'inferior' parameter. Raise '&inferior-exception' instead of rethrowing to KEY when receiving an 'exception' message. (read-inferior-response): Pass INFERIOR to 'read-repl-response'. * tests/inferior.scm ("&inferior-exception"): New test. --- guix/inferior.scm | 21 +++++++++++++++++---- tests/inferior.scm | 13 ++++++++++++- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/guix/inferior.scm b/guix/inferior.scm index 0236fb61ad..6b685ece30 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -63,6 +63,9 @@ inferior-eval inferior-eval-with-store inferior-object? + inferior-exception? + inferior-exception-arguments + inferior-exception-inferior read-repl-response inferior-packages @@ -195,8 +198,15 @@ equivalent. Return #f if the inferior could not be launched." (set-record-type-printer! write-inferior-object) -(define (read-repl-response port) - "Read a (guix repl) response from PORT and return it as a Scheme object." +;; Reified exception thrown by an inferior. +(define-condition-type &inferior-exception &error + inferior-exception? + (arguments inferior-exception-arguments) ;key + arguments + (inferior inferior-exception-inferior)) ; | #f + +(define* (read-repl-response port #:optional inferior) + "Read a (guix repl) response from PORT and return it as a Scheme object. +Raise '&inferior-exception' when an exception is read from PORT." (define sexp->object (match-lambda (('value value) @@ -208,10 +218,13 @@ equivalent. Return #f if the inferior could not be launched." (('values objects ...) (apply values (map sexp->object objects))) (('exception key objects ...) - (apply throw key (map sexp->object objects))))) + (raise (condition (&inferior-exception + (arguments (cons key (map sexp->object objects))) + (inferior inferior))))))) (define (read-inferior-response inferior) - (read-repl-response (inferior-socket inferior))) + (read-repl-response (inferior-socket inferior) + inferior)) (define (send-inferior-request exp inferior) (write exp (inferior-socket inferior)) diff --git a/tests/inferior.scm b/tests/inferior.scm index f54b6d6037..b4417d8629 100644 --- a/tests/inferior.scm +++ b/tests/inferior.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018, 2019 Ludovic Courtès +;;; Copyright © 2018, 2019, 2020 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -61,6 +61,17 @@ (close-inferior inferior) (list a (inferior-object? b)))))) +(test-equal "&inferior-exception" + '(a b c d) + (let ((inferior (open-inferior %top-builddir + #:command "scripts/guix"))) + (guard (c ((inferior-exception? c) + (close-inferior inferior) + (and (eq? inferior (inferior-exception-inferior c)) + (inferior-exception-arguments c)))) + (inferior-eval '(throw 'a 'b 'c 'd) inferior) + 'badness))) + (test-equal "inferior-packages" (take (sort (fold-packages (lambda (package lst) (cons (list (package-name package) -- 2.25.1 From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 10 13:30:57 2020 Received: (at 40016) by debbugs.gnu.org; 10 Mar 2020 17:30:57 +0000 Received: from localhost ([127.0.0.1]:53246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBiiX-0006H4-21 for submit@debbugs.gnu.org; Tue, 10 Mar 2020 13:30:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48837) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBiiW-0006CD-6T for 40016@debbugs.gnu.org; Tue, 10 Mar 2020 13:30:56 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jBiiQ-0000No-R5; Tue, 10 Mar 2020 13:30:50 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=59742 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jBiiP-00076M-Ke; Tue, 10 Mar 2020 13:30:50 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 40016@debbugs.gnu.org Subject: Re: [bug#40016] [PATCH] inferior: Distinguish inferior exceptions. References: <20200310160305.15865-1-ludo@gnu.org> Date: Tue, 10 Mar 2020 18:30:48 +0100 In-Reply-To: <20200310160305.15865-1-ludo@gnu.org> ("Ludovic \=\?utf-8\?Q\?Cou\?\= \=\?utf-8\?Q\?rt\=C3\=A8s\=22's\?\= message of "Tue, 10 Mar 2020 17:03:05 +0100") Message-ID: <878sk8t8vr.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40016 Cc: Christopher Baines X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, Ludovic Court=C3=A8s skribis: > This avoids ambiguities when looking at a backtrace where the exception > was actually thrown by an inferior in a very different context. The idea was suggested at the Guix Days by someone who had had a hard time looking at one of these weird backtraces, until you realize the exception was actually thrown by another process. There are a few places in the Data Service that do things like: (catch 'misc-error (lambda () (inferior-eval =E2=80=A6)) =E2=80=A6) This will have to be adjusted. Does that work for you, Chris? If you want to go fancy, you can implement a compatibility later, though I=E2=80=99m not sure it=E2=80=99s worth it. Eventually I=E2=80=99d like =E2=80=98&inferior-exception=E2=80=99 to includ= e inferior stack frames, though that=E2=80=99ll require changes to the REPL protocol. Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 10 20:09:37 2020 Received: (at 40016) by debbugs.gnu.org; 11 Mar 2020 00:09:37 +0000 Received: from localhost ([127.0.0.1]:53473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBowL-0000Sr-2Y for submit@debbugs.gnu.org; Tue, 10 Mar 2020 20:09:37 -0400 Received: from mira.cbaines.net ([212.71.252.8]:58410) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBowJ-0000Sj-3i for 40016@debbugs.gnu.org; Tue, 10 Mar 2020 20:09:35 -0400 Received: from localhost (unknown [46.237.160.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 22F5327BBE4; Wed, 11 Mar 2020 00:09:34 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 8f2f3995; Wed, 11 Mar 2020 00:09:31 +0000 (UTC) References: <20200310160305.15865-1-ludo@gnu.org> <878sk8t8vr.fsf@gnu.org> User-agent: mu4e 1.2.0; emacs 26.3 From: Christopher Baines To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#40016] [PATCH] inferior: Distinguish inferior exceptions. In-reply-to: <878sk8t8vr.fsf@gnu.org> Date: Wed, 11 Mar 2020 00:09:29 +0000 Message-ID: <8736afeoqu.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40016 Cc: 40016@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Ludovic Court=C3=A8s skribis: > >> This avoids ambiguities when looking at a backtrace where the exception >> was actually thrown by an inferior in a very different context. > > The idea was suggested at the Guix Days by someone who had had a hard > time looking at one of these weird backtraces, until you realize the > exception was actually thrown by another process. > > There are a few places in the Data Service that do things like: > > (catch 'misc-error > (lambda () > (inferior-eval =E2=80=A6)) > =E2=80=A6) > > This will have to be adjusted. Does that work for you, Chris? Yeah that sounds fine. Generally I think it's good to keep backwards compatibility with the Guix Data Service, so I'd be looking to support both ways exceptions can be raised, but that doesn't seem to difficult. Thanks, Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl5oLDlfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE 9XeGDg/+M+zUb1k+1Cg+aYN2c0PPMp7QUWyNoFlK0lpGwkQK6G6TPbqRPrOfAudj +5R9aAG/rjemcknUsghN0rdbmDOkz0DxV+NHfFS5X9G3dHNqocDpSqJcYkQ8P4GB 9b0Nt+17Jht+4D0e40v7N9OTjINO/b+bqFvaSQU34kp5HcKOtFDFZpiVgcY2bHOZ 7YWvDImPJP2m0TdoTHyyA1DC4EYq7nCKSc1CudIC9uI2fcENHuK8QohK6M6M9Jd3 ExFzZEA0mZYAm4fXXKjqNd7o4Xsra2gmST/jW4I9ymUIepYa15szu5e6rRjUSc/q O19+gyenEPHV0qg7JxTEv74pDo8JubJIE+hWvstGehAFEh0V4XiQxixdCyDylH32 CiXgQHIgJ4ph//FECO6dT7yBndjgAa6WqjPAoIJtCds6740OEANPJM2dy7PISU6R PTfGbCvl+mK/Vr6yjI9KxP4KC4tuvsTuhRUE6Se7qJrc9r177soFYfolMLjlwctR QVyGNF6vZ5jl9G4TLaLUlNfMm6UGfgmgy8KI0Me4s+ekfG77FxN8nbLbrQP2y9mj 6AxcLlbwUC7EQzYU43+2OnsO38zCemB8RaQuansVRnbaIc5clUG/CGi7+NDZ+c41 8IX88CURP/q1TlZUF2+S2KMSUDNGIt59qp+Ba8qLea6Ea4JLuw8= =Mv+m -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 11 09:54:36 2020 Received: (at 40016) by debbugs.gnu.org; 11 Mar 2020 13:54:36 +0000 Received: from localhost ([127.0.0.1]:53803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jC1oi-0005Gs-2V for submit@debbugs.gnu.org; Wed, 11 Mar 2020 09:54:36 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jC1og-0005Gf-6f for 40016@debbugs.gnu.org; Wed, 11 Mar 2020 09:54:34 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jC1oa-00052C-Qb; Wed, 11 Mar 2020 09:54:28 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=37926 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jC1oW-00036W-4G; Wed, 11 Mar 2020 09:54:26 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Christopher Baines Subject: Re: [bug#40016] [PATCH] inferior: Distinguish inferior exceptions. References: <20200310160305.15865-1-ludo@gnu.org> <878sk8t8vr.fsf@gnu.org> <8736afeoqu.fsf@cbaines.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 22 =?utf-8?Q?Vent=C3=B4se?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Wed, 11 Mar 2020 14:54:22 +0100 In-Reply-To: <8736afeoqu.fsf@cbaines.net> (Christopher Baines's message of "Wed, 11 Mar 2020 00:09:29 +0000") Message-ID: <87mu8nj8tt.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40016 Cc: 40016@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi! Christopher Baines skribis: > Ludovic Court=C3=A8s writes: > >> Ludovic Court=C3=A8s skribis: >> >>> This avoids ambiguities when looking at a backtrace where the exception >>> was actually thrown by an inferior in a very different context. >> >> The idea was suggested at the Guix Days by someone who had had a hard >> time looking at one of these weird backtraces, until you realize the >> exception was actually thrown by another process. >> >> There are a few places in the Data Service that do things like: >> >> (catch 'misc-error >> (lambda () >> (inferior-eval =E2=80=A6)) >> =E2=80=A6) >> >> This will have to be adjusted. Does that work for you, Chris? > > Yeah that sounds fine. Good. > Generally I think it's good to keep backwards compatibility with the > Guix Data Service, so I'd be looking to support both ways exceptions > can be raised, but that doesn't seem to difficult. Yes. Though you=E2=80=99ll also have to handle Guile 3.0 vs. 2.2 exception types, in particular wrt. SRFI-34 exceptions (see Guix commit 7f3bbfaf8ec3b96e02e0cf74e7515ac33c002107.) Thanks for your feedback, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 12 08:43:52 2020 Received: (at 40016-done) by debbugs.gnu.org; 12 Mar 2020 12:43:52 +0000 Received: from localhost ([127.0.0.1]:56144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCNBn-0001Gk-Ud for submit@debbugs.gnu.org; Thu, 12 Mar 2020 08:43:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCNBl-0001GT-Vp for 40016-done@debbugs.gnu.org; Thu, 12 Mar 2020 08:43:50 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jCNBg-0001v3-NS; Thu, 12 Mar 2020 08:43:44 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=49172 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jCNBf-0006V8-Qc; Thu, 12 Mar 2020 08:43:44 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 40016-done@debbugs.gnu.org Subject: Re: [bug#40016] [PATCH] inferior: Distinguish inferior exceptions. References: <20200310160305.15865-1-ludo@gnu.org> Date: Thu, 12 Mar 2020 13:43:41 +0100 In-Reply-To: <20200310160305.15865-1-ludo@gnu.org> ("Ludovic \=\?utf-8\?Q\?Cou\?\= \=\?utf-8\?Q\?rt\=C3\=A8s\=22's\?\= message of "Tue, 10 Mar 2020 17:03:05 +0100") Message-ID: <87ftedvj42.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40016-done Cc: Christopher Baines X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Ludovic Court=C3=A8s skribis: > This avoids ambiguities when looking at a backtrace where the exception > was actually thrown by an inferior in a very different context. > > * guix/inferior.scm (&inferior-exception): New condition type. > (read-repl-response): Add optional 'inferior' parameter. Raise > '&inferior-exception' instead of rethrowing to KEY when receiving an > 'exception' message. > (read-inferior-response): Pass INFERIOR to 'read-repl-response'. > * tests/inferior.scm ("&inferior-exception"): New test. Pushed as f7537e30b892cef09d91902547c00e5fa9b66f3b. Ludo=E2=80=99. From unknown Fri Jun 20 07:24:20 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 10 Apr 2020 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator