summaryrefslogtreecommitdiffstats
path: root/src/boot
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-18 19:05:03 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-18 19:11:59 +0100
commit62a4b584bba4d152161f5e5974392e2017c7b42c (patch)
treedc889f25b3b50dc695dc2dcca0b99a4b080504cd /src/boot
parentefi: use CMP() more (diff)
downloadsystemd-62a4b584bba4d152161f5e5974392e2017c7b42c.tar.xz
systemd-62a4b584bba4d152161f5e5974392e2017c7b42c.zip
sd-boot+bootctl: invert order of entries w/o sort-key
With the changes in 20ec8f534f90c94669ac8f9a50869f22f94fd4c8, we would sort entries with sort-key as expected (higher versions earlier, i.e. at the top of the menu), but entries without the sort-key as before, with higher versions later. When we have a bunch of boot entries grouped by machine-id (or even in the typical case of all boot entries having the same machine id), sorting by id should generally give good results. Entries will be grouped by installation, and then newer entries should generally be at the top of the menu.
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/efi/boot.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
index 9ed8daed42..e5399f3728 100644
--- a/src/boot/efi/boot.c
+++ b/src/boot/efi/boot.c
@@ -1683,10 +1683,10 @@ static INTN config_entry_compare(const ConfigEntry *a, const ConfigEntry *b) {
return r;
}
- /* Now order by ID (the version is likely part of the ID, thus note that this might put the oldest
- * version last, not first, i.e. specifying a sort key explicitly is thus generally preferable, to
- * take benefit of the explicit sorting above.) */
- r = strverscmp_improved(a->id, b->id);
+ /* Now order by ID. The version is likely part of the ID, thus note that this will generatelly put
+ * the newer versions earlier. Specifying a sort key explicitly is preferable, because it gives an
+ * explicit sort order. */
+ r = -strverscmp_improved(a->id, b->id);
if (r != 0)
return r;