[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 1/2] Correct sorting of kernel names containing '_'
From: |
Robbie Harwood |
Subject: |
[PATCH v4 1/2] Correct sorting of kernel names containing '_' |
Date: |
Fri, 21 Jan 2022 16:01:54 -0500 |
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 <rharwood@redhat.com>
---
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 301d1ac22..23d41475f 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -243,8 +243,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
--
2.34.1