grub2/0201-blscfg-sort-BLS-entries-by-version-field.patch
Javier Martinez Canillas 1f092caba7
Drop two efinet patches that were causing issues and a bunch of other fixes
Add comments and revert logic changes in 01_fallback_counting
Remove quotes when reading ID value from /etc/os-release
  Related: rhbz#1650706
blscfg: expand grub_users before passing to grub_normal_add_menu_entry()
  Resolves: rhbz#1650706
Drop buggy downstream patch "efinet: retransmit if our device is busy"
  Resolves: rhbz#1649048
Make the menu entry users option argument to be optional
  Related: rhbz#1652434
10_linux_bls: add missing menu entries options
  Resolves: rhbz#1652434
Drop "Be more aggro about actually using the *configured* network device."
  Resolves: rhbz#1654388
Fix menu entry selection based on title
  Resolves: rhbz#1654936

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-12-01 03:28:36 +01:00

58 lines
2 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Will Thompson <wjt@endlessm.com>
Date: Wed, 11 Jul 2018 15:41:09 +0100
Subject: [PATCH] blscfg: sort BLS entries by 'version' field
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This partially reverts Use BLS fragment filename as menu entry id and
for criteria to sort. Sorting by filename only gives the correct order
if the BLS entries are generated by a version of ostree after this patch
https://github.com/ostreedev/ostree/commit/9f48e212a3bf9ed418fb3216e4f834d581bc520e
to use the version (higher is newer) in the filename. Older ostrees,
including all releases at the time of writing, use the index (lower is
newer) in the filename, so sorting by filename produces the reverse
order.
Sorting by 'version' field matches libostree's own
compare_boot_loader_configs(), so I think it's more correct than relying
on the filename, particularly since we've already gone to the trouble of
parsing all the fields in the file.
Signed-off-by: Will Thompson <wjt@endlessm.com>
---
grub-core/commands/blscfg.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
index b61dddb7f43..9c928dda470 100644
--- a/grub-core/commands/blscfg.c
+++ b/grub-core/commands/blscfg.c
@@ -327,10 +327,26 @@ finish:
return ret;
}
+/* return 1: p0 is newer than p1 */
+/* 0: p0 and p1 are the same version */
+/* -1: p1 is newer than p0 */
static int bls_cmp(const void *p0, const void *p1, void *state UNUSED)
{
struct bls_entry * e0 = *(struct bls_entry **)p0;
struct bls_entry * e1 = *(struct bls_entry **)p1;
+ const char *v0, *v1;
+ int r;
+
+ v0 = bls_get_val(e0, "version", NULL);
+ v1 = bls_get_val(e1, "version", NULL);
+
+ if (v0 && !v1)
+ return -1;
+ if (!v0 && v1)
+ return 1;
+
+ if ((r = vercmp(v0, v1)) != 0)
+ return r;
return vercmp(e0->filename, e1->filename);
}