forked from pool/coreutils
Accepting request 332474 from home:berny:branches:Base:System
- coreutils-i18n.patch: Sync I18N patch from semi-official repository (shared among distributions, maintained by Padraig Brady): https://github.com/pixelb/coreutils/tree/i18n This fixes the following issues in multi-byte locales: * sort: fix large mem leak with --month-sort (boo#945361, rh#1259942): https://github.com/pixelb/coreutils/commit/b429f5d8c7 * sort: fix assertion with some inputs to --month-sort https://github.com/pixelb/coreutils/commit/31e8211aca OBS-URL: https://build.opensuse.org/request/show/332474 OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=268
This commit is contained in:
parent
f928838445
commit
378fb2110c
@ -2,13 +2,14 @@
|
|||||||
src/cut.c | 443 ++++++++++++++++++++++++-
|
src/cut.c | 443 ++++++++++++++++++++++++-
|
||||||
src/expand.c | 165 +++++++++
|
src/expand.c | 165 +++++++++
|
||||||
src/fold.c | 308 ++++++++++++++++-
|
src/fold.c | 308 ++++++++++++++++-
|
||||||
src/join.c | 363 ++++++++++++++++++---
|
src/join.c | 363 ++++++++++++++++++--
|
||||||
src/pr.c | 444 +++++++++++++++++++++++--
|
src/pr.c | 444 +++++++++++++++++++++++--
|
||||||
src/sort.c | 760 +++++++++++++++++++++++++++++++++++++++++---
|
src/sort.c | 763 +++++++++++++++++++++++++++++++++++++++++---
|
||||||
src/unexpand.c | 228 +++++++++++++
|
src/unexpand.c | 228 +++++++++++++
|
||||||
src/uniq.c | 265 ++++++++++++++-
|
src/uniq.c | 265 ++++++++++++++-
|
||||||
|
tests/i18n/sort-month.sh | 34 +
|
||||||
tests/i18n/sort.sh | 29 +
|
tests/i18n/sort.sh | 29 +
|
||||||
tests/local.mk | 2
|
tests/local.mk | 3
|
||||||
tests/misc/cut.pl | 7
|
tests/misc/cut.pl | 7
|
||||||
tests/misc/expand.pl | 40 ++
|
tests/misc/expand.pl | 40 ++
|
||||||
tests/misc/fold.pl | 50 ++
|
tests/misc/fold.pl | 50 ++
|
||||||
@ -19,7 +20,7 @@
|
|||||||
tests/misc/unexpand.pl | 39 ++
|
tests/misc/unexpand.pl | 39 ++
|
||||||
tests/misc/uniq.pl | 55 +++
|
tests/misc/uniq.pl | 55 +++
|
||||||
tests/pr/pr-tests.pl | 49 ++
|
tests/pr/pr-tests.pl | 49 ++
|
||||||
21 files changed, 3252 insertions(+), 180 deletions(-)
|
22 files changed, 3290 insertions(+), 180 deletions(-)
|
||||||
|
|
||||||
Index: lib/linebuffer.h
|
Index: lib/linebuffer.h
|
||||||
===================================================================
|
===================================================================
|
||||||
@ -3063,7 +3064,7 @@ Index: src/sort.c
|
|||||||
&& ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned))
|
&& ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned))
|
||||||
|| (!key->skipsblanks && key->schar)
|
|| (!key->skipsblanks && key->schar)
|
||||||
|| (!key->skipeblanks && key->echar)))
|
|| (!key->skipeblanks && key->echar)))
|
||||||
@@ -2489,11 +2853,84 @@ key_warnings (struct keyfield const *gke
|
@@ -2489,11 +2853,87 @@ key_warnings (struct keyfield const *gke
|
||||||
error (0, 0, _("option '-r' only applies to last-resort comparison"));
|
error (0, 0, _("option '-r' only applies to last-resort comparison"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3090,13 +3091,16 @@ Index: src/sort.c
|
|||||||
+ if (len == 0)
|
+ if (len == 0)
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+
|
+
|
||||||
+ month = (char *) xmalloc (len + 1);
|
+ if (SIZE_MAX - len < 1)
|
||||||
|
+ xalloc_die ();
|
||||||
+
|
+
|
||||||
+ pp = tmp = (char *) xmalloc (len + 1);
|
+ month = (char *) xnmalloc (len + 1, MB_CUR_MAX);
|
||||||
|
+
|
||||||
|
+ pp = tmp = (char *) xnmalloc (len + 1, MB_CUR_MAX);
|
||||||
+ memcpy (tmp, s, len);
|
+ memcpy (tmp, s, len);
|
||||||
+ tmp[len] = '\0';
|
+ tmp[len] = '\0';
|
||||||
+ wpp = month_wcs = (wchar_t *) xmalloc ((len + 1) * sizeof (wchar_t));
|
+ wpp = month_wcs = (wchar_t *) xnmalloc (len + 1, sizeof (wchar_t));
|
||||||
+ memset (&state, '\0', sizeof(mbstate_t));
|
+ memset (&state, '\0', sizeof (mbstate_t));
|
||||||
+
|
+
|
||||||
+ wclength = mbsrtowcs (month_wcs, &pp, len + 1, &state);
|
+ wclength = mbsrtowcs (month_wcs, &pp, len + 1, &state);
|
||||||
+ if (wclength == (size_t)-1 || pp != NULL)
|
+ if (wclength == (size_t)-1 || pp != NULL)
|
||||||
@ -3112,7 +3116,7 @@ Index: src/sort.c
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ mblength = wcsrtombs (month, &wpp, len + 1, &state);
|
+ mblength = wcsrtombs (month, &wpp, (len + 1) * MB_CUR_MAX, &state);
|
||||||
+ assert (mblength != (-1) && wpp == NULL);
|
+ assert (mblength != (-1) && wpp == NULL);
|
||||||
+
|
+
|
||||||
+ do
|
+ do
|
||||||
@ -3149,7 +3153,7 @@ Index: src/sort.c
|
|||||||
{
|
{
|
||||||
struct keyfield *key = keylist;
|
struct keyfield *key = keylist;
|
||||||
|
|
||||||
@@ -2578,7 +3015,7 @@ keycompare (struct line const *a, struct
|
@@ -2578,7 +3018,7 @@ keycompare (struct line const *a, struct
|
||||||
else if (key->human_numeric)
|
else if (key->human_numeric)
|
||||||
diff = human_numcompare (ta, tb);
|
diff = human_numcompare (ta, tb);
|
||||||
else if (key->month)
|
else if (key->month)
|
||||||
@ -3158,7 +3162,7 @@ Index: src/sort.c
|
|||||||
else if (key->random)
|
else if (key->random)
|
||||||
diff = compare_random (ta, tlena, tb, tlenb);
|
diff = compare_random (ta, tlena, tb, tlenb);
|
||||||
else if (key->version)
|
else if (key->version)
|
||||||
@@ -2694,6 +3131,211 @@ keycompare (struct line const *a, struct
|
@@ -2694,6 +3134,211 @@ keycompare (struct line const *a, struct
|
||||||
return key->reverse ? -diff : diff;
|
return key->reverse ? -diff : diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3370,7 +3374,7 @@ Index: src/sort.c
|
|||||||
/* Compare two lines A and B, returning negative, zero, or positive
|
/* Compare two lines A and B, returning negative, zero, or positive
|
||||||
depending on whether A compares less than, equal to, or greater than B. */
|
depending on whether A compares less than, equal to, or greater than B. */
|
||||||
|
|
||||||
@@ -2721,7 +3363,7 @@ compare (struct line const *a, struct li
|
@@ -2721,7 +3366,7 @@ compare (struct line const *a, struct li
|
||||||
diff = - NONZERO (blen);
|
diff = - NONZERO (blen);
|
||||||
else if (blen == 0)
|
else if (blen == 0)
|
||||||
diff = 1;
|
diff = 1;
|
||||||
@ -3379,7 +3383,7 @@ Index: src/sort.c
|
|||||||
{
|
{
|
||||||
/* Note xmemcoll0 is a performance enhancement as
|
/* Note xmemcoll0 is a performance enhancement as
|
||||||
it will not unconditionally write '\0' after the
|
it will not unconditionally write '\0' after the
|
||||||
@@ -4120,6 +4762,7 @@ set_ordering (char const *s, struct keyf
|
@@ -4120,6 +4765,7 @@ set_ordering (char const *s, struct keyf
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
key->translate = fold_toupper;
|
key->translate = fold_toupper;
|
||||||
@ -3387,7 +3391,7 @@ Index: src/sort.c
|
|||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
key->general_numeric = true;
|
key->general_numeric = true;
|
||||||
@@ -4197,7 +4840,7 @@ main (int argc, char **argv)
|
@@ -4197,7 +4843,7 @@ main (int argc, char **argv)
|
||||||
initialize_exit_failure (SORT_FAILURE);
|
initialize_exit_failure (SORT_FAILURE);
|
||||||
|
|
||||||
hard_LC_COLLATE = hard_locale (LC_COLLATE);
|
hard_LC_COLLATE = hard_locale (LC_COLLATE);
|
||||||
@ -3396,7 +3400,7 @@ Index: src/sort.c
|
|||||||
hard_LC_TIME = hard_locale (LC_TIME);
|
hard_LC_TIME = hard_locale (LC_TIME);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -4218,6 +4861,29 @@ main (int argc, char **argv)
|
@@ -4218,6 +4864,29 @@ main (int argc, char **argv)
|
||||||
thousands_sep = -1;
|
thousands_sep = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3426,7 +3430,7 @@ Index: src/sort.c
|
|||||||
have_read_stdin = false;
|
have_read_stdin = false;
|
||||||
inittables ();
|
inittables ();
|
||||||
|
|
||||||
@@ -4492,13 +5158,34 @@ main (int argc, char **argv)
|
@@ -4492,13 +5161,34 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
{
|
{
|
||||||
@ -3465,7 +3469,7 @@ Index: src/sort.c
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Provoke with 'sort -txx'. Complain about
|
/* Provoke with 'sort -txx'. Complain about
|
||||||
@@ -4509,9 +5196,12 @@ main (int argc, char **argv)
|
@@ -4509,9 +5199,12 @@ main (int argc, char **argv)
|
||||||
quote (optarg));
|
quote (optarg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4164,12 +4168,13 @@ Index: tests/local.mk
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- tests/local.mk.orig
|
--- tests/local.mk.orig
|
||||||
+++ tests/local.mk
|
+++ tests/local.mk
|
||||||
@@ -341,6 +341,8 @@ all_tests = \
|
@@ -341,6 +341,9 @@ all_tests = \
|
||||||
tests/misc/sort-discrim.sh \
|
tests/misc/sort-discrim.sh \
|
||||||
tests/misc/sort-files0-from.pl \
|
tests/misc/sort-files0-from.pl \
|
||||||
tests/misc/sort-float.sh \
|
tests/misc/sort-float.sh \
|
||||||
+ tests/misc/sort-mb-tests.sh \
|
+ tests/misc/sort-mb-tests.sh \
|
||||||
+ tests/i18n/sort.sh \
|
+ tests/i18n/sort.sh \
|
||||||
|
+ tests/i18n/sort-month.sh \
|
||||||
tests/misc/sort-merge.pl \
|
tests/misc/sort-merge.pl \
|
||||||
tests/misc/sort-merge-fdlimit.sh \
|
tests/misc/sort-merge-fdlimit.sh \
|
||||||
tests/misc/sort-month.sh \
|
tests/misc/sort-month.sh \
|
||||||
@ -4780,3 +4785,42 @@ Index: tests/pr/pr-tests.pl
|
|||||||
my $save_temps = $ENV{DEBUG};
|
my $save_temps = $ENV{DEBUG};
|
||||||
my $verbose = $ENV{VERBOSE};
|
my $verbose = $ENV{VERBOSE};
|
||||||
|
|
||||||
|
Index: tests/i18n/sort-month.sh
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null
|
||||||
|
+++ tests/i18n/sort-month.sh
|
||||||
|
@@ -0,0 +1,34 @@
|
||||||
|
+#!/bin/sh
|
||||||
|
+# Verify sort -M multi-byte support.
|
||||||
|
+
|
||||||
|
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||||
|
+print_ver_ sort
|
||||||
|
+require_valgrind_
|
||||||
|
+
|
||||||
|
+# Skip this test if some deallocations are
|
||||||
|
+# avoided at process end.
|
||||||
|
+grep '^#define lint 1' $CONFIG_HEADER > /dev/null ||
|
||||||
|
+ skip_ 'Allocation checks only work reliably in "lint" mode'
|
||||||
|
+
|
||||||
|
+export LC_ALL=en_US.UTF-8
|
||||||
|
+locale -k LC_CTYPE | grep -q "charmap.*UTF-8" \
|
||||||
|
+ || skip_ "No UTF-8 locale available"
|
||||||
|
+
|
||||||
|
+# Note the use of ɑ here which expands to
|
||||||
|
+# a wider representation upon case conversion
|
||||||
|
+# which triggered an assertion in sort -M
|
||||||
|
+cat <<EOF > exp
|
||||||
|
+.
|
||||||
|
+ɑ
|
||||||
|
+EOF
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+# check large mem leak with --month-sort
|
||||||
|
+# https://bugzilla.redhat.com/show_bug.cgi?id=1259942
|
||||||
|
+valgrind --leak-check=full \
|
||||||
|
+ --error-exitcode=1 --errors-for-leak-kinds=definite \
|
||||||
|
+ sort -M < exp > out || fail=1
|
||||||
|
+compare exp out || { fail=1; cat out; }
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+Exit $fail
|
||||||
|
@ -14,9 +14,9 @@ or arm6l. Strip the tests down from 37 to 3.
|
|||||||
|
|
||||||
Index: tests/local.mk
|
Index: tests/local.mk
|
||||||
===================================================================
|
===================================================================
|
||||||
--- tests/local.mk.orig 2015-07-09 15:10:56.769806990 +0200
|
--- tests/local.mk.orig
|
||||||
+++ tests/local.mk 2015-07-09 15:10:56.839805334 +0200
|
+++ tests/local.mk
|
||||||
@@ -678,14 +678,9 @@ all_tests = \
|
@@ -679,14 +679,9 @@ all_tests = \
|
||||||
# See tests/factor/create-test.sh.
|
# See tests/factor/create-test.sh.
|
||||||
tf = tests/factor
|
tf = tests/factor
|
||||||
factor_tests = \
|
factor_tests = \
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Sep 10 23:14:47 UTC 2015 - mail@bernhard-voelker.de
|
Sun Sep 20 15:22:45 UTC 2015 - mail@bernhard-voelker.de
|
||||||
|
|
||||||
- coreutils-i18n.patch: Fix a glaring mem leak in the i18n patch
|
- coreutils-i18n.patch: Sync I18N patch from semi-official repository
|
||||||
for sort -M (boo#945361):
|
(shared among distributions, maintained by Padraig Brady):
|
||||||
Sync I18N patch from semi-official repository (shared among
|
|
||||||
distributions, maintained by Padraig Brady):
|
|
||||||
https://github.com/pixelb/coreutils/tree/i18n
|
https://github.com/pixelb/coreutils/tree/i18n
|
||||||
commit fbbe8c06
|
This fixes the following issues in multi-byte locales:
|
||||||
|
* sort: fix large mem leak with --month-sort (boo#945361, rh#1259942):
|
||||||
|
https://github.com/pixelb/coreutils/commit/b429f5d8c7
|
||||||
|
* sort: fix assertion with some inputs to --month-sort
|
||||||
|
https://github.com/pixelb/coreutils/commit/31e8211aca
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Aug 30 21:52:13 UTC 2015 - mail@bernhard-voelker.de
|
Sun Aug 30 21:52:13 UTC 2015 - mail@bernhard-voelker.de
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Sep 10 23:14:47 UTC 2015 - mail@bernhard-voelker.de
|
Sun Sep 20 15:22:45 UTC 2015 - mail@bernhard-voelker.de
|
||||||
|
|
||||||
- coreutils-i18n.patch: Fix a glaring mem leak in the i18n patch
|
- coreutils-i18n.patch: Sync I18N patch from semi-official repository
|
||||||
for sort -M (boo#945361):
|
(shared among distributions, maintained by Padraig Brady):
|
||||||
Sync I18N patch from semi-official repository (shared among
|
|
||||||
distributions, maintained by Padraig Brady):
|
|
||||||
https://github.com/pixelb/coreutils/tree/i18n
|
https://github.com/pixelb/coreutils/tree/i18n
|
||||||
commit fbbe8c06
|
This fixes the following issues in multi-byte locales:
|
||||||
|
* sort: fix large mem leak with --month-sort (boo#945361, rh#1259942):
|
||||||
|
https://github.com/pixelb/coreutils/commit/b429f5d8c7
|
||||||
|
* sort: fix assertion with some inputs to --month-sort
|
||||||
|
https://github.com/pixelb/coreutils/commit/31e8211aca
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Aug 30 21:52:13 UTC 2015 - mail@bernhard-voelker.de
|
Sun Aug 30 21:52:13 UTC 2015 - mail@bernhard-voelker.de
|
||||||
|
Loading…
x
Reference in New Issue
Block a user