nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0154-Skip-leading-spaces-on-BLS-field-values.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Javier Martinez Canillas <javierm@redhat.com>
d9d99f
Date: Thu, 7 Jun 2018 00:44:51 +0200
d9d99f
Subject: [PATCH] Skip leading spaces on BLS field values
d9d99f
d9d99f
The GRUB 2 blscfg command doesn't parse correctly the BLS fields if these
d9d99f
have extra spaces before the field values. For example, the following BLS
d9d99f
fragment generates a wrong menu entry due using spaces to tabulate values:
d9d99f
d9d99f
title      Fedora 28 (Twenty Eight)
d9d99f
version    4.16.13-300.fc28.x86_64
d9d99f
machine-id e5c131dfee3249cbb9891c2641d8e350
d9d99f
linux      /vmlinuz-4.16.13-300.fc28.x86_64
d9d99f
initrd     /initramfs-4.16.13-300.fc28.x86_64.img
d9d99f
options    root=/dev/mapper/fedora-root ro
d9d99f
d9d99f
Wrong generated menu entry:
d9d99f
d9d99f
load_video
d9d99f
set gfx_payload=keep
d9d99f
insmod gzio
d9d99f
linux  ($root)    /vmlinuz-4.16.13-300.fc28.x86_64    root=/dev/mapper/fedora-root ro
d9d99f
initrd ($root)    /initramfs-4.16.13-300.fc28.x86_64.img
d9d99f
d9d99f
Correct menu entry after the fix:
d9d99f
d9d99f
load_video
d9d99f
set gfx_payload=keep
d9d99f
insmod gzio
d9d99f
linux ($root)/vmlinuz-4.16.13-300.fc28.x86_64 root=/dev/mapper/fedora-root ro
d9d99f
initrd ($root)/initramfs-4.16.13-300.fc28.x86_64.img
d9d99f
d9d99f
Resolves: rhbz#1588184
d9d99f
d9d99f
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
d9d99f
---
d9d99f
 grub-core/commands/blscfg.c | 6 +++++-
d9d99f
 1 file changed, 5 insertions(+), 1 deletion(-)
d9d99f
d9d99f
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
b71686
index fb08d8e4c..831cdcacc 100644
d9d99f
--- a/grub-core/commands/blscfg.c
d9d99f
+++ b/grub-core/commands/blscfg.c
d9d99f
@@ -448,7 +448,11 @@ static int read_entry (
d9d99f
 
d9d99f
       separator[0] = '\0';
d9d99f
 
d9d99f
-      rc = bls_add_keyval (entry, buf, separator+1);
d9d99f
+      do {
d9d99f
+	separator++;
d9d99f
+      } while (*separator == ' ' || *separator == '\t');
d9d99f
+
d9d99f
+      rc = bls_add_keyval (entry, buf, separator);
d9d99f
       grub_free (buf);
d9d99f
       if (rc < 0)
d9d99f
 	break;