summary refs log tree commit diff
path: root/gnu/system/mapped-devices.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-06-14 23:30:59 +0200
committerLudovic Courtès <ludo@gnu.org>2018-06-14 23:34:59 +0200
commit411959bef30b488928ab2418a064c8a9b0347c41 (patch)
tree6641ed02d27175437ba749b545a9285e594ebd18 /gnu/system/mapped-devices.scm
parenta9a685cc0024a4e0dad5d7abd9ca6fb880ae4f8e (diff)
downloadguix-411959bef30b488928ab2418a064c8a9b0347c41.tar.gz
linux-initrd: Module check correctly handles hyphen vs. underscore.
Fixes <https://bugs.gnu.org/31714>.
Reported by Vagrant Cascadian <vagrant@debian.org>
and Florian Pelz <pelzflorian@pelzflorian.de>.

* gnu/system/mapped-devices.scm (check-device-initrd-modules): Pass
LINUX-MODULES through 'normalize-module-name'.
* gnu/build/linux-modules.scm (normalize-module-name): Export.
Diffstat (limited to 'gnu/system/mapped-devices.scm')
-rw-r--r--gnu/system/mapped-devices.scm16
1 files changed, 11 insertions, 5 deletions
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index a2cca0a93b..c452bdd894 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -32,7 +32,8 @@
   #:use-module (gnu system uuid)
   #:autoload   (gnu build file-systems) (find-partition-by-luks-uuid)
   #:autoload   (gnu build linux-modules)
-                 (device-module-aliases matching-modules known-module-aliases)
+                 (device-module-aliases matching-modules known-module-aliases
+                  normalize-module-name)
   #:autoload   (gnu packages cryptsetup) (cryptsetup-static)
   #:autoload   (gnu packages linux) (mdadm-static)
   #:use-module (srfi srfi-1)
@@ -127,10 +128,15 @@ DEVICE must be a \"/dev\" file name."
       (const #f)))
 
   (when aliases
-    (let ((modules (delete-duplicates
-                    (append-map (cut matching-modules <> aliases)
-                                (device-module-aliases device)))))
-      (unless (every (cute member <> linux-modules) modules)
+    (let ((modules  (delete-duplicates
+                     (append-map (cut matching-modules <> aliases)
+                                 (device-module-aliases device))))
+
+          ;; Module names (not file names) are supposed to use underscores
+          ;; instead of hyphens.  MODULES is a list of module names, whereas
+          ;; LINUX-MODULES is file names without '.ko', so normalize them.
+          (provided (map normalize-module-name linux-modules)))
+      (unless (every (cut member <> provided) modules)
         (raise (condition
                 (&message
                  (message (format #f (G_ "you may need these modules \