bug-guix
[Top][All Lists]
Advanced

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

bug#70051: [PATCH] gnu: open-luks-device: Fix unbound variables.


From: aurtzy
Subject: bug#70051: [PATCH] gnu: open-luks-device: Fix unbound variables.
Date: Tue, 2 Apr 2024 02:23:29 -0400

It seems like `use-modules' never actually worked due to the way it is eval'd
by the Shepherd, and was only apparent after a change that prevented other
module imports from leaking into the namespace.  This is fixed by using direct
references instead.

* gnu/system/mapped-devices.scm (open-luks-device): Use direct references for
variables from other modules.

Fixes: https://issues.guix.gnu.org/70051

Change-Id: I993798e161c4b4fca6e8a4f14eea5042b184ebc9
---

Hi!

I encountered this issue as well, and think I've figured out what was
happening: `use-modules' appears to not work due to the way g-expressions are
evaluated by Shepherd, so after services became properly isolated in their own
modules, the variable references became no longer available.  There's a
comment further down in the file that seems to confirm this ("XXX: We're not
at the top level here...").

Can anyone confirm this patch works for them too?

Cheers,

aurtzy

 gnu/system/mapped-devices.scm | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index c19a818453..e46e2c7954 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -201,14 +201,12 @@ (define* (open-luks-device source targets #:key key-file)
        #~(let ((source #$(if (uuid? source)
                              (uuid-bytevector source)
                              source))
-               (keyfile #$key-file))
-           ;; XXX: 'use-modules' should be at the top level.
-           (use-modules (rnrs bytevectors) ;bytevector?
-                        ((gnu build file-systems)
-                         #:select (find-partition-by-luks-uuid
-                                   system*/tty))
-                        ((guix build utils) #:select (mkdir-p)))
-
+               (keyfile #$key-file)
+               (bytevector? (@ (rnrs bytevectors) bytevector?))
+               (find-partition-by-luks-uuid (@ (gnu build file-systems)
+                                               find-partition-by-luks-uuid))
+               (system*/tty (@ (gnu build file-systems) system*/tty))
+               (mkdir-p (@ (guix build utils) mkdir-p)))
            ;; Create '/run/cryptsetup/' if it does not exist, as device locking
            ;; is mandatory for LUKS2.
            (mkdir-p "/run/cryptsetup/")

base-commit: 6e2db85ca83528199a46b002d2592bd4bef017c8
-- 
2.41.0






reply via email to

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