diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index 0860224..a9a1a4c 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -1,14 +1,20 @@ - lib/linebuffer.h | 8 + - src/cut.c | 420 ++++++++++++++++++++++++++++++-- - src/expand.c | 160 ++++++++++++- - src/fold.c | 309 +++++++++++++++++++++-- - src/join.c | 347 +++++++++++++++++++++++---- - src/pr.c | 431 +++++++++++++++++++++++++++++--- - src/sort.c | 704 ++++++++++++++++++++++++++++++++++++++++++++++++++--- - src/unexpand.c | 226 +++++++++++++++++- - src/uniq.c | 259 +++++++++++++++++++- - tests/Makefile.am | 5 + - 10 files changed, 2689 insertions(+), 180 deletions(-) + lib/linebuffer.h | 8 + + src/cut.c | 420 +++++++++++++++++++++++++-- + src/expand.c | 160 ++++++++++- + src/fold.c | 309 ++++++++++++++++++-- + src/join.c | 347 +++++++++++++++++++--- + src/pr.c | 431 +++++++++++++++++++++++++--- + src/sort.c | 722 +++++++++++++++++++++++++++++++++++++++++++--- + src/unexpand.c | 226 ++++++++++++++- + src/uniq.c | 259 ++++++++++++++++- + tests/Makefile.am | 5 + + tests/misc/cut | 4 +- + tests/misc/mb1.I | 4 + + tests/misc/mb1.X | 4 + + tests/misc/mb2.I | 4 + + tests/misc/mb2.X | 4 + + tests/misc/sort-mb-tests | 58 ++++ + 16 files changed, 2783 insertions(+), 182 deletions(-) diff -urNp coreutils-8.6-orig/lib/linebuffer.h coreutils-8.6/lib/linebuffer.h --- coreutils-8.6-orig/lib/linebuffer.h 2010-06-10 18:45:26.000000000 +0200 @@ -2454,12 +2460,8 @@ index 7e25f6a..d3f8915 100644 #include "system.h" #include "argmatch.h" #include "error.h" -@@ -157,14 +166,38 @@ static int decimal_point; - /* Thousands separator; if -1, then there isn't one. */ - static int thousands_sep; +@@ -159,12 +168,34 @@ static int thousands_sep; -+static int force_general_numcompare = 0; -+ /* Nonzero if the corresponding locales are hard. */ static bool hard_LC_COLLATE; -#if HAVE_NL_LANGINFO @@ -2494,7 +2496,7 @@ index 7e25f6a..d3f8915 100644 /* The kind of blanks for '-b' to skip in various options. */ enum blanktype { bl_start, bl_end, bl_both }; -@@ -328,13 +361,11 @@ static bool reverse; +@@ -328,13 +359,11 @@ static bool reverse; they were read if all keys compare equal. */ static bool stable; @@ -2511,7 +2513,7 @@ index 7e25f6a..d3f8915 100644 /* Flag to remove consecutive duplicate lines from the output. Only the last of a sequence of equal lines will be output. */ -@@ -782,6 +813,46 @@ reap_some (void) +@@ -782,6 +811,46 @@ reap_some (void) update_proc (pid); } @@ -2523,7 +2525,7 @@ index 7e25f6a..d3f8915 100644 +static char * +(*limfield) (const struct line*, const struct keyfield *); +static void -+(*skipblanks) (const char **ptr, const char *lim); ++(*skipblanks) (char **ptr, char *lim); +static int +(*getmonth) (char const *, size_t, char **); +static int @@ -2558,7 +2560,7 @@ index 7e25f6a..d3f8915 100644 /* Clean up any remaining temporary files. */ static void -@@ -1205,7 +1276,7 @@ zaptemp (char const *name) +@@ -1205,7 +1274,7 @@ zaptemp (char const *name) free (node); } @@ -2567,7 +2569,7 @@ index 7e25f6a..d3f8915 100644 static int struct_month_cmp (void const *m1, void const *m2) -@@ -1220,7 +1291,7 @@ struct_month_cmp (void const *m1, void const *m2) +@@ -1220,7 +1289,7 @@ struct_month_cmp (void const *m1, void const *m2) /* Initialize the character class tables. */ static void @@ -2576,7 +2578,7 @@ index 7e25f6a..d3f8915 100644 { size_t i; -@@ -1232,7 +1303,7 @@ inittables (void) +@@ -1232,7 +1301,7 @@ inittables (void) fold_toupper[i] = toupper (i); } @@ -2585,7 +2587,7 @@ index 7e25f6a..d3f8915 100644 /* If we're not in the "C" locale, read different names for months. */ if (hard_LC_TIME) { -@@ -1314,6 +1385,64 @@ specify_nmerge (int oi, char c, char const *s) +@@ -1314,6 +1383,84 @@ specify_nmerge (int oi, char c, char const *s) xstrtol_fatal (e, oi, c, long_options, s); } @@ -2594,12 +2596,25 @@ index 7e25f6a..d3f8915 100644 +inittables_mb (void) +{ + int i, j, k, l; -+ char *name, *s; ++ char *name, *s, *lc_time, *lc_ctype; + size_t s_len, mblength; + char mbc[MB_LEN_MAX]; + wchar_t wc, pwc; + mbstate_t state_mb, state_wc; + ++ lc_time = setlocale (LC_TIME, ""); ++ if (lc_time) ++ lc_time = xstrdup (lc_time); ++ ++ lc_ctype = setlocale (LC_CTYPE, ""); ++ if (lc_ctype) ++ lc_ctype = xstrdup (lc_ctype); ++ ++ if (lc_time && lc_ctype) ++ /* temporarily set LC_CTYPE to match LC_TIME, so that we can convert ++ * the names of months to upper case */ ++ setlocale (LC_CTYPE, lc_time); ++ + for (i = 0; i < MONTHS_PER_YEAR; i++) + { + s = (char *) nl_langinfo (ABMON_1 + i); @@ -2644,13 +2659,20 @@ index 7e25f6a..d3f8915 100644 + } + qsort ((void *) monthtab, MONTHS_PER_YEAR, + sizeof (struct month), struct_month_cmp); ++ ++ if (lc_time && lc_ctype) ++ /* restore the original locales */ ++ setlocale (LC_CTYPE, lc_ctype); ++ ++ free (lc_ctype); ++ free (lc_time); +} +#endif + /* Specify the amount of main memory to use when sorting. */ static void specify_sort_size (int oi, char c, char const *s) -@@ -1540,7 +1669,7 @@ buffer_linelim (struct buffer const *buf) +@@ -1540,7 +1687,7 @@ buffer_linelim (struct buffer const *buf) by KEY in LINE. */ static char * @@ -2659,7 +2681,7 @@ index 7e25f6a..d3f8915 100644 { char *ptr = line->text, *lim = ptr + line->length - 1; size_t sword = key->sword; -@@ -1549,10 +1678,10 @@ begfield (struct line const *line, struct keyfield const *key) +@@ -1549,10 +1696,10 @@ begfield (struct line const *line, struct keyfield const *key) /* The leading field separator itself is included in a field when -t is absent. */ @@ -2672,7 +2694,7 @@ index 7e25f6a..d3f8915 100644 ++ptr; if (ptr < lim) ++ptr; -@@ -1578,11 +1707,70 @@ begfield (struct line const *line, struct keyfield const *key) +@@ -1578,11 +1725,70 @@ begfield (struct line const *line, struct keyfield const *key) return ptr; } @@ -2744,7 +2766,7 @@ index 7e25f6a..d3f8915 100644 { char *ptr = line->text, *lim = ptr + line->length - 1; size_t eword = key->eword, echar = key->echar; -@@ -1597,10 +1785,10 @@ limfield (struct line const *line, struct keyfield const *key) +@@ -1597,10 +1803,10 @@ limfield (struct line const *line, struct keyfield const *key) `beginning' is the first character following the delimiting TAB. Otherwise, leave PTR pointing at the first `blank' character after the preceding field. */ @@ -2757,7 +2779,7 @@ index 7e25f6a..d3f8915 100644 ++ptr; if (ptr < lim && (eword || echar)) ++ptr; -@@ -1646,10 +1834,10 @@ limfield (struct line const *line, struct keyfield const *key) +@@ -1646,10 +1852,10 @@ limfield (struct line const *line, struct keyfield const *key) */ /* Make LIM point to the end of (one byte past) the current field. */ @@ -2770,7 +2792,7 @@ index 7e25f6a..d3f8915 100644 if (newlim) lim = newlim; } -@@ -1680,6 +1868,130 @@ limfield (struct line const *line, struct keyfield const *key) +@@ -1680,6 +1886,130 @@ limfield (struct line const *line, struct keyfield const *key) return ptr; } @@ -2882,7 +2904,7 @@ index 7e25f6a..d3f8915 100644 +#endif + +static void -+skipblanks_uni (const char **ptr, const char *lim) ++skipblanks_uni (char **ptr, char *lim) +{ + while (*ptr < lim && blanks[to_uchar (**ptr)]) + ++(*ptr); @@ -2890,7 +2912,7 @@ index 7e25f6a..d3f8915 100644 + +#if HAVE_MBRTOWC +static void -+skipblanks_mb (const char **ptr, const char *lim) ++skipblanks_mb (char **ptr, char *lim) +{ + size_t mblength; + while (*ptr < lim && ismbblank (*ptr, lim - *ptr, &mblength)) @@ -2901,7 +2923,7 @@ index 7e25f6a..d3f8915 100644 /* 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 -@@ -1766,8 +2078,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file) +@@ -1766,8 +2096,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file) else { if (key->skipsblanks) @@ -2926,7 +2948,7 @@ index 7e25f6a..d3f8915 100644 line->keybeg = line_start; } } -@@ -1888,7 +2214,7 @@ human_numcompare (char const *a, char const *b) +@@ -1888,7 +2232,7 @@ human_numcompare (char const *a, char const *b) hideously fast. */ static int @@ -2935,7 +2957,7 @@ index 7e25f6a..d3f8915 100644 { while (blanks[to_uchar (*a)]) a++; -@@ -1898,6 +2224,25 @@ numcompare (char const *a, char const *b) +@@ -1898,6 +2242,25 @@ numcompare (char const *a, char const *b) return strnumcmp (a, b, decimal_point, thousands_sep); } @@ -2961,7 +2983,7 @@ index 7e25f6a..d3f8915 100644 static int general_numcompare (char const *sa, char const *sb) { -@@ -1930,7 +2275,7 @@ general_numcompare (char const *sa, char const *sb) +@@ -1930,7 +2293,7 @@ general_numcompare (char const *sa, char const *sb) Return 0 if the name in S is not recognized. */ static int @@ -2970,7 +2992,7 @@ index 7e25f6a..d3f8915 100644 { size_t lo = 0; size_t hi = MONTHS_PER_YEAR; -@@ -2204,13 +2549,12 @@ debug_key (struct line const *line, struct keyfield const *key) +@@ -2204,13 +2567,12 @@ debug_key (struct line const *line, struct keyfield const *key) { char saved = *lim; *lim = '\0'; @@ -2986,7 +3008,7 @@ index 7e25f6a..d3f8915 100644 else if (key->general_numeric) ignore_value (strtold (beg, &tighter_lim)); else if (key->numeric || key->human_numeric) -@@ -2354,7 +2698,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) +@@ -2354,7 +2716,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) 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 */ @@ -2995,7 +3017,7 @@ index 7e25f6a..d3f8915 100644 && ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned)) || (!key->skipsblanks && key->schar) || (!key->skipeblanks && key->echar))) -@@ -2412,11 +2756,83 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) +@@ -2412,11 +2774,83 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) error (0, 0, _("option `-r' only applies to last-resort comparison")); } @@ -3080,7 +3102,7 @@ index 7e25f6a..d3f8915 100644 { struct keyfield *key = keylist; -@@ -2501,7 +2917,7 @@ keycompare (struct line const *a, struct line const *b) +@@ -2501,7 +2935,7 @@ keycompare (struct line const *a, struct line const *b) else if (key->human_numeric) diff = human_numcompare (ta, tb); else if (key->month) @@ -3089,7 +3111,7 @@ index 7e25f6a..d3f8915 100644 else if (key->random) diff = compare_random (ta, tlena, tb, tlenb); else if (key->version) -@@ -2617,6 +3033,179 @@ keycompare (struct line const *a, struct line const *b) +@@ -2617,6 +3051,179 @@ keycompare (struct line const *a, struct line const *b) return key->reverse ? -diff : diff; } @@ -3269,7 +3291,7 @@ index 7e25f6a..d3f8915 100644 /* Compare two lines A and B, returning negative, zero, or positive depending on whether A compares less than, equal to, or greater than B. */ -@@ -4006,7 +4595,7 @@ main (int argc, char **argv) +@@ -4006,7 +4613,7 @@ main (int argc, char **argv) initialize_exit_failure (SORT_FAILURE); hard_LC_COLLATE = hard_locale (LC_COLLATE); @@ -3278,7 +3300,7 @@ index 7e25f6a..d3f8915 100644 hard_LC_TIME = hard_locale (LC_TIME); #endif -@@ -4027,6 +4616,29 @@ main (int argc, char **argv) +@@ -4027,6 +4634,29 @@ main (int argc, char **argv) thousands_sep = -1; } @@ -3308,7 +3330,7 @@ index 7e25f6a..d3f8915 100644 have_read_stdin = false; inittables (); -@@ -4297,13 +4909,34 @@ main (int argc, char **argv) +@@ -4297,13 +4927,34 @@ main (int argc, char **argv) case 't': { @@ -3347,7 +3369,7 @@ index 7e25f6a..d3f8915 100644 else { /* Provoke with `sort -txx'. Complain about -@@ -4314,9 +4947,12 @@ main (int argc, char **argv) +@@ -4314,9 +4965,12 @@ main (int argc, char **argv) quote (optarg)); } } diff --git a/coreutils.spec b/coreutils.spec index baae402..ecd37f3 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 8.6 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -336,6 +336,10 @@ fi %{_libdir}/coreutils %changelog +* Wed Nov 03 2010 Kamil Dudka - 8.6-3 +- prevent sort from assertion failure in case LC_CTYPE does not match LC_TIME + (#647938) + * Tue Oct 26 2010 Kamil Dudka - 8.6-2 - improve i18n support in sort (debug-keys test is now back)