forked from pool/coreutils
Accepting request 252640 from home:AndreasSchwab:f
- sort-keycompare-mb.patch: make sure to NUL-terminate the sort keys. Fixes http://bugs.gnu.org/18540 OBS-URL: https://build.opensuse.org/request/show/252640 OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=241
This commit is contained in:
parent
642763429a
commit
2311282852
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Sep 27 17:46:01 UTC 2014 - schwab@linux-m68k.org
|
||||
|
||||
- sort-keycompare-mb.patch: make sure to NUL-terminate the sort keys.
|
||||
Fixes http://bugs.gnu.org/18540
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 18 18:04:37 CEST 2014 - pth@suse.de
|
||||
|
||||
|
@ -91,6 +91,7 @@ Source1: baselibs.conf
|
||||
Patch1: coreutils-remove_hostname_documentation.patch
|
||||
Patch3: coreutils-remove_kill_documentation.patch
|
||||
Patch4: coreutils-i18n.patch
|
||||
Patch5: sort-keycompare-mb.patch
|
||||
Patch8: coreutils-sysinfo.patch
|
||||
Patch16: coreutils-invalid-ids.patch
|
||||
|
||||
@ -150,6 +151,7 @@ the GNU fileutils, sh-utils, and textutils packages.
|
||||
%prep
|
||||
%setup -q -n coreutils-%{version}
|
||||
%patch4
|
||||
%patch5 -p1
|
||||
%patch1
|
||||
%patch3
|
||||
%patch8
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Sep 27 17:46:01 UTC 2014 - schwab@linux-m68k.org
|
||||
|
||||
- sort-keycompare-mb.patch: make sure to NUL-terminate the sort keys.
|
||||
Fixes http://bugs.gnu.org/18540
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 18 18:04:37 CEST 2014 - pth@suse.de
|
||||
|
||||
|
@ -91,6 +91,7 @@ Source1: baselibs.conf
|
||||
Patch1: coreutils-remove_hostname_documentation.patch
|
||||
Patch3: coreutils-remove_kill_documentation.patch
|
||||
Patch4: coreutils-i18n.patch
|
||||
Patch5: sort-keycompare-mb.patch
|
||||
Patch8: coreutils-sysinfo.patch
|
||||
Patch16: coreutils-invalid-ids.patch
|
||||
|
||||
@ -150,6 +151,7 @@ the GNU fileutils, sh-utils, and textutils packages.
|
||||
%prep
|
||||
%setup -q -n coreutils-%{version}
|
||||
%patch4
|
||||
%patch5 -p1
|
||||
%patch1
|
||||
%patch3
|
||||
%patch8
|
||||
|
76
sort-keycompare-mb.patch
Normal file
76
sort-keycompare-mb.patch
Normal file
@ -0,0 +1,76 @@
|
||||
Index: coreutils-8.23/src/sort.c
|
||||
===================================================================
|
||||
--- coreutils-8.23.orig/src/sort.c
|
||||
+++ coreutils-8.23/src/sort.c
|
||||
@@ -3236,6 +3236,9 @@ keycompare_mb (const struct line *a, con
|
||||
size_t lena = lima <= texta ? 0 : lima - texta;
|
||||
size_t lenb = limb <= textb ? 0 : limb - textb;
|
||||
|
||||
+ char enda IF_LINT (= 0);
|
||||
+ char endb IF_LINT (= 0);
|
||||
+
|
||||
char const *translate = key->translate;
|
||||
bool const *ignore = key->ignore;
|
||||
|
||||
@@ -3253,6 +3256,12 @@ keycompare_mb (const struct line *a, con
|
||||
texta = copy_a; textb = copy_b;
|
||||
lena = new_len_a; lenb = new_len_b;
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ /* Use the keys in-place, temporarily null-terminated. */
|
||||
+ enda = texta[lena]; texta[lena] = '\0';
|
||||
+ endb = textb[lenb]; textb[lenb] = '\0';
|
||||
+ }
|
||||
|
||||
if (key->random)
|
||||
diff = compare_random (texta, lena, textb, lenb);
|
||||
@@ -3276,13 +3285,22 @@ keycompare_mb (const struct line *a, con
|
||||
diff = 1;
|
||||
else if (hard_LC_COLLATE && !folding)
|
||||
{
|
||||
- diff = xmemcoll0 (texta, lena, textb, lenb);
|
||||
+ diff = xmemcoll0 (texta, lena + 1, textb, lenb + 1);
|
||||
}
|
||||
else
|
||||
- diff = memcmp (texta, textb, MIN (lena + 1,lenb + 1));
|
||||
+ {
|
||||
+ diff = memcmp (texta, textb, MIN (lena, lenb));
|
||||
+ if (diff == 0)
|
||||
+ diff = lena < lenb ? -1 : lena != lenb;
|
||||
+ }
|
||||
|
||||
if (ignore || translate)
|
||||
free (texta);
|
||||
+ else
|
||||
+ {
|
||||
+ texta[lena] = enda;
|
||||
+ textb[lenb] = endb;
|
||||
+ }
|
||||
|
||||
if (diff)
|
||||
goto not_equal;
|
||||
Index: coreutils-8.23/tests/misc/sort.pl
|
||||
===================================================================
|
||||
--- coreutils-8.23.orig/tests/misc/sort.pl
|
||||
+++ coreutils-8.23/tests/misc/sort.pl
|
||||
@@ -322,6 +322,10 @@ my @Tests =
|
||||
["22a", '-k 2,2fd -k 1,1r', {IN=>"3 b\n4 B\n"}, {OUT=>"4 B\n3 b\n"}],
|
||||
["22b", '-k 2,2d -k 1,1r', {IN=>"3 b\n4 b\n"}, {OUT=>"4 b\n3 b\n"}],
|
||||
|
||||
+# This fails in Fedora 20, per Göran Uddeborg in: http://bugs.gnu.org/18540
|
||||
+["23", '-s -k1,1 -t/', {IN=>"a b/x\na-b-c/x\n"}, {OUT=>"a b/x\na-b-c/x\n"},
|
||||
+ {ENV => "LC_ALL=$mb_locale"}],
|
||||
+
|
||||
["no-file1", 'no-file', {EXIT=>2}, {ERR=>$no_file}],
|
||||
# This test failed until 1.22f. Sort didn't give an error.
|
||||
# From Will Edgington.
|
||||
@@ -445,7 +449,7 @@ if ($mb_locale ne 'C')
|
||||
}
|
||||
#disable several failing tests until investigation, disable all tests with envvars set
|
||||
next if (grep {ref $_ eq 'HASH' && exists $_->{ENV}} (@new_t));
|
||||
- next if ($test_name =~ "18g" or $test_name =~ "sort-numeric" or $test_name =~ "08[ab]" or $test_name =~ "03[def]" or $test_name =~ "h4" or $test_name =~ "n1" or $test_name =~ "2[01]a");
|
||||
+ next if ($test_name =~ "18g" or $test_name =~ "sort-numeric" or $test_name =~ "08[ab]" or $test_name =~ "03[def]" or $test_name =~ "h4" or $test_name =~ "n1" or $test_name =~ "2[01]a" or $test_name =~ "11[ab]");
|
||||
push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
|
||||
}
|
||||
push @Tests, @new;
|
Loading…
Reference in New Issue
Block a user