unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: 28445@debbugs.gnu.org
Subject: bug#28445: match-error in 'device-sexp->device' while building system
Date: Mon, 18 Sep 2017 23:34:26 +0200	[thread overview]
Message-ID: <87shfjelnh.fsf@gnu.org> (raw)
In-Reply-To: <877ewvj4ph.fsf@netris.org> (Mark H. Weaver's message of "Mon, 18 Sep 2017 13:29:14 -0400")

[-- Attachment #1: Type: text/plain, Size: 570 bytes --]

Hi,

Mark H Weaver <mhw@netris.org> 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’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1705 bytes --]

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	other threads:[~2017-09-18 21:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 14:41 bug#28445: match-error in 'device-sexp->device' while building system Mark H Weaver
2017-09-13 15:37 ` Marius Bakke
2017-09-13 21:24   ` Mark H Weaver
2017-09-13 23:53     ` Mark H Weaver
2017-09-14  6:03       ` Mark H Weaver
2017-09-17 19:51     ` Ludovic Courtès
2017-09-18 17:29       ` Mark H Weaver
2017-09-18 21:34         ` Ludovic Courtès [this message]
2017-09-20 21:27           ` Ludovic Courtès
2017-10-04 17:39             ` Mark H Weaver
2017-10-06 22:22               ` Ludovic Courtès
2017-09-13 18:32 ` Mark H Weaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shfjelnh.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=28445@debbugs.gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).