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