guix-commits
[Top][All Lists]
Advanced

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

01/03: system: <boot-parameters> does not use "/dev" device names.


From: Ludovic Courtès
Subject: 01/03: system: <boot-parameters> does not use "/dev" device names.
Date: Thu, 21 Sep 2017 18:10:01 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit db4e8fd5d4a07d3be8ce68fb96722ef7077c0eee
Author: Ludovic Courtès <address@hidden>
Date:   Thu Sep 21 22:30:59 2017 +0200

    system: <boot-parameters> does not use "/dev" device names.
    
    Fixes <https://bugs.gnu.org/28445>.
    Reported by Mark H Weaver and Roel Janssen.
    
    * gnu/system.scm (read-boot-parameters)[ensure-not-/dev]: New procedure.
    Use it.
---
 gnu/system.scm | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index b6c087a..8ab4801 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -243,6 +243,11 @@ directly by the user."
       ((? string? device)
        device)))
 
+  (define (ensure-not-/dev device)
+    (if (and (string? device) (string-prefix? "/" device))
+        #f
+        device))
+
   (match (read port)
     (('boot-parameters ('version 0)
                        ('label label) ('root-device root)
@@ -277,17 +282,16 @@ directly by the user."
           file)))
 
       (store-device
-       (match (assq 'store rest)
-         (('store ('device #f) _ ...)
-          root-device)
-         (('store ('device device) _ ...)
-          (device-sexp->device device))
-         (_                                       ;the old format
-          ;; Root might be a device path like "/dev/sda1", which is not a
-          ;; suitable GRUB device identifier.
-          (if (string-prefix? "/" root)
-              #f
-              root))))
+       ;; Linux device names like "/dev/sda1" are not suitable GRUB device
+       ;; identifiers, so we just filter them out.
+       (ensure-not-/dev
+        (match (assq 'store rest)
+          (('store ('device #f) _ ...)
+           root-device)
+          (('store ('device device) _ ...)
+           (device-sexp->device device))
+          (_                                      ;the old format
+           root-device))))
 
       (store-mount-point
        (match (assq 'store rest)



reply via email to

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