From e4697fb591c32f96b79ca79057c8eb0aad08c689baad96d90992c4beab462b6f Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Tue, 6 Oct 2015 11:23:07 +0000 Subject: [PATCH] Accepting request 334151 from Base:System Automatic submission by obs-autosubmit OBS-URL: https://build.opensuse.org/request/show/334151 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/coreutils?expand=0&rev=116 --- coreutils-i18n.patch | 73 +++++++++++++++---- ...s-tests-shorten-extreme-factor-tests.patch | 6 +- coreutils-testsuite.changes | 12 +++ coreutils.changes | 12 +++ 4 files changed, 84 insertions(+), 19 deletions(-) diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index 0dccc29..ca5c1f3 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -7,8 +7,9 @@ src/sort.c | 763 +++++++++++++++++++++++++++++++++++++++++--- src/unexpand.c | 228 +++++++++++++ src/uniq.c | 265 ++++++++++++++- + tests/i18n/sort-month.sh | 34 + tests/i18n/sort.sh | 29 + - tests/local.mk | 2 + tests/local.mk | 3 tests/misc/cut.pl | 7 tests/misc/expand.pl | 40 ++ tests/misc/fold.pl | 50 ++ @@ -19,7 +20,7 @@ tests/misc/unexpand.pl | 39 ++ tests/misc/uniq.pl | 55 +++ tests/pr/pr-tests.pl | 49 ++ - 21 files changed, 3255 insertions(+), 180 deletions(-) + 22 files changed, 3290 insertions(+), 180 deletions(-) Index: lib/linebuffer.h =================================================================== @@ -3076,8 +3077,8 @@ Index: src/sort.c + register int lo = 0, hi = MONTHS_PER_YEAR, result; + char *tmp; + size_t wclength, mblength; -+ const char **pp; -+ const wchar_t **wpp; ++ const char *pp; ++ const wchar_t *wpp; + wchar_t *month_wcs; + mbstate_t state; + @@ -3090,17 +3091,19 @@ Index: src/sort.c + if (len == 0) + return 0; + -+ month = (char *) xmalloc (len + 1); ++ if (SIZE_MAX - len < 1) ++ xalloc_die (); + -+ 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); + tmp[len] = '\0'; -+ pp = (const char **)&tmp; -+ month_wcs = (wchar_t *) xmalloc ((len + 1) * sizeof (wchar_t)); -+ memset (&state, '\0', sizeof(mbstate_t)); ++ wpp = month_wcs = (wchar_t *) xnmalloc (len + 1, sizeof (wchar_t)); ++ memset (&state, '\0', sizeof (mbstate_t)); + -+ wclength = mbsrtowcs (month_wcs, pp, len + 1, &state); -+ if (wclength == (size_t)-1 || *pp != NULL) ++ wclength = mbsrtowcs (month_wcs, &pp, len + 1, &state); ++ if (wclength == (size_t)-1 || pp != NULL) + error (SORT_FAILURE, 0, _("Invalid multibyte input %s."), quote(s)); + + for (i = 0; i < wclength; i++) @@ -3113,10 +3116,8 @@ Index: src/sort.c + } + } + -+ wpp = (const wchar_t **)&month_wcs; -+ -+ mblength = wcsrtombs (month, wpp, len + 1, &state); -+ assert (mblength != (-1) && *wpp == NULL); ++ mblength = wcsrtombs (month, &wpp, (len + 1) * MB_CUR_MAX, &state); ++ assert (mblength != (-1) && wpp == NULL); + + do + { @@ -4167,12 +4168,13 @@ Index: tests/local.mk =================================================================== --- tests/local.mk.orig +++ tests/local.mk -@@ -341,6 +341,8 @@ all_tests = \ +@@ -341,6 +341,9 @@ all_tests = \ tests/misc/sort-discrim.sh \ tests/misc/sort-files0-from.pl \ tests/misc/sort-float.sh \ + tests/misc/sort-mb-tests.sh \ + tests/i18n/sort.sh \ ++ tests/i18n/sort-month.sh \ tests/misc/sort-merge.pl \ tests/misc/sort-merge-fdlimit.sh \ tests/misc/sort-month.sh \ @@ -4783,3 +4785,42 @@ Index: tests/pr/pr-tests.pl my $save_temps = $ENV{DEBUG}; 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 < 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 diff --git a/coreutils-tests-shorten-extreme-factor-tests.patch b/coreutils-tests-shorten-extreme-factor-tests.patch index 1b1bafd..fc81971 100644 --- a/coreutils-tests-shorten-extreme-factor-tests.patch +++ b/coreutils-tests-shorten-extreme-factor-tests.patch @@ -14,9 +14,9 @@ or arm6l. Strip the tests down from 37 to 3. Index: tests/local.mk =================================================================== ---- tests/local.mk.orig 2015-07-09 15:10:56.769806990 +0200 -+++ tests/local.mk 2015-07-09 15:10:56.839805334 +0200 -@@ -678,14 +678,9 @@ all_tests = \ +--- tests/local.mk.orig ++++ tests/local.mk +@@ -679,14 +679,9 @@ all_tests = \ # See tests/factor/create-test.sh. tf = tests/factor factor_tests = \ diff --git a/coreutils-testsuite.changes b/coreutils-testsuite.changes index 85d6096..fab232f 100644 --- a/coreutils-testsuite.changes +++ b/coreutils-testsuite.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Sun Sep 20 15:22:45 UTC 2015 - mail@bernhard-voelker.de + +- 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 + ------------------------------------------------------------------- Sun Aug 30 21:52:13 UTC 2015 - mail@bernhard-voelker.de diff --git a/coreutils.changes b/coreutils.changes index 85d6096..fab232f 100644 --- a/coreutils.changes +++ b/coreutils.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Sun Sep 20 15:22:45 UTC 2015 - mail@bernhard-voelker.de + +- 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 + ------------------------------------------------------------------- Sun Aug 30 21:52:13 UTC 2015 - mail@bernhard-voelker.de