Skip to content
Snippets Groups Projects
Unverified Commit 90d23ed9 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

system: Really filter out Linux device names for the store.

This is a followup to db4e8fd5.
Fixes <https://bugs.gnu.org/28445>.
Reported by Mark H Weaver <mhw@netris.org>.

* gnu/system.scm (ensure-not-/dev): New procedure.
(read-boot-parameters)[ensure-not-/dev]: Remove.
(operating-system-boot-parameters): Use it.
parent 5266ff71
No related branches found
No related tags found
No related merge requests found
......@@ -231,6 +231,14 @@ (define-record-type* <boot-parameters>
(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 @@ (define device-sexp->device
((? 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 @@ (define (operating-system-boot-parameters os system.drv root-device)
(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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment