]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
sort: fix thousands grouping handling on single byte locales
authorPádraig Brady <P@draigBrady.com>
Thu, 28 Dec 2023 00:02:42 +0000 (00:02 +0000)
committerPádraig Brady <P@draigBrady.com>
Fri, 29 Dec 2023 18:04:36 +0000 (18:04 +0000)
* gl/lib/strnumcmp-in.h (numcompare): After commit v9.0-8-g6cafb122f,
we need to treat characters as signed to avoid invalid comparisons
between negative integers and unsigned characters.
* NEWS: Mention the bug fix.

NEWS
gl/lib/strnumcmp-in.h

diff --git a/NEWS b/NEWS
index 26da9993ef11ffde4e1823a65ecaca58161682b9..61ba3cf1942bdfe3dc7bddaa0d96efa00e9a68da 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,11 @@ GNU coreutils NEWS                                    -*- outline -*-
   numfmt options like --suffix no longer have an arbitrary 127-byte limit.
   [bug introduced with numfmt in coreutils-8.21]
 
+  sort again handles thousands grouping characters in single-byte locales
+  where the grouping character is greater than CHAR_MAX.  For e.g. signed
+  character platforms with a 0xA0 (aka &nbsp) grouping character.
+  [bug introduced in coreutils-9.1]
+
   tail no longer mishandles input from files in /proc and /sys file systems,
   on systems with a page size larger than the stdio BUFSIZ.
   [This bug was present in "the beginning".]
index 39b5caf77afcaeb19a8af7662cd9fb320404e225..3a69db7323f0a62fe119bdef676b8592960112d5 100644 (file)
@@ -114,8 +114,8 @@ static inline int _GL_ATTRIBUTE_PURE
 numcompare (char const *a, char const *b,
             int decimal_point, int thousands_sep)
 {
-  unsigned char tmpa = *a;
-  unsigned char tmpb = *b;
+  char tmpa = *a;
+  char tmpb = *b;
   int tmp;
   size_t log_a;
   size_t log_b;