nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0148-Use-BLS-version-field-to-compare-entries-if-id-field.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Javier Martinez Canillas <javierm@redhat.com>
d9d99f
Date: Fri, 27 Apr 2018 17:53:41 +0200
d9d99f
Subject: [PATCH] Use BLS version field to compare entries if id field isn't
d9d99f
 defined
d9d99f
d9d99f
The BootLoaderSpec fragments generated by OSTree don't have the id field,
d9d99f
so grub2 will attempt to sort the entries by using the title field which
d9d99f
may not be correct. The entries do have a version field though so use it.
d9d99f
d9d99f
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
d9d99f
---
d9d99f
 grub-core/commands/blscfg.c | 3 +++
d9d99f
 1 file changed, 3 insertions(+)
d9d99f
d9d99f
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
b71686
index 6ab85df6b..c52d2b2e0 100644
d9d99f
--- a/grub-core/commands/blscfg.c
d9d99f
+++ b/grub-core/commands/blscfg.c
d9d99f
@@ -418,6 +418,9 @@ static int bls_cmp(const void *p0, const void *p1, void *state UNUSED)
d9d99f
 
d9d99f
   rc = bls_keyval_cmp (e0, e1, "id");
d9d99f
 
d9d99f
+  if (rc == 0)
d9d99f
+    rc = bls_keyval_cmp (e0, e1, "version");
d9d99f
+
d9d99f
   if (rc == 0)
d9d99f
     rc = bls_keyval_cmp (e0, e1, "title");
d9d99f