From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 18 Jan 2022 12:22:15 -0500 Subject: [PATCH] Correct sorting of kernel names containing '_' sort(1) from GNU coreutils does not treat underscore as part of a version number for `sort -V. This causes misorderings on x86_64, where e.g. kernel-core-3.17.6-300.11.fc21.x86_64 will incorrectly sort *before* kernel-core-3.17.6-300.fc21.x86_64. To cope with this behavior, replace underscores with dashes in order to approximate their intended meaning as version component separators. Fixes: https://savannah.gnu.org/bugs/?42844 Signed-off-by: Robbie Harwood --- util/grub-mkconfig_lib.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in index 301d8a8a1e4..57fb95e3aeb 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -261,8 +261,8 @@ version_test_numeric () version_test_gt () { - version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//"`" - version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//"`" + version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//" -e "s/_/-/g"`" + version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//" -e "s/_/-/g"`" version_test_gt_cmp=gt if [ "x$version_test_gt_b" = "x" ] ; then return 0