04161d
From 3976ef5a20369d8b490907ab2cba2d617305a5e0 Mon Sep 17 00:00:00 2001
04161d
From: Kamil Dudka <kdudka@redhat.com>
04161d
Date: Mon, 30 May 2016 16:19:20 +0200
04161d
Subject: [PATCH] sort: do not use static array 'blanks' in human_numcompare()
04161d
04161d
... because the array is not initialized with MB locales.  Note this is
04161d
rather a conservative fix.  I plan to do more cleanup of the i18n patch
04161d
in Fedora to prevent mistakes like this in future updates of coreutils.
04161d
---
04161d
 src/sort.c | 8 +++-----
04161d
 1 file changed, 3 insertions(+), 5 deletions(-)
04161d
04161d
diff --git a/src/sort.c b/src/sort.c
04161d
index 9e07ad8..e47b039 100644
04161d
--- a/src/sort.c
04161d
+++ b/src/sort.c
04161d
@@ -2304,12 +2304,10 @@ find_unit_order (char const *number)
04161d
        <none/unknown> < K/k < M < G < T < P < E < Z < Y  */
04161d
 
04161d
 static int
04161d
-human_numcompare (char const *a, char const *b)
04161d
+human_numcompare (char *a, char *b)
04161d
 {
04161d
-  while (blanks[to_uchar (*a)])
04161d
-    a++;
04161d
-  while (blanks[to_uchar (*b)])
04161d
-    b++;
04161d
+  skipblanks(&a, a + strlen(a));
04161d
+  skipblanks(&b, b + strlen(b));
04161d
 
04161d
   int diff = find_unit_order (a) - find_unit_order (b);
04161d
   return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep));
04161d
-- 
04161d
2.5.5
04161d