Subject: [bug#55407] [PATCH] system: Improve warning when using LUKS mapped devices without UUIDs.

From: Ludovic Courtès <[email-masked]>
Date: Sat, 21 May 2022 18:46:03 +0200

Hi!

Maxim Cournoyer <[email-masked]> 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’s more or less the GNU convention (info "(standards) Errors").

The bit about hints is Guix-specific, but it’s the same idea: having 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’s a problem.  Hopefully hints help address that.

(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’.