All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Correct sorting of kernel names containing '_'
@ 2022-01-18 17:29 Robbie Harwood
  2022-01-18 17:56 ` Robbie Harwood
  0 siblings, 1 reply; 7+ messages in thread
From: Robbie Harwood @ 2022-01-18 17:29 UTC (permalink / raw)
  To: grub-devel; +Cc: Robbie Harwood

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



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-20  1:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-18 17:29 [PATCH] Correct sorting of kernel names containing '_' Robbie Harwood
2022-01-18 17:56 ` Robbie Harwood
2022-01-18 21:57   ` Glenn Washburn
2022-01-19 18:52     ` Robbie Harwood
2022-01-19 21:33     ` [PATCH] mkconfig: use distro sorts when available Robbie Harwood
2022-01-20  0:36       ` Glenn Washburn
2022-01-20  1:17       ` Glenn Washburn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.