[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/01: system: Really filter out Linux device names for the store.
From: |
Ludovic Courtès |
Subject: |
01/01: system: Really filter out Linux device names for the store. |
Date: |
Fri, 6 Oct 2017 18:05:27 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 90d23ed9df33e35e157fecd8ab60f55e716ca42f
Author: Ludovic Courtès <address@hidden>
Date: Fri Oct 6 23:09:48 2017 +0200
system: Really filter out Linux device names for the store.
This is a followup to db4e8fd5d4a07d3be8ce68fb96722ef7077c0eee.
Fixes <https://bugs.gnu.org/28445>.
Reported by Mark H Weaver <address@hidden>.
* gnu/system.scm (ensure-not-/dev): New procedure.
(read-boot-parameters)[ensure-not-/dev]: Remove.
(operating-system-boot-parameters): Use it.
---
gnu/system.scm | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/gnu/system.scm b/gnu/system.scm
index 8ab4801..0e834ba 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -231,6 +231,14 @@ directly by the user."
(kernel-arguments boot-parameters-kernel-arguments)
(initrd boot-parameters-initrd))
+(define (ensure-not-/dev device)
+ "If DEVICE starts with a slash, return #f. This is meant to filter out
+Linux device names such as /dev/sda, and to preserve GRUB device names and
+file system labels."
+ (if (and (string? device) (string-prefix? "/" device))
+ #f
+ device))
+
(define (read-boot-parameters port)
"Read boot parameters from PORT and return the corresponding
<boot-parameters> object or #f if the format is unrecognized."
@@ -243,11 +251,6 @@ 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)
@@ -939,7 +942,7 @@ kernel arguments for that derivation to <boot-parameters>."
(operating-system-user-kernel-arguments os)))
(initrd initrd)
(bootloader-name bootloader-name)
- (store-device (fs->boot-device store))
+ (store-device (ensure-not-/dev (fs->boot-device store)))
(store-mount-point (file-system-mount-point store))))))
(define (device->sexp device)