From debbugs-submit-bounces@debbugs.gnu.org Sat May 14 02:05:52 2022 Received: (at submit) by debbugs.gnu.org; 14 May 2022 06:05:52 +0000 Received: from localhost ([127.0.0.1]:45580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npkuW-0001bS-Gi for submit@debbugs.gnu.org; Sat, 14 May 2022 02:05:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:56974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npkuS-0001bE-2i for submit@debbugs.gnu.org; Sat, 14 May 2022 02:05:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npkuM-0005uT-0x for guix-patches@gnu.org; Sat, 14 May 2022 02:05:47 -0400 Received: from mail-qt1-x82d.google.com ([2607:f8b0:4864:20::82d]:36542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npkuJ-0007Dp-0E for guix-patches@gnu.org; Sat, 14 May 2022 02:05:40 -0400 Received: by mail-qt1-x82d.google.com with SMTP id v14so7604874qtc.3 for ; Fri, 13 May 2022 23:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Et6KGkarKqbelUod9AZhAePCxLxcXkKuc3NzZyP+ElQ=; b=dC8RXhGMpdKbqdKsxQ7dVJ3Zgp+glduFrMstJHoOVpBDr7JvYGK7Lzlx9Wxi1+ewCn r9OjuNZC6FnV0HJVSwwyvai//X7BmidrBg/WkffU5i7xDvIQVBWB0Mp2YfRnlm8VIdrv nlNQH1eEgcEYtT9G1W7N+JeWitytuHBSfbM6D+q7buD/S3lhqutVP3KPczAbnDneRxdG 9e9lJEm0JZZPHTdz2g4yQeTPD3bvU1hW/mAhlQILm+RYo5Okx2MEtL0/BsHdhf0Z81hq LPgFszb+d4sMecTQmuLWrX0uJuEazmhSe/PR7ozIKd4VCq9rwPg00P6h166PhlqmxtnY K7mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Et6KGkarKqbelUod9AZhAePCxLxcXkKuc3NzZyP+ElQ=; b=he230viZg6zCRqy6cznYMcrfUu1KVFsFZxSItjNIgeNOM9aNmB/fgw7U1NMARidxoZ l4VfBs4fDXxaNCa8liVcAAEdkf0EDKBdbwQpVHL/vRrNJ7q05032xIwEsu/ALtsf42Qq dk3x4EWX7tf0adQ82ALY9xM10f+CmEovDTQl3kh8JK173Ct2Mw1gWF+LNJhU/sz4rZOJ S+Cqvyisb3XhlAzyc04JtUAM3ogfXc2fn5VddMKzcStmxakKWjbQtCm55aBNBeLmSJ+A 2ll+0G1A2fuASXgW1Pz7BBJYIF88+a+jVhzLvsRzNncaVJjHuU7h9YLnUBy9uHIRsB7P SwtQ== X-Gm-Message-State: AOAM530q8bQXzxocPM0sSOvLNBRAhO97VHJN+1lDc34beTfyzQ/l4n0k ovXlig8n+v9X614n5sbxlCvZBWWnwSGPfw== X-Google-Smtp-Source: ABdhPJxoJs3YvQMakAgdzyW496wG1O2hPTLVAAwHEnj0DpUdR2LMlBp3ERG4gIMsPTQAdRPEDNjI5g== X-Received: by 2002:a05:622a:13cf:b0:2f3:d843:1a4d with SMTP id p15-20020a05622a13cf00b002f3d8431a4dmr7573921qtk.609.1652508337872; Fri, 13 May 2022 23:05:37 -0700 (PDT) Received: from localhost.localdomain (dsl-149-239.b2b2c.ca. [66.158.149.239]) by smtp.gmail.com with ESMTPSA id h26-20020ac8777a000000b002f39b99f68csm2604675qtu.38.2022.05.13.23.05.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 23:05:37 -0700 (PDT) From: Maxim Cournoyer To: guix-patches@gnu.org Subject: [PATCH] system: Improve warning when using LUKS mapped devices without UUIDs. Date: Sat, 14 May 2022 02:05:32 -0400 Message-Id: <20220514060532.1011-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::82d; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x82d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: Maxim Cournoyer 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: -2.3 (--) This corrects two problems with the previous mapped devices warning: 1. It wasn't clear how to correct the situation. 2. The output would be repeated twice, as the procedure is called twice during a system reconfigure. * gnu/system.scm (operating-system-bootloader-crypto-devices): Memoize procedure. Produce a single message for the combined problematic devices. Add a hint to help users fix the warning. --- gnu/system.scm | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index c3810cbeeb..b090eeae01 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -33,6 +33,7 @@ (define-module (gnu system) #:use-module (guix inferior) #:use-module (guix store) + #:use-module (guix memoization) #:use-module (guix monads) #:use-module (guix gexp) #:use-module (guix records) @@ -78,7 +79,9 @@ (define-module (gnu system) #:use-module (gnu system uuid) #:use-module (gnu system file-systems) #:use-module (gnu system mapped-devices) + #:use-module (ice-9 format) #:use-module (ice-9 match) + #:use-module (ice-9 receive) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) @@ -600,25 +603,26 @@ (define (operating-system-boot-mapped-devices os) (any file-system-needed-for-boot? users))) devices))) -(define (operating-system-bootloader-crypto-devices os) - "Return the subset of mapped devices that the bootloader must open. -Only devices specified by uuid are supported." - (define (valid-crypto-device? dev) - (or (uuid? dev) - (begin - (warning (G_ "\ -mapped-device '~a' may not be mounted by the bootloader.~%") - dev) - #f))) - (filter-map (match-lambda - ((and (= mapped-device-type type) - (= mapped-device-source source)) - (and (eq? luks-device-mapping type) - (valid-crypto-device? source) - source)) - (_ #f)) - ;; XXX: Ordering is important, we trust the returned one. - (operating-system-boot-mapped-devices os))) +(define operating-system-bootloader-crypto-devices + (mlambda (os) ;to avoid duplicated output + "Return the sources of the LUKS mapped devices specified by UUID." + ;; XXX: Device ordering is important, we trust the returned one. + (let ((luks-devices (filter (lambda (m) + (eq? luks-device-mapping + (mapped-device-type m))) + (operating-system-boot-mapped-devices os)))) + (receive (uuid-crypto-devices non-uuid-crypto-devices) + (partition (compose uuid? mapped-device-source) luks-devices) + (when (not (null? non-uuid-crypto-devices)) + (warning (N_ "\ +the following mapped device may not be mounted by the bootloader: ~s +hint: specify the mapped device source via its LUKS UUID.~%" + "\ +the following mapped devices may not be mounted by the bootloader: ~s +hint: specify the mapped device sources via their LUKS UUID.~%" + (length non-uuid-crypto-devices)) + (map mapped-device-source non-uuid-crypto-devices))) + (map mapped-device-source uuid-crypto-devices))))) (define (device-mapping-services os) "Return the list of device-mapping services for OS as a list." -- 2.36.0 From debbugs-submit-bounces@debbugs.gnu.org Wed May 18 16:45:07 2022 Received: (at 55407) by debbugs.gnu.org; 18 May 2022 20:45:08 +0000 Received: from localhost ([127.0.0.1]:33736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nrQXb-00044M-HK for submit@debbugs.gnu.org; Wed, 18 May 2022 16:45:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nrQXZ-00043X-I1 for 55407@debbugs.gnu.org; Wed, 18 May 2022 16:45:06 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrQXU-0001yg-58; Wed, 18 May 2022 16:45:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=ah6cdjFy/+jLac22KR5mtbK1Q70H+Hj1XR/yo7a8k54=; b=M60Edqn5/s2OBBk02p5T GciQfjOm3Dsc4RPAncG+BM45xHFpbaBeY6XvaxD+9uLTitzcRcZ4n6X/1eSUJwDbVFspFx1HI/YN5 TvnyFc3ELuGdxh2RfJUMzbrshJA7ymEL6UQKerNYLmB4/FWSQ7MD/oMAQgR8IMxE2RttZbGC0UPLX 82LTOSyFrTuloj7JAaqfCwHghakuslfUZEtTtz8ZByqY9pVO66cPvkdD6Wo6VyE68DZHmeSVA7aRE RKXxyuSbL14hWjDCFfKVtob58nM+G8kYgHGdwDOnjUj4SI4FTQda6kIpF4KsZLJe05KORe7v8V7WC dV2+UYNnz62C6A==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=49376 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrQXT-0002Sy-PK; Wed, 18 May 2022 16:44:59 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxim Cournoyer Subject: Re: bug#55407: [PATCH] system: Improve warning when using LUKS mapped devices without UUIDs. References: <20220514060532.1011-1-maxim.cournoyer@gmail.com> Date: Wed, 18 May 2022 22:44:57 +0200 In-Reply-To: <20220514060532.1011-1-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Sat, 14 May 2022 02:05:32 -0400") Message-ID: <87ee0q1sfq.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 55407 Cc: 55407@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: -3.3 (---) Hi! Maxim Cournoyer skribis: > This corrects two problems with the previous mapped devices warning: > > 1. It wasn't clear how to correct the situation. > 2. The output would be repeated twice, as the procedure is called > twice during a system reconfigure. > > * gnu/system.scm (operating-system-bootloader-crypto-devices): Memoize > procedure. Produce a single message for the combined problematic devices. > Add a hint to help users fix the warning. [...] > +(define operating-system-bootloader-crypto-devices > + (mlambda (os) ;to avoid duplicated output Should be =E2=80=98mlambdaq=E2=80=99 so that OS is compared with =E2=80=98e= q?=E2=80=99, which is cheaper and better corresponds to what we want to achieve here. > + (receive (uuid-crypto-devices non-uuid-crypto-devices) > + (partition (compose uuid? mapped-device-source) luks-devices) I suggest using =E2=80=98let=E2=80=99 from (srfi srfi-71) for consistency. > + (when (not (null? non-uuid-crypto-devices)) > + (warning (N_ "\ > +the following mapped device may not be mounted by the bootloader: ~s > +hint: specify the mapped device source via its LUKS UUID.~%" > + "\ > +the following mapped devices may not be mounted by the bootloader: ~s > +hint: specify the mapped device sources via their LUKS UUID.~%" > + (length non-uuid-crypto-devices)) > + (map mapped-device-source non-uuid-crypto-devices))) By convention, warnings should fit on a single line and not be full sentences. If we emit one warning per mapped device, we can report the source location using: (warning (mapped-device-location dev) (G_ "mapped device =E2=80=A6")) Given that we have location info, it might be better to report one warning per device? Last, hints should be reported either with =E2=80=98display-hint=E2=80=99 o= r with a =E2=80=98&fix-hint=E2=80=99 exception. The hint itself can be one or two p= aragraphs using Texinfo markup. All this should ensure consistent diagnostic reporting. I hope this makes sense! Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat May 21 00:17:34 2022 Received: (at 55407-done) by debbugs.gnu.org; 21 May 2022 04:17:34 +0000 Received: from localhost ([127.0.0.1]:40481 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsGYX-0000sA-Rr for submit@debbugs.gnu.org; Sat, 21 May 2022 00:17:34 -0400 Received: from mail-qk1-f170.google.com ([209.85.222.170]:40953) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsGYW-0000rv-4Z for 55407-done@debbugs.gnu.org; Sat, 21 May 2022 00:17:32 -0400 Received: by mail-qk1-f170.google.com with SMTP id b200so274795qkc.7 for <55407-done@debbugs.gnu.org>; Fri, 20 May 2022 21:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=RVqaRMtFtsI4IdS1IxJ/HRr021H4xdGlOqxl/0KQ4UM=; b=pQlBIXmE23mmKgTM3CZwMU+j46p0+qDqO44BHX7g6Slu5epvwd8nJIQm1mH5YGkIXE Q/2q+5U2ihERNmQFJKXc+0Nv8wF7q2bS2GHRESW6yaEIAbAXpP5rH05X1Bstbrb/cLtQ C2U+BM+BcoS6jzIARSflCLRE3jm9r/pJEHFE+aV0J5yqWWezyK94cE11VCKAnSYaizXB bLyGImPyKBEZFfqEVJsjK7yOWF3jciUj67Xd/sKwQURKDip5jZFx0Vshgh6QbS3Y3qct zvvLh5FXAMZe7zJSDogVP8JCknkf+xG/mWdqSV2YvcoG68rXoDUVS8HTwKDqBu0HTKAk 5oOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=RVqaRMtFtsI4IdS1IxJ/HRr021H4xdGlOqxl/0KQ4UM=; b=4wZveZr4husNReJgjlgX7TFi/X7myzyU7CnglsYeVlRD7rju7aWQssqs/pd0uZ84TH Y0A5Me3YCvT5NcBJWFbmh0Qa3TeF380Guw6Y0qckGBO6uGqVg9hsVtc1t71FaefvxNkN rvecLBP5A5Ed8ymVVuIUWTEa/ISPdd0CGPKm9V10lh4jnC8/x/kjHRfJGzsjwzsCPdw0 UdqF2kirukIDotkOd4A3E5dRgk/w0KdxwN9nDVUFzVa67KJko+81Bk78scsxe2Z9UUAS RDgDLV9WObe1Ot+IG2I6bfMTCo+Cwf+d0jCTXKQ2OzS35lU+E0VjpOb+QUaDthsPiPoD 98xQ== X-Gm-Message-State: AOAM531krHR3LUdU2b4AOqHkem9dfZDOacnBr09Nv4tK5ENv4etRwwb+ +UUG4OgcP42qdC7Ma18rfOD/7iJ5Ntl56A== X-Google-Smtp-Source: ABdhPJzqUltjnguWfBq8rBeqJNgMrjk8KgqWCZgS2GgX5UnIzcR9zkSdWFhyvAJ8ssc5bgnD+mufRw== X-Received: by 2002:a05:620a:400b:b0:6a0:fe03:8053 with SMTP id h11-20020a05620a400b00b006a0fe038053mr8429633qko.674.1653106646326; Fri, 20 May 2022 21:17:26 -0700 (PDT) Received: from hurd (dsl-10-148-238.b2b2c.ca. [72.10.148.238]) by smtp.gmail.com with ESMTPSA id f194-20020a379ccb000000b006a349bfcb02sm846682qke.41.2022.05.20.21.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 May 2022 21:17:25 -0700 (PDT) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#55407: [PATCH] system: Improve warning when using LUKS mapped devices without UUIDs. References: <20220514060532.1011-1-maxim.cournoyer@gmail.com> <87ee0q1sfq.fsf@gnu.org> Date: Sat, 21 May 2022 00:17:25 -0400 In-Reply-To: <87ee0q1sfq.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Wed, 18 May 2022 22:44:57 +0200") Message-ID: <87o7zrbju2.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55407-done Cc: 55407-done@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 (-) Hi, Ludovic Court=C3=A8s writes: > Hi! > > Maxim Cournoyer skribis: > >> This corrects two problems with the previous mapped devices warning: >> >> 1. It wasn't clear how to correct the situation. >> 2. The output would be repeated twice, as the procedure is called >> twice during a system reconfigure. >> >> * gnu/system.scm (operating-system-bootloader-crypto-devices): Memoize >> procedure. Produce a single message for the combined problematic device= s. >> Add a hint to help users fix the warning. > > [...] > >> +(define operating-system-bootloader-crypto-devices >> + (mlambda (os) ;to avoid duplicated output > > Should be =E2=80=98mlambdaq=E2=80=99 so that OS is compared with =E2=80= =98eq?=E2=80=99, which is cheaper > and better corresponds to what we want to achieve here. Done. >> + (receive (uuid-crypto-devices non-uuid-crypto-devices) >> + (partition (compose uuid? mapped-device-source) luks-devices) > > I suggest using =E2=80=98let=E2=80=99 from (srfi srfi-71) for consistency. Done. >> + (when (not (null? non-uuid-crypto-devices)) >> + (warning (N_ "\ >> +the following mapped device may not be mounted by the bootloader: ~s >> +hint: specify the mapped device source via its LUKS UUID.~%" >> + "\ >> +the following mapped devices may not be mounted by the bootloader: ~s >> +hint: specify the mapped device sources via their LUKS UUID.~%" >> + (length non-uuid-crypto-devices)) >> + (map mapped-device-source non-uuid-crypto-devices))) > > By convention, warnings should fit on a single line and not be full > sentences. This is a Guix-specific convention, right? I couldn't find a reference to it in the GNU Standards (info standards) document. I'd be more of the thinking that warnings directed at *users* should be as human readable as possible; the motivation for my fix was because that for more than a year, I read that warning without having clue about what it really meant and had to review the source to get the answer. > If we emit one warning per mapped device, we can report the source > location using: > > (warning (mapped-device-location dev) (G_ "mapped device =E2=80=A6")) > > Given that we have location info, it might be better to report one > warning per device? Done! > Last, hints should be reported either with =E2=80=98display-hint=E2=80=99= or with a > =E2=80=98&fix-hint=E2=80=99 exception. The hint itself can be one or two= paragraphs > using Texinfo markup. > > All this should ensure consistent diagnostic reporting. > > I hope this makes sense! It does. I didn't know about warning accepting the location like that, and I thought hints were only usable via conditions, so I've learned a couple new things here. With the following changes: --8<---------------cut here---------------start------------->8--- modified gnu/system.scm @@ -43,6 +43,7 @@ (define-module (gnu system) #:use-module ((guix utils) #:select (substitute-keyword-arguments)) #:use-module (guix i18n) #:use-module (guix diagnostics) + #:use-module (guix ui) #:use-module (gnu packages admin) #:use-module (gnu packages base) #:use-module (gnu packages bash) @@ -81,11 +82,11 @@ (define-module (gnu system) #:use-module (gnu system mapped-devices) #:use-module (ice-9 format) #:use-module (ice-9 match) - #:use-module (ice-9 receive) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) + #:use-module (srfi srfi-71) #:use-module (rnrs bytevectors) #:export (operating-system operating-system? @@ -604,25 +605,25 @@ (define (operating-system-boot-mapped-devices os) devices))) (define operating-system-bootloader-crypto-devices - (mlambda (os) ;to avoid duplicated output + (mlambdaq (os) ;to avoid duplicated output "Return the sources of the LUKS mapped devices specified by UUID." ;; XXX: Device ordering is important, we trust the returned one. - (let ((luks-devices (filter (lambda (m) - (eq? luks-device-mapping - (mapped-device-type m))) - (operating-system-boot-mapped-devices os))= )) - (receive (uuid-crypto-devices non-uuid-crypto-devices) - (partition (compose uuid? mapped-device-source) luks-devices) - (when (not (null? non-uuid-crypto-devices)) - (warning (N_ "\ -the following mapped device may not be mounted by the bootloader: ~s -hint: specify the mapped device source via its LUKS UUID.~%" - "\ -the following mapped devices may not be mounted by the bootloader: ~s -hint: specify the mapped device sources via their LUKS UUID.~%" - (length non-uuid-crypto-devices)) - (map mapped-device-source non-uuid-crypto-devices))) - (map mapped-device-source uuid-crypto-devices))))) + (let* ((luks-devices (filter (lambda (m) + (eq? luks-device-mapping + (mapped-device-type m))) + (operating-system-boot-mapped-devices os)= )) + (uuid-crypto-devices non-uuid-crypto-devices + (partition (compose uuid? mapped-device-so= urce) + luks-devices))) + (when (not (null? non-uuid-crypto-devices)) + (for-each (lambda (dev) + (warning + (source-properties->location (mapped-device-location = dev)) + (G_ "mapped device '~a' may be ignored by bootloader~= %") + (mapped-device-source dev))) + non-uuid-crypto-devices) + (display-hint "Specify mapped device sources via their LUKS UUID."= )) + (map mapped-device-source uuid-crypto-devices)))) (define (device-mapping-services os) "Return the list of device-mapping services for OS as a list." --8<---------------cut here---------------end--------------->8--- It produced this output: --8<---------------cut here---------------start------------->8--- /home/maxim/stow/guix/hurd.scm:109:8: warning: mapped device '/dev/sda2' ma= y be ignored by bootloader /home/maxim/stow/guix/hurd.scm:113:8: warning: mapped device '/dev/sdb2' ma= y be ignored by bootloader /home/maxim/stow/guix/hurd.scm:117:8: warning: mapped device '/dev/sdc2' ma= y be ignored by bootloader hint: Specify mapped device sources via their LUKS UUID. updating checkout of 'file:///home/maxim/src/mcron'... retrieved commit a233aab1b6770bece7538cda8381df824b7560b6 --8<---------------cut here---------------end--------------->8--- which compares favorably to before the change: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix system reconfigure ~/stow/guix/hurd.scm guix system: warning: mapped-device '/dev/sda2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sdb2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sdc2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sda2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sdb2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sdc2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sda2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sdb2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sdc2' may not be mounted by the b= ootloader. updating checkout of 'file:///home/maxim/src/mcron'... retrieved commit a233aab1b6770bece7538cda8381df824b7560b6 guix system: warning: mapped-device '/dev/sda2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sdb2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sdc2' may not be mounted by the b= ootloader. updating checkout of 'file:///home/maxim/src/mcron'... retrieved commit a233aab1b6770bece7538cda8381df824b7560b6 substitute: updating substitutes from 'http://127.0.0.1:8181'... 100.0% [...] activating system... guix system: warning: mapped-device '/dev/sda2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sdb2' may not be mounted by the b= ootloader. guix system: warning: mapped-device '/dev/sdc2' may not be mounted by the b= ootloader. [...] --8<---------------cut here---------------end--------------->8--- Pushed as 39a9404c99. Thanks for the useful comments! Maxim From debbugs-submit-bounces@debbugs.gnu.org Sat May 21 12:46:14 2022 Received: (at 55407-done) by debbugs.gnu.org; 21 May 2022 16:46:14 +0000 Received: from localhost ([127.0.0.1]:42860 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsSF3-0006Tr-T3 for submit@debbugs.gnu.org; Sat, 21 May 2022 12:46:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsSF0-0006M9-NF for 55407-done@debbugs.gnu.org; Sat, 21 May 2022 12:46:12 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54226) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsSEv-00006I-D3; Sat, 21 May 2022 12:46:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=H+LL2vRwkQJNnhVWrG9x6cg6WKxaTGl2wyU3z4Jo2DM=; b=f7UpfxyW9XcoCo82JJIf jFrWjKGw2scA8yFAzGOqVh6Z5HfUv56tXtZ6lHxaFlj/B6DHbZ1sPHl03pLXSPcSDxX8gN6ODbkYX 6I419nkVEGKn/KOPgmHUEC7sGHCy/me4uX/Yo2YmR8P2PNjbIVX71sL9iY4tkfHUxAJ8a0eFE1s7a lXJMLLmEFAzunXOJF1BKg+QfTiD6juYzqND65JGogVMQfuixPE8fzptHkayTc5vGvN+UuyYhfWPHC s9vaL7qT0rF1uJcr00axhoU95hnKTUe4VkiBbMLyBIW0/eL5qq4MD8+6FE2GY+L8HA5o9fJOmAw6v +FLqz81yLvMFnQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:51825 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsSEv-00066w-0h; Sat, 21 May 2022 12:46:05 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxim Cournoyer Subject: Re: bug#55407: [PATCH] system: Improve warning when using LUKS mapped devices without UUIDs. References: <20220514060532.1011-1-maxim.cournoyer@gmail.com> <87ee0q1sfq.fsf@gnu.org> <87o7zrbju2.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 2 Prairial an 230 de la =?utf-8?Q?R=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: Sat, 21 May 2022 18:46:03 +0200 In-Reply-To: <87o7zrbju2.fsf@gmail.com> (Maxim Cournoyer's message of "Sat, 21 May 2022 00:17:25 -0400") Message-ID: <87h75iu94k.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 55407-done Cc: 55407-done@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: -3.3 (---) Hi! Maxim Cournoyer skribis: >>> + (warning (N_ "\ >>> +the following mapped device may not be mounted by the bootloader: ~s >>> +hint: specify the mapped device source via its LUKS UUID.~%" >>> + "\ >>> +the following mapped devices may not be mounted by the bootloader: ~s >>> +hint: specify the mapped device sources via their LUKS UUID.~%" >>> + (length non-uuid-crypto-devices)) >>> + (map mapped-device-source non-uuid-crypto-devices))) >> >> By convention, warnings should fit on a single line and not be full >> sentences. > > This is a Guix-specific convention, right? I couldn't find a reference > to it in the GNU Standards (info standards) document. It=E2=80=99s more or less the GNU convention (info "(standards) Errors"). The bit about hints is Guix-specific, but it=E2=80=99s the same idea: havin= g a consistent way to report diagnostics. > I'd be more of the thinking that warnings directed at *users* should > be as human readable as possible; the motivation for my fix was > because that for more than a year, I read that warning without having > clue about what it really meant and had to review the source to get > the answer. Yes, and I agree that=E2=80=99s a problem. Hopefully hints help address th= at. (The Elm compiler for instance is famous for having verbose diagnostics *and* hints. Perhaps something to look at and take inspiration from in the future.) > It produced this output: > > /home/maxim/stow/guix/hurd.scm:109:8: warning: mapped device '/dev/sda2' = may be ignored by bootloader > /home/maxim/stow/guix/hurd.scm:113:8: warning: mapped device '/dev/sdb2' = may be ignored by bootloader > /home/maxim/stow/guix/hurd.scm:117:8: warning: mapped device '/dev/sdc2' = may be ignored by bootloader > hint: Specify mapped device sources via their LUKS UUID. Nice. You could even add an @example block in the hint to illustrate what that means. > Pushed as 39a9404c99. Thank you! Ludo=E2=80=99. From unknown Sun Jun 22 11:37:27 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 19 Jun 2022 11:24:05 +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