From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mOWAGuTvAWNq/gAAbAwnHQ (envelope-from ) for ; Sun, 21 Aug 2022 10:42:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id KIyLGuTvAWNqyQAA9RJhRA (envelope-from ) for ; Sun, 21 Aug 2022 10:42:12 +0200 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 44D6132824 for ; Sun, 21 Aug 2022 10:42:12 +0200 (CEST) Received: from localhost ([::1]:37614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oPgX5-00015w-4D for larch@yhetil.org; Sun, 21 Aug 2022 04:42:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oPgWw-00015f-4K for bug-guix@gnu.org; Sun, 21 Aug 2022 04:42:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44033) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oPgWv-0007W6-SR for bug-guix@gnu.org; Sun, 21 Aug 2022 04:42:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oPgWv-0003Cb-PB for bug-guix@gnu.org; Sun, 21 Aug 2022 04:42:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#57307: [PATCH 1/2] bootloader: Convert device in menu-entry to proper sexp. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 21 Aug 2022 08:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57307 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Josselin Poiret , tiantian , 57307@debbugs.gnu.org Received: via spool by 57307-submit@debbugs.gnu.org id=B57307.166107128512258 (code B ref 57307); Sun, 21 Aug 2022 08:42:01 +0000 Received: (at 57307) by debbugs.gnu.org; 21 Aug 2022 08:41:25 +0000 Received: from localhost ([127.0.0.1]:33780 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oPgWL-0003Be-92 for submit@debbugs.gnu.org; Sun, 21 Aug 2022 04:41:25 -0400 Received: from jpoiret.xyz ([206.189.101.64]:53038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oPgWJ-0003BQ-7y for 57307@debbugs.gnu.org; Sun, 21 Aug 2022 04:41:23 -0400 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 00676184F2B; Sun, 21 Aug 2022 08:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1661071282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LHZCXgisq7bfIwLsnkMeA5FB1Sr08ZW9wtK+5QT/Zlk=; b=iRdxAVTdIyO8BRqMK98PS9cCdNxQ8BERMJDu6tog9cNNAQK+NCjzzkvEuuLPimD7lwGcyi V5FtK4mcceJTHH874uJALfMCKlvzz+olZg057D3G8siggfZ6Baq6lnmsrxJKbAdRNVv8xT x9aBuMWygwqReytajjKlG4J+Aq3NaZBztdfCYvr2V7r5kvSs8DAI99lnE7bCh3MMJN0xOF Enzl6k2AF/oeeM7p1Lxxr2W7M3YquyotZpaVCA5/9Zl4s7uC4I2WNkXTZsLn1f/LQThrjR k8d4YZ+MwVLwCLEuOA3KNtCC8ltZCsyzEc9UjR/1K/ALvSQVejhxZZ/Q8OxMhg== Date: Sun, 21 Aug 2022 10:41:15 +0200 Message-Id: <890dac3c17576de37837ba96a4d45d8be68eecdf.1661070933.git.dev@jpoiret.xyz> In-Reply-To: <87sflquh1o.fsf@jpoiret.xyz> References: <87sflquh1o.fsf@jpoiret.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Bar: / X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" Reply-to: Josselin Poiret From: Josselin Poiret via Bug reports for GNU Guix X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1661071332; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: 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=LHZCXgisq7bfIwLsnkMeA5FB1Sr08ZW9wtK+5QT/Zlk=; b=njL3KfxHND1keqWHTKABwingvvs5ioEIUzMJ9FkU31OvSgTMSO8O+v25FrO5OLN86zjbtu PNgMDYCOBVXookxFvt+GbQ7JQ7wAtsRcxxCGq1KTik7sUUrf4grv0+U11fxnMEhIiaxIKW Euqc1Tf7qTB9+U6qnihv/5a3MTCVdAsASOIYJCJbGxFuhdIN2m+1L1ig9Y1FAR6+GAF51R NcIDmjwRXlHqkI6xmje5Sb7kzlVVwLG65gBYckNC+oVzBPZnAQaETwBwcGFC1+IosgQNiv 8QjApQo3UG+nIdYQXATaEJxnGhI4vQvzEHaz4nywTEhmJVGMDWYi9c5xwyaoiw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661071332; a=rsa-sha256; cv=none; b=rQKJUi7n86X9XJFbBYCdb/9iV/WiRsQqhosZUrIbz3+/6+TU1MKoaXuQpB8YaBG/5smmFj hr2+2OCL7dPHgYjZNNy74c4HQ+uiI6GEglMIF+gKO1UhYG3V3OHOSCoHwKefWVzP22UZbE 6K810gIoDQH/Cv60OBKfi6xC6zBA3I5a8nTi88K5s/WtBJVQRri+iDlYYhEjBQl4UYw+JC wR/AEQS2wbxuCpsQaZ6F/KurYqrBEpsq+TNEK/c2rwZLOA9mkE11F//wAQrtbjQ1ZzKtxe reeZBnbLVVk0GtDxaMIlZHnsAJM751+w/kHYvc2xorRRRgX19rugRg7BNU2jdQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=iRdxAVTd; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 5.57 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=iRdxAVTd; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 44D6132824 X-Spam-Score: 5.57 X-Migadu-Scanner: scn0.migadu.com X-TUID: qBYHSobtGiqF Previously, menu-entry->sexp didn't try to convert `device` to a proper sexp, which was inserted directly into the boot parameters G-exp, leading to a G-exp input error. Now convert both uuid and file-system-label possibilities to sexps, and add parsing code to sexp->menu-entry. This fixes #57307. * gnu/bootloader.scm (menu-entry->sexp, sexp->menu-entry): Take non-string devices into account. --- gnu/bootloader.scm | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 9cf5457873..1f08ab170e 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -21,6 +21,8 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu bootloader) + #:use-module (gnu system file-systems) + #:use-module (gnu system uuid) #:use-module (guix discovery) #:use-module (guix gexp) #:use-module (guix profiles) @@ -105,12 +107,19 @@ (define-record-type* (define (menu-entry->sexp entry) "Return ENTRY serialized as an sexp." + (define (device->sexp device) + (match device + ((? uuid? uuid) + `(uuid ,(uuid-type uuid) ,(uuid->string uuid))) + ((? file-system-label? label) + `(label ,(file-system-label->string label))) + (_ device))) (match entry (($ label device mount-point linux linux-arguments initrd #f ()) `(menu-entry (version 0) (label ,label) - (device ,device) + (device ,(device->sexp device)) (device-mount-point ,mount-point) (linux ,linux) (linux-arguments ,linux-arguments) @@ -119,7 +128,7 @@ (define (menu-entry->sexp entry) multiboot-kernel multiboot-arguments multiboot-modules) `(menu-entry (version 0) (label ,label) - (device ,device) + (device ,(device->sexp device)) (device-mount-point ,mount-point) (multiboot-kernel ,multiboot-kernel) (multiboot-arguments ,multiboot-arguments) @@ -128,6 +137,13 @@ (define (menu-entry->sexp entry) (define (sexp->menu-entry sexp) "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a record." + (define (sexp->device device-sexp) + (match device-sexp + (('uuid type uuid-string) + (uuid uuid-string type)) + (('label label) + (file-system-label label)) + (_ device-sexp))) (match sexp (('menu-entry ('version 0) ('label label) ('device device) @@ -136,7 +152,7 @@ (define (sexp->menu-entry sexp) ('initrd initrd) _ ...) (menu-entry (label label) - (device device) + (device (sexp->device device)) (device-mount-point mount-point) (linux linux) (linux-arguments linux-arguments) @@ -149,7 +165,7 @@ (define (sexp->menu-entry sexp) ('multiboot-modules multiboot-modules) _ ...) (menu-entry (label label) - (device device) + (device (sexp->device device)) (device-mount-point mount-point) (multiboot-kernel multiboot-kernel) (multiboot-arguments multiboot-arguments) base-commit: b8f2eb286ec52c97048e23d326d94ae5772797e8 -- 2.37.1