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