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