GNU bug report logs -
#57307
guix system reports an error when uuid is used in menu-entry
Previous Next
Reported by: tiantian <typ22 <at> foxmail.com>
Date: Sat, 20 Aug 2022 10:17:02 UTC
Severity: normal
Done: Marius Bakke <marius <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57307 in the body.
You can then email your comments to 57307 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guix <at> gnu.org
:
bug#57307
; Package
guix
.
(Sat, 20 Aug 2022 10:17:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
tiantian <typ22 <at> foxmail.com>
:
New bug report received and forwarded. Copy sent to
bug-guix <at> gnu.org
.
(Sat, 20 Aug 2022 10:17:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I want to add an menu-entry in bootloader-configuration. I use uuid to
specify the partition in device field of menu-entry , because my
partition has no label. But when I use 'guix system reconfigure', guix
system reports an error: "guix system: error: #<<uuid> type: dce bv:
#vu8(109 91 19 212 96 146 70 208 139 228 7 61 192 116 19 204)>: invalid
G-expression input"
After asking friends in #guixcn, I still can't get more error messages.
It's the only error message. I can't find its reason.
To find the problem, I also simplified my configuration file and tried
to use ‘git bisect’ to find it, but I failed. I couldn't find a good
commit. I rolled back to c1719a0 commit in git repository, but I still
got the error message after building and using './pre-inst-env guix
system build ./config-test.scm'. I had to give up solving it and just
send an email to report the bug.
My English is poor. I use translation software. If the grammar is wrong,
please forgive me.
[Message part 2 (text/html, inline)]
[config-test.scm (text/x-scheme, attachment)]
[OpenPGP_0x47280B4EFC5FC701.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]
Information forwarded
to
bug-guix <at> gnu.org
:
bug#57307
; Package
guix
.
(Sun, 21 Aug 2022 08:40:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 57307 <at> debbugs.gnu.org (full text, mbox):
Hi,
tiantian <typ22 <at> foxmail.com> writes:
> I want to add an menu-entry in bootloader-configuration. I use uuid to
> specify the partition in device field of menu-entry , because my
> partition has no label. But when I use 'guix system reconfigure', guix
> system reports an error: "guix system: error: #<<uuid> type: dce bv:
> #vu8(109 91 19 212 96 146 70 208 139 228 7 61 192 116 19 204)>: invalid
> G-expression input"
Right, this is an issue with how we translate the menu-entries to sexps
through `menu-entry->sexp`, which then get embedded into a g-exp via
`operating-system-boot-parameters-file`! We didn't take into account
non-string devices there. The following two patches should fix the
issue and introduce some tests for it.
Best,
--
Josselin Poiret
Information forwarded
to
bug-guix <at> gnu.org
:
bug#57307
; Package
guix
.
(Sun, 21 Aug 2022 08:42:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 57307 <at> debbugs.gnu.org (full text, mbox):
Previously, menu-entry->sexp didn't try to convert `device` to a
proper sexp, which was inserted directly into the boot parameters
G-exp, leading to a G-exp input error. Now convert both uuid and
file-system-label possibilities to sexps, and add parsing code to
sexp->menu-entry. This fixes #57307.
* gnu/bootloader.scm (menu-entry->sexp, sexp->menu-entry): Take
non-string devices into account.
---
gnu/bootloader.scm | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 9cf5457873..1f08ab170e 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -21,6 +21,8 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu bootloader)
+ #:use-module (gnu system file-systems)
+ #:use-module (gnu system uuid)
#:use-module (guix discovery)
#:use-module (guix gexp)
#:use-module (guix profiles)
@@ -105,12 +107,19 @@ (define-record-type* <menu-entry>
(define (menu-entry->sexp entry)
"Return ENTRY serialized as an sexp."
+ (define (device->sexp device)
+ (match device
+ ((? uuid? uuid)
+ `(uuid ,(uuid-type uuid) ,(uuid->string uuid)))
+ ((? file-system-label? label)
+ `(label ,(file-system-label->string label)))
+ (_ device)))
(match entry
(($ <menu-entry> label device mount-point linux linux-arguments initrd #f
())
`(menu-entry (version 0)
(label ,label)
- (device ,device)
+ (device ,(device->sexp device))
(device-mount-point ,mount-point)
(linux ,linux)
(linux-arguments ,linux-arguments)
@@ -119,7 +128,7 @@ (define (menu-entry->sexp entry)
multiboot-kernel multiboot-arguments multiboot-modules)
`(menu-entry (version 0)
(label ,label)
- (device ,device)
+ (device ,(device->sexp device))
(device-mount-point ,mount-point)
(multiboot-kernel ,multiboot-kernel)
(multiboot-arguments ,multiboot-arguments)
@@ -128,6 +137,13 @@ (define (menu-entry->sexp entry)
(define (sexp->menu-entry sexp)
"Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry>
record."
+ (define (sexp->device device-sexp)
+ (match device-sexp
+ (('uuid type uuid-string)
+ (uuid uuid-string type))
+ (('label label)
+ (file-system-label label))
+ (_ device-sexp)))
(match sexp
(('menu-entry ('version 0)
('label label) ('device device)
@@ -136,7 +152,7 @@ (define (sexp->menu-entry sexp)
('initrd initrd) _ ...)
(menu-entry
(label label)
- (device device)
+ (device (sexp->device device))
(device-mount-point mount-point)
(linux linux)
(linux-arguments linux-arguments)
@@ -149,7 +165,7 @@ (define (sexp->menu-entry sexp)
('multiboot-modules multiboot-modules) _ ...)
(menu-entry
(label label)
- (device device)
+ (device (sexp->device device))
(device-mount-point mount-point)
(multiboot-kernel multiboot-kernel)
(multiboot-arguments multiboot-arguments)
base-commit: b8f2eb286ec52c97048e23d326d94ae5772797e8
--
2.37.1
Information forwarded
to
bug-guix <at> gnu.org
:
bug#57307
; Package
guix
.
(Sun, 21 Aug 2022 08:42:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 57307 <at> debbugs.gnu.org (full text, mbox):
* tests/boot-parameters.scm (%uuid-menu-entry,
%file-system-label-menu-entry): New variables.
("menu-entry roundtrip, uuid", "menu-entry roundtrip,
file-system-label"): New tests.
---
tests/boot-parameters.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm
index 8e48e1775e..811ecffd75 100644
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -303,4 +303,26 @@ (define operating-system-boot-parameters
(operating-system-boot-parameters %default-operating-system
%default-root-device)))
+(define %uuid-menu-entry
+ (menu-entry
+ (label "test")
+ (device (uuid "6d5b13d4-6092-46d0-8be4-073dc07413cc"))
+ (linux "/boot/bzImage")
+ (initrd "/boot/initrd.cpio.gz")))
+
+(define %file-system-label-menu-entry
+ (menu-entry
+ (label "test")
+ (device (file-system-label "test-label"))
+ (linux "/boot/bzImage")
+ (initrd "/boot/initrd.cpio.gz")))
+
+(test-equal "menu-entry roundtrip, uuid"
+ %uuid-menu-entry
+ (sexp->menu-entry (menu-entry->sexp %uuid-menu-entry)))
+
+(test-equal "menu-entry roundtrip, file-system-label"
+ %file-system-label-menu-entry
+ (sexp->menu-entry (menu-entry->sexp %file-system-label-menu-entry)))
+
(test-end "boot-parameters")
--
2.37.1
Information forwarded
to
bug-guix <at> gnu.org
:
bug#57307
; Package
guix
.
(Sun, 21 Aug 2022 13:04:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 57307 <at> debbugs.gnu.org (full text, mbox):
Hi again,
tiantian <typ22 <at> foxmail.com> writes:
> Should I close this bug now?
Let's wait for a maintainer to push the fix first, they will most likely
close the bug themselves.
I'm glad this fix worked and that you were able to figure out your other
issue! See you around.
Best,
--
Josselin Poiret
Reply sent
to
Marius Bakke <marius <at> gnu.org>
:
You have taken responsibility.
(Sun, 28 Aug 2022 21:47:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
tiantian <typ22 <at> foxmail.com>
:
bug acknowledged by developer.
(Sun, 28 Aug 2022 21:47:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 57307-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Josselin Poiret via Bug reports for GNU Guix <bug-guix <at> gnu.org> skriver:
> Hi,
>
> tiantian <typ22 <at> foxmail.com> writes:
>
>> I want to add an menu-entry in bootloader-configuration. I use uuid to
>> specify the partition in device field of menu-entry , because my
>> partition has no label. But when I use 'guix system reconfigure', guix
>> system reports an error: "guix system: error: #<<uuid> type: dce bv:
>> #vu8(109 91 19 212 96 146 70 208 139 228 7 61 192 116 19 204)>: invalid
>> G-expression input"
>
> Right, this is an issue with how we translate the menu-entries to sexps
> through `menu-entry->sexp`, which then get embedded into a g-exp via
> `operating-system-boot-parameters-file`! We didn't take into account
> non-string devices there. The following two patches should fix the
> issue and introduce some tests for it.
Pushed in:
3294fa2ba4 tests: Add test for menu-entry roundtrips as sexps.
0811d2cb8d bootloader: Convert device in menu-entry to proper sexp.
Thanks!
[signature.asc (application/pgp-signature, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 26 Sep 2022 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 213 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.