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

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