From fa6f383f16e3599d9f7ee77898e5f82b970c8013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Mon, 20 Aug 2012 13:57:53 +0200 Subject: [PATCH] fix multibyte issues in cut and expand (M.Briza, #821260) --- coreutils-i18n.patch | 215 +++++++++++++++++++++++++++---------------- coreutils.spec | 1 + 2 files changed, 137 insertions(+), 79 deletions(-) diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index 925c85c..a5b9aaf 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -1,6 +1,6 @@ -diff -urNp coreutils-8.16-orig/lib/linebuffer.h coreutils-8.16/lib/linebuffer.h ---- coreutils-8.16-orig/lib/linebuffer.h 2012-01-06 10:14:31.000000000 +0100 -+++ coreutils-8.16/lib/linebuffer.h 2012-03-26 18:02:00.993889446 +0200 +diff -urNp coreutils-8.19-orig/lib/linebuffer.h coreutils-8.19/lib/linebuffer.h +--- coreutils-8.19-orig/lib/linebuffer.h 2012-01-06 10:14:31.000000000 +0100 ++++ coreutils-8.19/lib/linebuffer.h 2012-08-20 13:52:04.061593006 +0200 @@ -21,6 +21,11 @@ # include @@ -23,9 +23,9 @@ diff -urNp coreutils-8.16-orig/lib/linebuffer.h coreutils-8.16/lib/linebuffer.h }; /* Initialize linebuffer LINEBUFFER for use. */ -diff -urNp coreutils-8.16-orig/src/cut.c coreutils-8.16/src/cut.c ---- coreutils-8.16-orig/src/cut.c 2012-03-24 21:26:51.000000000 +0100 -+++ coreutils-8.16/src/cut.c 2012-03-26 17:46:48.000000000 +0200 +diff -urNp coreutils-8.19-orig/src/cut.c coreutils-8.19/src/cut.c +--- coreutils-8.19-orig/src/cut.c 2012-07-21 16:54:31.000000000 +0200 ++++ coreutils-8.19/src/cut.c 2012-08-20 13:52:52.299593173 +0200 @@ -28,6 +28,11 @@ #include #include @@ -376,7 +376,7 @@ diff -urNp coreutils-8.16-orig/src/cut.c coreutils-8.16/src/cut.c + break; + } + -+ if (wc == WEOF) ++ if (len <= 0 && wc == WEOF) + break; + + /* If the first field extends to the end of line (it is not @@ -633,9 +633,9 @@ diff -urNp coreutils-8.16-orig/src/cut.c coreutils-8.16/src/cut.c } if (optind == argc) -diff -urNp coreutils-8.16-orig/src/expand.c coreutils-8.16/src/expand.c ---- coreutils-8.16-orig/src/expand.c 2012-03-24 21:26:51.000000000 +0100 -+++ coreutils-8.16/src/expand.c 2012-03-26 17:42:56.000000000 +0200 +diff -urNp coreutils-8.19-orig/src/expand.c coreutils-8.19/src/expand.c +--- coreutils-8.19-orig/src/expand.c 2012-07-21 16:54:31.000000000 +0200 ++++ coreutils-8.19/src/expand.c 2012-08-20 13:54:02.974621693 +0200 @@ -37,12 +37,29 @@ #include #include @@ -733,7 +733,7 @@ diff -urNp coreutils-8.16-orig/src/expand.c coreutils-8.16/src/expand.c + if (convert) + { + ++column; -+ if (convert_entire_line == 0) ++ if (convert_entire_line == 0 && !isblank(*bufpos)) + convert = 0; + } + putchar (*bufpos); @@ -793,7 +793,7 @@ diff -urNp coreutils-8.16-orig/src/expand.c coreutils-8.16/src/expand.c + + width = wcwidth (wc); + column += (width > 0) ? width : 0; -+ if (convert_entire_line == 0) ++ if (convert_entire_line == 0 && !iswblank(wc)) + convert = 0; + } + } @@ -823,9 +823,9 @@ diff -urNp coreutils-8.16-orig/src/expand.c coreutils-8.16/src/expand.c if (have_read_stdin && fclose (stdin) != 0) error (EXIT_FAILURE, errno, "-"); -diff -urNp coreutils-8.16-orig/src/fold.c coreutils-8.16/src/fold.c ---- coreutils-8.16-orig/src/fold.c 2012-03-24 19:22:13.000000000 +0100 -+++ coreutils-8.16/src/fold.c 2012-03-26 17:48:37.000000000 +0200 +diff -urNp coreutils-8.19-orig/src/fold.c coreutils-8.19/src/fold.c +--- coreutils-8.19-orig/src/fold.c 2012-07-21 16:54:31.000000000 +0200 ++++ coreutils-8.19/src/fold.c 2012-08-20 13:52:04.066592980 +0200 @@ -22,12 +22,34 @@ #include #include @@ -1223,9 +1223,9 @@ diff -urNp coreutils-8.16-orig/src/fold.c coreutils-8.16/src/fold.c break; case 's': /* Break at word boundaries. */ -diff -urNp coreutils-8.16-orig/src/join.c coreutils-8.16/src/join.c ---- coreutils-8.16-orig/src/join.c 2012-03-24 21:26:51.000000000 +0100 -+++ coreutils-8.16/src/join.c 2012-03-26 17:50:02.000000000 +0200 +diff -urNp coreutils-8.19-orig/src/join.c coreutils-8.19/src/join.c +--- coreutils-8.19-orig/src/join.c 2012-07-21 16:54:31.000000000 +0200 ++++ coreutils-8.19/src/join.c 2012-08-20 13:52:04.069594876 +0200 @@ -22,18 +22,32 @@ #include #include @@ -1701,9 +1701,9 @@ diff -urNp coreutils-8.16-orig/src/join.c coreutils-8.16/src/join.c break; case NOCHECK_ORDER_OPTION: -diff -urNp coreutils-8.16-orig/src/pr.c coreutils-8.16/src/pr.c ---- coreutils-8.16-orig/src/pr.c 2012-03-24 21:26:51.000000000 +0100 -+++ coreutils-8.16/src/pr.c 2012-03-26 17:50:48.000000000 +0200 +diff -urNp coreutils-8.19-orig/src/pr.c coreutils-8.19/src/pr.c +--- coreutils-8.19-orig/src/pr.c 2012-07-21 16:54:31.000000000 +0200 ++++ coreutils-8.19/src/pr.c 2012-08-20 13:52:04.074593445 +0200 @@ -312,6 +312,32 @@ #include @@ -2447,9 +2447,9 @@ diff -urNp coreutils-8.16-orig/src/pr.c coreutils-8.16/src/pr.c /* We've just printed some files and need to clean up things before looking for more options and printing the next batch of files. -diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c ---- coreutils-8.17-orig/src/sort.c -+++ coreutils-8.17/src/sort.c +diff -urNp coreutils-8.19-orig/src/sort.c coreutils-8.19/src/sort.c +--- coreutils-8.19-orig/src/sort.c 2012-08-18 07:39:29.000000000 +0200 ++++ coreutils-8.19/src/sort.c 2012-08-20 13:52:04.079596072 +0200 @@ -29,6 +29,14 @@ #include #include @@ -2465,7 +2465,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c #include "system.h" #include "argmatch.h" #include "error.h" -@@ -167,12 +176,34 @@ static int thousands_sep; +@@ -166,12 +174,34 @@ static int thousands_sep; /* Nonzero if the corresponding locales are hard. */ static bool hard_LC_COLLATE; @@ -2501,7 +2501,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c /* The kind of blanks for '-b' to skip in various options. */ enum blanktype { bl_start, bl_end, bl_both }; -@@ -343,13 +374,11 @@ static bool reverse; +@@ -345,13 +375,11 @@ static bool reverse; they were read if all keys compare equal. */ static bool stable; @@ -2518,7 +2518,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c /* Flag to remove consecutive duplicate lines from the output. Only the last of a sequence of equal lines will be output. */ -@@ -782,6 +811,46 @@ reap_all (void) +@@ -784,6 +812,46 @@ reap_all (void) reap (-1); } @@ -2565,7 +2565,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c /* Clean up any remaining temporary files. */ static void -@@ -1214,7 +1283,7 @@ zaptemp (char const *name) +@@ -1224,7 +1292,7 @@ zaptemp (char const *name) free (node); } @@ -2574,7 +2574,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c static int struct_month_cmp (void const *m1, void const *m2) -@@ -1229,7 +1298,7 @@ struct_month_cmp (void const *m1, void c +@@ -1239,7 +1307,7 @@ struct_month_cmp (void const *m1, void c /* Initialize the character class tables. */ static void @@ -2583,7 +2583,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c { size_t i; -@@ -1241,7 +1310,7 @@ inittables (void) +@@ -1251,7 +1319,7 @@ inittables (void) fold_toupper[i] = toupper (i); } @@ -2592,7 +2592,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c /* If we're not in the "C" locale, read different names for months. */ if (hard_LC_TIME) { -@@ -1323,6 +1392,84 @@ specify_nmerge (int oi, char c, char con +@@ -1333,6 +1401,84 @@ specify_nmerge (int oi, char c, char con xstrtol_fatal (e, oi, c, long_options, s); } @@ -2677,7 +2677,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c /* Specify the amount of main memory to use when sorting. */ static void specify_sort_size (int oi, char c, char const *s) -@@ -1551,7 +1698,7 @@ buffer_linelim (struct buffer const *buf +@@ -1565,7 +1711,7 @@ buffer_linelim (struct buffer const *buf by KEY in LINE. */ static char * @@ -2686,7 +2686,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c { char *ptr = line->text, *lim = ptr + line->length - 1; size_t sword = key->sword; -@@ -1560,10 +1707,10 @@ begfield (struct line const *line, struc +@@ -1574,10 +1720,10 @@ begfield (struct line const *line, struc /* The leading field separator itself is included in a field when -t is absent. */ @@ -2699,7 +2699,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c ++ptr; if (ptr < lim) ++ptr; -@@ -1589,11 +1736,70 @@ begfield (struct line const *line, struc +@@ -1603,11 +1749,70 @@ begfield (struct line const *line, struc return ptr; } @@ -2771,7 +2771,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c { char *ptr = line->text, *lim = ptr + line->length - 1; size_t eword = key->eword, echar = key->echar; -@@ -1608,10 +1814,10 @@ limfield (struct line const *line, struc +@@ -1622,10 +1827,10 @@ limfield (struct line const *line, struc 'beginning' is the first character following the delimiting TAB. Otherwise, leave PTR pointing at the first 'blank' character after the preceding field. */ @@ -2784,7 +2784,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c ++ptr; if (ptr < lim && (eword || echar)) ++ptr; -@@ -1657,10 +1863,10 @@ limfield (struct line const *line, struc +@@ -1671,10 +1876,10 @@ limfield (struct line const *line, struc */ /* Make LIM point to the end of (one byte past) the current field. */ @@ -2797,7 +2797,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c if (newlim) lim = newlim; } -@@ -1691,6 +1897,130 @@ limfield (struct line const *line, struc +@@ -1705,6 +1910,130 @@ limfield (struct line const *line, struc return ptr; } @@ -2928,7 +2928,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c /* Fill BUF reading from FP, moving buf->left bytes from the end of buf->buf to the beginning first. If EOF is reached and the file wasn't terminated by a newline, supply one. Set up BUF's line -@@ -1777,8 +2107,22 @@ fillbuf (struct buffer *buf, FILE *fp, c +@@ -1791,8 +2120,22 @@ fillbuf (struct buffer *buf, FILE *fp, c else { if (key->skipsblanks) @@ -2953,7 +2953,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c line->keybeg = line_start; } } -@@ -1899,7 +2243,7 @@ human_numcompare (char const *a, char co +@@ -1913,7 +2256,7 @@ human_numcompare (char const *a, char co hideously fast. */ static int @@ -2962,7 +2962,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c { while (blanks[to_uchar (*a)]) a++; -@@ -1909,6 +2253,25 @@ numcompare (char const *a, char const *b +@@ -1923,6 +2266,25 @@ numcompare (char const *a, char const *b return strnumcmp (a, b, decimal_point, thousands_sep); } @@ -2988,7 +2988,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c /* Work around a problem whereby the long double value returned by glibc's strtold ("NaN", ...) contains uninitialized bits: clear all bytes of A and B before calling strtold. FIXME: remove this function once -@@ -1959,7 +2322,7 @@ general_numcompare (char const *sa, char +@@ -1973,7 +2335,7 @@ general_numcompare (char const *sa, char Return 0 if the name in S is not recognized. */ static int @@ -2997,7 +2997,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c { size_t lo = 0; size_t hi = MONTHS_PER_YEAR; -@@ -2234,15 +2597,14 @@ debug_key (struct line const *line, stru +@@ -2248,15 +2610,14 @@ debug_key (struct line const *line, stru char saved = *lim; *lim = '\0'; @@ -3015,7 +3015,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c else if (key->general_numeric) ignore_value (strtold (beg, &tighter_lim)); else if (key->numeric || key->human_numeric) -@@ -2386,7 +2748,7 @@ key_warnings (struct keyfield const *gke +@@ -2400,7 +2761,7 @@ key_warnings (struct keyfield const *gke bool maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key) && !(key->schar || key->echar); bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ @@ -3024,7 +3024,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c && ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned)) || (!key->skipsblanks && key->schar) || (!key->skipeblanks && key->echar))) -@@ -2444,11 +2806,83 @@ key_warnings (struct keyfield const *gke +@@ -2458,11 +2819,83 @@ key_warnings (struct keyfield const *gke error (0, 0, _("option '-r' only applies to last-resort comparison")); } @@ -3109,7 +3109,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c { struct keyfield *key = keylist; -@@ -2533,7 +2967,7 @@ keycompare (struct line const *a, struct +@@ -2547,7 +2980,7 @@ keycompare (struct line const *a, struct else if (key->human_numeric) diff = human_numcompare (ta, tb); else if (key->month) @@ -3118,7 +3118,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c else if (key->random) diff = compare_random (ta, tlena, tb, tlenb); else if (key->version) -@@ -2649,6 +3083,180 @@ keycompare (struct line const *a, struct +@@ -2663,6 +3096,180 @@ keycompare (struct line const *a, struct return key->reverse ? -diff : diff; } @@ -3299,7 +3299,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c /* Compare two lines A and B, returning negative, zero, or positive depending on whether A compares less than, equal to, or greater than B. */ -@@ -4109,7 +4717,7 @@ main (int argc, char **argv) +@@ -4158,7 +4765,7 @@ main (int argc, char **argv) initialize_exit_failure (SORT_FAILURE); hard_LC_COLLATE = hard_locale (LC_COLLATE); @@ -3308,7 +3308,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c hard_LC_TIME = hard_locale (LC_TIME); #endif -@@ -4130,6 +4738,29 @@ main (int argc, char **argv) +@@ -4179,6 +4786,29 @@ main (int argc, char **argv) thousands_sep = -1; } @@ -3338,7 +3338,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c have_read_stdin = false; inittables (); -@@ -4400,13 +5031,34 @@ main (int argc, char **argv) +@@ -4453,13 +5083,34 @@ main (int argc, char **argv) case 't': { @@ -3377,7 +3377,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c else { /* Provoke with 'sort -txx'. Complain about -@@ -4417,9 +5069,12 @@ main (int argc, char **argv) +@@ -4470,9 +5121,12 @@ main (int argc, char **argv) quote (optarg)); } } @@ -3392,9 +3392,9 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c } break; -diff -urNp coreutils-8.16-orig/src/unexpand.c coreutils-8.16/src/unexpand.c ---- coreutils-8.16-orig/src/unexpand.c 2012-03-24 21:26:51.000000000 +0100 -+++ coreutils-8.16/src/unexpand.c 2012-03-26 17:51:46.000000000 +0200 +diff -urNp coreutils-8.19-orig/src/unexpand.c coreutils-8.19/src/unexpand.c +--- coreutils-8.19-orig/src/unexpand.c 2012-07-21 16:54:31.000000000 +0200 ++++ coreutils-8.19/src/unexpand.c 2012-08-20 13:52:04.081596774 +0200 @@ -38,12 +38,29 @@ #include #include @@ -3648,9 +3648,9 @@ diff -urNp coreutils-8.16-orig/src/unexpand.c coreutils-8.16/src/unexpand.c if (have_read_stdin && fclose (stdin) != 0) error (EXIT_FAILURE, errno, "-"); -diff -urNp coreutils-8.16-orig/src/uniq.c coreutils-8.16/src/uniq.c ---- coreutils-8.16-orig/src/uniq.c 2012-03-24 21:26:51.000000000 +0100 -+++ coreutils-8.16/src/uniq.c 2012-03-26 17:35:09.000000000 +0200 +diff -urNp coreutils-8.19-orig/src/uniq.c coreutils-8.19/src/uniq.c +--- coreutils-8.19-orig/src/uniq.c 2012-07-21 16:54:31.000000000 +0200 ++++ coreutils-8.19/src/uniq.c 2012-08-20 13:52:04.083502506 +0200 @@ -21,6 +21,16 @@ #include #include @@ -4016,10 +4016,10 @@ diff -urNp coreutils-8.16-orig/src/uniq.c coreutils-8.16/src/uniq.c skip_chars = 0; skip_fields = 0; check_chars = SIZE_MAX; -diff -urNp coreutils-8.16-orig/tests/Makefile.am coreutils-8.16/tests/Makefile.am ---- coreutils-8.16-orig/tests/Makefile.am 2012-03-26 18:01:35.564014659 +0200 -+++ coreutils-8.16/tests/Makefile.am 2012-03-26 18:02:01.023015013 +0200 -@@ -242,6 +242,7 @@ TESTS = \ +diff -urNp coreutils-8.19-orig/tests/Makefile.am coreutils-8.19/tests/Makefile.am +--- coreutils-8.19-orig/tests/Makefile.am 2012-08-20 13:51:39.856841699 +0200 ++++ coreutils-8.19/tests/Makefile.am 2012-08-20 13:52:04.085491266 +0200 +@@ -247,6 +247,7 @@ TESTS = \ misc/sort-debug-warn \ misc/sort-discrim \ misc/sort-files0-from \ @@ -4027,7 +4027,7 @@ diff -urNp coreutils-8.16-orig/tests/Makefile.am coreutils-8.16/tests/Makefile.a misc/sort-float \ misc/sort-merge \ misc/sort-merge-fdlimit \ -@@ -537,6 +538,10 @@ TESTS = \ +@@ -551,6 +552,10 @@ TESTS = \ $(root_tests) pr_data = \ @@ -4038,9 +4038,9 @@ diff -urNp coreutils-8.16-orig/tests/Makefile.am coreutils-8.16/tests/Makefile.a pr/0F \ pr/0FF \ pr/0FFnt \ -diff -urNp coreutils-8.16-orig/tests/misc/cut coreutils-8.16/tests/misc/cut ---- coreutils-8.16-orig/tests/misc/cut 2012-02-03 10:22:06.000000000 +0100 -+++ coreutils-8.16/tests/misc/cut 2012-03-26 17:40:49.000000000 +0200 +diff -urNp coreutils-8.19-orig/tests/misc/cut coreutils-8.19/tests/misc/cut +--- coreutils-8.19-orig/tests/misc/cut 2012-07-21 16:54:31.000000000 +0200 ++++ coreutils-8.19/tests/misc/cut 2012-08-20 13:52:04.086593767 +0200 @@ -23,14 +23,15 @@ use strict; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -4070,41 +4070,98 @@ diff -urNp coreutils-8.16-orig/tests/misc/cut coreutils-8.16/tests/misc/cut ['inval2', qw(-f -), {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], ['inval3', '-f', '4,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], ['inval4', '-f', '1-2,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, -diff -urNp coreutils-8.16-orig/tests/misc/mb1.I coreutils-8.16/tests/misc/mb1.I ---- coreutils-8.16-orig/tests/misc/mb1.I 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.16/tests/misc/mb1.I 2012-03-26 17:35:09.000000000 +0200 +diff -urNp coreutils-8.19-orig/tests/misc/expand coreutils-8.19/tests/misc/expand +--- coreutils-8.19-orig/tests/misc/expand 2012-07-21 16:54:31.000000000 +0200 ++++ coreutils-8.19/tests/misc/expand 2012-08-20 13:55:44.188467648 +0200 +@@ -23,6 +23,15 @@ use strict; + # Turn off localization of executable's output. + @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; + ++# uncommented according to upstream commit enabling multibyte paths ++my $mb_locale = $ENV{LOCALE_FR_UTF8}; ++! defined $mb_locale || $mb_locale eq 'none' ++ and $mb_locale = 'C'; ++ ++my $prog = 'expand'; ++my $try = "Try \`$prog --help' for more information.\n"; ++my $inval = "$prog: invalid byte, character or field list\n$try"; ++ + my @Tests = + ( + ['t1', '--tabs=3', {IN=>"a\tb"}, {OUT=>"a b"}], +@@ -31,6 +40,37 @@ my @Tests = + ['i2', '--tabs=3 -i', {IN=>" \ta\tb"}, {OUT=>" a\tb"}], + ); + ++if ($mb_locale ne 'C') ++ { ++ # Duplicate each test vector, appending "-mb" to the test name and ++ # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we ++ # provide coverage for the distro-added multi-byte code paths. ++ my @new; ++ foreach my $t (@Tests) ++ { ++ my @new_t = @$t; ++ my $test_name = shift @new_t; ++ ++ # Depending on whether expand is multi-byte-patched, ++ # it emits different diagnostics: ++ # non-MB: invalid byte or field list ++ # MB: invalid byte, character or field list ++ # Adjust the expected error output accordingly. ++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval} ++ (@new_t)) ++ { ++ my $sub = {ERR_SUBST => 's/, character//'}; ++ push @new_t, $sub; ++ push @$t, $sub; ++ } ++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; ++ } ++ push @Tests, @new; ++ } ++ ++ ++@Tests = triple_test \@Tests; ++ + my $save_temps = $ENV{DEBUG}; + my $verbose = $ENV{VERBOSE}; + +diff -urNp coreutils-8.19-orig/tests/misc/mb1.I coreutils-8.19/tests/misc/mb1.I +--- coreutils-8.19-orig/tests/misc/mb1.I 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.19/tests/misc/mb1.I 2012-08-20 13:52:04.086593767 +0200 @@ -0,0 +1,4 @@ +Apple@10 +Banana@5 +Citrus@20 +Cherry@30 -diff -urNp coreutils-8.16-orig/tests/misc/mb1.X coreutils-8.16/tests/misc/mb1.X ---- coreutils-8.16-orig/tests/misc/mb1.X 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.16/tests/misc/mb1.X 2012-03-26 17:35:09.000000000 +0200 +diff -urNp coreutils-8.19-orig/tests/misc/mb1.X coreutils-8.19/tests/misc/mb1.X +--- coreutils-8.19-orig/tests/misc/mb1.X 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.19/tests/misc/mb1.X 2012-08-20 13:52:04.087526516 +0200 @@ -0,0 +1,4 @@ +Banana@5 +Apple@10 +Citrus@20 +Cherry@30 -diff -urNp coreutils-8.16-orig/tests/misc/mb2.I coreutils-8.16/tests/misc/mb2.I ---- coreutils-8.16-orig/tests/misc/mb2.I 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.16/tests/misc/mb2.I 2012-03-26 17:35:09.000000000 +0200 +diff -urNp coreutils-8.19-orig/tests/misc/mb2.I coreutils-8.19/tests/misc/mb2.I +--- coreutils-8.19-orig/tests/misc/mb2.I 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.19/tests/misc/mb2.I 2012-08-20 13:52:04.088593815 +0200 @@ -0,0 +1,4 @@ +Apple@AA10@@20 +Banana@AA5@@30 +Citrus@AA20@@5 +Cherry@AA30@@10 -diff -urNp coreutils-8.16-orig/tests/misc/mb2.X coreutils-8.16/tests/misc/mb2.X ---- coreutils-8.16-orig/tests/misc/mb2.X 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.16/tests/misc/mb2.X 2012-03-26 17:35:09.000000000 +0200 +diff -urNp coreutils-8.19-orig/tests/misc/mb2.X coreutils-8.19/tests/misc/mb2.X +--- coreutils-8.19-orig/tests/misc/mb2.X 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.19/tests/misc/mb2.X 2012-08-20 13:52:04.088593815 +0200 @@ -0,0 +1,4 @@ +Citrus@AA20@@5 +Cherry@AA30@@10 +Apple@AA10@@20 +Banana@AA5@@30 -diff -urNp coreutils-8.16-orig/tests/misc/sort-mb-tests coreutils-8.16/tests/misc/sort-mb-tests ---- coreutils-8.16-orig/tests/misc/sort-mb-tests 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.16/tests/misc/sort-mb-tests 2012-03-26 17:35:09.000000000 +0200 +diff -urNp coreutils-8.19-orig/tests/misc/sort-mb-tests coreutils-8.19/tests/misc/sort-mb-tests +--- coreutils-8.19-orig/tests/misc/sort-mb-tests 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.19/tests/misc/sort-mb-tests 2012-08-20 13:52:04.089593318 +0200 @@ -0,0 +1,58 @@ +#! /bin/sh +case $# in diff --git a/coreutils.spec b/coreutils.spec index 8a07c90..9cb8f55 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -376,6 +376,7 @@ fi %changelog * Mon Aug 20 2012 Ondrej Vasik 8.19-1 - new upstream release 8.19 +- fix multibyte issues in cut and expand (M.Briza, #821260) * Sun Aug 12 2012 Ondrej Vasik 8.18-1 - new upstream release 8.18