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