fix sort -h for multibyte locales (reported via

http://bugs.archlinux.org/task/16022)
This commit is contained in:
Ondrej Vasik 2009-09-08 14:34:31 +00:00
parent 2c2fd97500
commit 61fe33cb1c
2 changed files with 11 additions and 9 deletions

View File

@ -2204,7 +2204,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
{ {
struct keyfield *key = keylist; struct keyfield *key = keylist;
@@ -1875,6 +2265,181 @@ @@ -1875,6 +2265,179 @@
return key->reverse ? -diff : diff; return key->reverse ? -diff : diff;
} }
@ -2232,7 +2232,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
+ +
+ for (;;) + for (;;)
+ { + {
+ unsigned char *translate = (unsigned char *) key->translate; + char const *translate = key->translate;
+ bool const *ignore = key->ignore; + bool const *ignore = key->ignore;
+ +
+ /* Find the lengths. */ + /* Find the lengths. */
@ -2242,16 +2242,14 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
+ /* Actually compare the fields. */ + /* Actually compare the fields. */
+ if (key->random) + if (key->random)
+ diff = compare_random (texta, lena, textb, lenb); + diff = compare_random (texta, lena, textb, lenb);
+ else if (key->numeric | key->general_numeric) + else if (key->numeric | key->general_numeric | key->human_numeric)
+ { + {
+ char savea = *lima, saveb = *limb; + char savea = *lima, saveb = *limb;
+ +
+ *lima = *limb = '\0'; + *lima = *limb = '\0';
+ if (force_general_numcompare) + diff = (key->numeric ? numcompare (texta, textb)
+ diff = general_numcompare (texta, textb); + : key->general_numeric ? general_numcompare (texta, textb)
+ else + : human_numcompare (texta, textb, key));
+ diff = ((key->numeric ? numcompare : general_numcompare)
+ (texta, textb));
+ *lima = savea, *limb = saveb; + *lima = savea, *limb = saveb;
+ } + }
+ else if (key->version) + else if (key->version)

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils Name: coreutils
Version: 7.5 Version: 7.5
Release: 4%{?dist} Release: 5%{?dist}
License: GPLv3+ License: GPLv3+
Group: System Environment/Base Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/ Url: http://www.gnu.org/software/coreutils/
@ -333,6 +333,10 @@ fi
%{_libdir}/coreutils %{_libdir}/coreutils
%changelog %changelog
* Tue Sep 08 2009 Ondrej Vasik <ovasik@redhat.com> - 7.5-5
- fix sort -h for multibyte locales (reported via
http://bugs.archlinux.org/task/16022)
* Thu Sep 03 2009 Ondrej Vasik <ovasik@redhat.com> - 7.5-4 * Thu Sep 03 2009 Ondrej Vasik <ovasik@redhat.com> - 7.5-4
- fixed regression where df -l <device> as regular user - fixed regression where df -l <device> as regular user
cause "Permission denied" (#520630, introduced by fix for cause "Permission denied" (#520630, introduced by fix for