From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uLrGKvONxWO5iwAAbAwnHQ (envelope-from ) for ; Mon, 16 Jan 2023 18:48:35 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id ILkBKvONxWNRFgAAG6o9tA (envelope-from ) for ; Mon, 16 Jan 2023 18:48:35 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6433C3B1FD for ; Mon, 16 Jan 2023 18:48:35 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHTaF-00028u-4p; Mon, 16 Jan 2023 12:47:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHTZg-0001YN-FF for guix-patches@gnu.org; Mon, 16 Jan 2023 12:47:17 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pHTZW-0006wG-QP for guix-patches@gnu.org; Mon, 16 Jan 2023 12:47:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHTZW-0008KA-Mr for guix-patches@gnu.org; Mon, 16 Jan 2023 12:47:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60802] [PATCH v2 1/2] platforms: Raise an exception when no suitable platform is found. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 16 Jan 2023 17:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Tobias Geerinckx-Rice , Josselin Poiret , 60802@debbugs.gnu.org, Simon Tournier , Mathieu Othacehe , Christopher Baines , Ricardo Wurmus Received: via spool by 60802-submit@debbugs.gnu.org id=B60802.167389119931955 (code B ref 60802); Mon, 16 Jan 2023 17:47:02 +0000 Received: (at 60802) by debbugs.gnu.org; 16 Jan 2023 17:46:39 +0000 Received: from localhost ([127.0.0.1]:34643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHTZ9-0008JL-6K for submit@debbugs.gnu.org; Mon, 16 Jan 2023 12:46:39 -0500 Received: from mail-qt1-f172.google.com ([209.85.160.172]:40825) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHTZ6-0008J5-SS for 60802@debbugs.gnu.org; Mon, 16 Jan 2023 12:46:38 -0500 Received: by mail-qt1-f172.google.com with SMTP id jr10so17915535qtb.7 for <60802@debbugs.gnu.org>; Mon, 16 Jan 2023 09:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=XFmwjEK4+OElQ+LVTVC2hN2O4HDCDijbVdb/IWN+Dk0=; b=jql/Y5MOMpTiyuCLZpqmjfHqQirsbl2c++0X8Hk6ljlW9CAPpWxCmfGZF5OT9r+Akb v3Y/RFwKbWqv241VSLaVk1bnOhL/TZWzkDhIZ7D7ve0uqhDN3fzoCpRdPWqVh1sKkT6y 09heiTGKw3hhW+Qwi3Ds3yjpRH4cJdHl5hgN1FrYcTSLh5ij7PC8NZiYjfhleJWR9BWt aZ3okdb8q33kMeKsheuploclnsO0/KPimYH0c3eqJzZfoOnocHvYpGbbI9P75FOUOsoM H1UI2s7y8m1Z+5X1TS3WOdm+HrSBIK6FiSt+wTOy9avn79SsZZCxZ2SMne/kWqD9FSz/ tNdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XFmwjEK4+OElQ+LVTVC2hN2O4HDCDijbVdb/IWN+Dk0=; b=oes9k4ok49YnpmqqjQg4BVb29QL31P3nMjRvTFTb/Au1jiciDvZ9lqc0GWtBVmdujx MTPEAYhYbVVUrKn7ZD/aO5vqmqz7PXWOyDhhXe4mG3y0pPAbGiolpeCrXLdTqPOXeVSl 44diW7zXFMHwMYDUOKYcI7ZmRfqnNf8FhimV9VSJ35SZr7amUGbIxoOkpbjUyGPRN3uI um2PG3ZcGZjfKuNtOSON4NEkqrPbuEJu9QuGK7n0HUfKVkVpR+p5ZUV80NFqehlhpwID 24a5cmePyvT48+FMQBN4+UwcdmZjg9YZn8SWzNRfso0MMlbu10K1ajayK8jOSHafnAmY b/qQ== X-Gm-Message-State: AFqh2kobbVsRn8b9m920G2Mmajnwqf5GoBMzxI42gvfhMCJNXUiqGjxB 1/jkw5rg+u0d8+7Oj6C3wyk= X-Google-Smtp-Source: AMrXdXvmadEeXKaOxB2xQfeAZpTzRYKuviLYyLb/+OzF5fssxJLE3Q0ns7SzjkySAl9Is52NGzpbRA== X-Received: by 2002:ac8:4913:0:b0:3b6:3ac8:22ec with SMTP id e19-20020ac84913000000b003b63ac822ecmr1150744qtq.14.1673891191380; Mon, 16 Jan 2023 09:46:31 -0800 (PST) Received: from hurd (dsl-10-130-209.b2b2c.ca. [72.10.130.209]) by smtp.gmail.com with ESMTPSA id fp8-20020a05622a508800b003b6343a12adsm1260524qtb.90.2023.01.16.09.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 09:46:31 -0800 (PST) From: Maxim Cournoyer References: <20230114041903.7121-2-maxim.cournoyer@gmail.com> <87o7r19ocn.fsf@gnu.org> Date: Mon, 16 Jan 2023 12:46:29 -0500 In-Reply-To: <87o7r19ocn.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Sat, 14 Jan 2023 15:34:32 +0100") Message-ID: <87mt6i5q4q.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1673891315; a=rsa-sha256; cv=none; b=pRPHw0uwUjfSpmXMHe20kfVSPoWHD7lFaBiAy9x7/mjWcHL5M0AyY0J6IsJADm7unOcnWk zrW/xHuuCD8n6/ECsPT6lMRGmeBl7cS4YegeprRbf6WoVhQPrrJzpi6S+6fzGUl80+9Ivu CLDxggx2OwCrqSMpnOinSFabmqV/5R2T+i91RHZRYro6YV6FoL306OfzP2IZ2lPiibkBJR rYvutDDkh2HA0iJt+sgaWAJ7VrlM2etqrarGcSouddijwubTAg6apMoTMCPXT9yl0+MBQ1 RWae3JTtKCLN8PowdiwVJihuwc4IOvdZu7yyMAefIa3oxzwHAesT9a/c2GmzLQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="jql/Y5MO"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673891315; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=XFmwjEK4+OElQ+LVTVC2hN2O4HDCDijbVdb/IWN+Dk0=; b=fNEgLz8EBVTz9kqQM10jFV0/bnrZ0LdXmUJ+pgAdsJUQjiFmpZbZM1kvlr4O8A2C1CBysN 2x+azvFqMwb5SmdjkG4e8gTZSRNMOZHpaGUJXHGX+Y32CaMiErk/GOzvWeb+CSVLtf2CDs Ryzv2oewoLbIwr3lRRCbJQTRkgT7CyTPjtWqA0SYob2dUNilctuvcGYSh3oP7vB6LDVwAu TV22RVs0Jcb4NVkBK3n/fIvfA5mDlNRKeI/LwL7x32sv8jyGrMa5X2CNg7qoe8aWEl20Gi z+EFV1FTV1WP8JB+ff8Y7cWgAyjyZ7D5EPOvwL7qi0c0eIkLpuTpnrq7IBSDYw== X-Migadu-Spam-Score: 0.97 X-Spam-Score: 0.97 X-Migadu-Queue-Id: 6433C3B1FD X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="jql/Y5MO"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) X-TUID: zj0DpfVHk2qx Hi Ludovic, Ludovic Court=C3=A8s writes: > Hi, > > Maxim Cournoyer skribis: > >> This was motivated by #60786, which produced a cryptic, hard to understa= nd >> backtrace. >> >> * guix/platform.scm (&platform-not-found-error): New exception type. >> (make-platform-not-found-error): New exception constructor. >> (platform-not-found-error?): New predicate. >> (false-if-platform-not-found): New syntax. >> (lookup-platform-by-system): Raise an exception when no platform is foun= d. >> Update documentation. >> (lookup-platform-by-target): Likewise. >> (lookup-platform-by-target-or-system): Likewise, and guard lookup calls = with >> false-if-platform-not-found. > > Sounds like a good idea! Good! >> +++ b/gnu/packages/bootstrap.scm >> @@ -315,7 +315,7 @@ (define* (glibc-dynamic-linker >> (%current-system)))) >> "Return the name of Glibc's dynamic linker for SYSTEM." >> ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc. >> - (let ((platform (lookup-platform-by-system system))) >> + (let ((platform (false-if-exception (lookup-platform-by-system system= )))) > > Maybe we don=E2=80=99t need to protect here, because it=E2=80=99s a We cannot do this, otherwise the other cond clauses would never been evaluated: --8<---------------cut here---------------start------------->8--- (let ((platform (false-if-exception (lookup-platform-by-system system)))) (cond ((platform? platform) (platform-glibc-dynamic-linker platform)) --> Clauses below here are evaluated when platform was not found. ;; TODO: Define those as platforms. ((string=3D? system "i686-gnu") "/lib/ld.so.1") ((string=3D? system "powerpc64-linux") "/lib/ld64.so.1") ((string=3D? system "alpha-linux") "/lib/ld-linux.so.2") ;; XXX: This one is used bare-bones, without a libc, so add a case ;; here just so we can keep going. ((string=3D? system "arm-elf") "no-ld.so") ((string=3D? system "arm-eabi") "no-ld.so") ((string=3D? system "xtensa-elf") "no-ld.so") ((string=3D? system "avr") "no-ld.so") ((string=3D? system "propeller-elf") "no-ld.so") ((string=3D? system "i686-mingw") "no-ld.so") ((string=3D? system "x86_64-mingw") "no-ld.so") ((string=3D? system "vc4-elf") "no-ld.so") (else (error "dynamic linker name not known for this system" system)))) --8<---------------cut here---------------end--------------->8--- I'll change it to use false-if-platform-not-found though. >> +++ b/guix/platform.scm >> @@ -21,6 +21,7 @@ (define-module (guix platform) >> #:use-module (guix memoization) >> #:use-module (guix records) >> #:use-module (guix ui) >> + #:use-module (ice-9 exceptions) > > So far the we use (srfi srfi-35) exclusively to define condition types; > I think we should do the same here, for consistency. Could we instead start migrating away from srfi-35 to (ice-9 exceptions), which is the new native way to use exceptions in Guile? I think it'd be nicer to use it in the future, to avoid newcomers being confusing about the 3 or 4 ways to manage exceptions in Guile (recommended read on the topic: https://vijaymarupudi.com/blog/2022-02-13-error-handling-in-guile.html). Migrating the whole code at once doesn't seem a good idea, so gradually transitioning (such as using (ice-9 exceptions) for new code) appears a good idea to me, if we agree on the direction! >> + &platform-not-found-error >> + make-platform-not-found-error > > The constructor doesn=E2=80=99t need to be exposed. Good point. Fixed in the latest revision. --=20 Thanks, Maxim