Subject: Re: bug#66014: Unable to use UUIDs to construct RAID array in mapped-devices

From: Csepp <[email-masked]>
Date: Tue, 19 Sep 2023 12:48:34 +0200

Ludovic Courtès <[email-masked]> writes:

> Hi,
>
> Csepp <[email-masked]> skribis:
>
>> Lars Rustand <[email-masked]> writes:
>
> [...]
>
>>> But this one fails:
>>>
>>>   (mapped-devices
>>>     (list
>>>       (mapped-device
>>>         (source (list (uuid "a07c54da-eb61-4135-86b8-8791e863e46a") (uuid "c40026af-ace9-47fc-9d3f-4b8d6a2219cb")))
>>>         (target "/dev/md0")
>>>         (type raid-device-mapping))))
>>>
>>> The error message I get is guix system: error: #<<uuid> type: dce bv: #vu8(160 124 84 218 235 97 65 53 134 184 135 145 232 99 228 106)>: invalid G-expression input
>>>
>>> [[End of PGP Signed Part]]
>>
>> Would it be possible to use /dev/disk/by-uuid paths instead of uuid
>> objects for these?
>
> Depends: /dev/disk/by-uuid is populated by eudev, which is not running
> at the time initrd code runs; IOW it’s OK to use /dev/disk/by-uuid if
> and only if the mapped device is not “needed for boot”.
>
>> I think this big "typeof" based dynamic dispatch that we're using in
>> Scheme is erm, not very robust, to put it mildly.
>
> Yeah, it’s not great.  What would you suggest?
>
> Ludo’.

I guess MyPy-for-Guile is a bit out of scope for now, so the next best
way to catch these would be property based testing.
As for implementing them, can't we use Guile's generics, or model
something on Clojure's generics?  Something that lets client code add
implementations to an interface.  Although that might have some security
implications.