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