guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#55407] [PATCH] system: Improve warning when using LUKS mapped devic


From: Ludovic Courtès
Subject: [bug#55407] [PATCH] system: Improve warning when using LUKS mapped devices without UUIDs.
Date: Wed, 18 May 2022 22:44:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi!

Maxim Cournoyer <maxim.cournoyer@gmail.com> 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 ‘mlambdaq’ so that OS is compared with ‘eq?’, 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 ‘let’ 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 …"))

Given that we have location info, it might be better to report one
warning per device?

Last, hints should be reported either with ‘display-hint’ or with a
‘&fix-hint’ 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!

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]