bug-guix
[Top][All Lists]
Advanced

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

bug#28445: match-error in 'device-sexp->device' while building system


From: Ludovic Courtès
Subject: bug#28445: match-error in 'device-sexp->device' while building system
Date: Mon, 18 Sep 2017 23:34:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hi,

Mark H Weaver <address@hidden> skribis:

>  # Set 'root' to the partition that contains /gnu/store.
> -search --file --set 
> /gnu/store/21ngnlx9k0x9x2jj1px7mdlb4j6mzz6x-grub-2.02/share/grub/unicode.pf2
> +search --label --set /dev/mapper/jojen-root

Oops.  I believe the patch below does the trick (‘store-device’ must
never be a Linux device name, and that’s what the patch ensures.)

Thoughts?

(I didn’t notice these issues because I identify my root file system by
label or UUID rather than hard-coding its /dev/mapper name.)

Ludo’.

diff --git a/gnu/system.scm b/gnu/system.scm
index d337e5259..d71b9c15b 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,15 +282,16 @@ directly by the user."
           file)))
 
       (store-device
-       (match (assq 'store rest)
-         (('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))))
+       ;; ROOT might be a device path like "/dev/sda1", which is not a
+       ;; suitable GRUB device identifier.
+       (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)
@@ -906,6 +912,7 @@ device in a <menu-entry>."
   (case (file-system-title fs)
     ((uuid) (file-system-device fs))
     ((label) (file-system-device fs))
+    ((device) (file-system-device fs))
     (else #f)))
 
 (define (operating-system-boot-parameters os system.drv root-device)


reply via email to

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