diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index 9bd30c6..5ac94b7 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -1,3 +1,21 @@ + lib/linebuffer.h | 8 + + src/cut.c | 420 ++++++++++++++++++++++++++-- + src/expand.c | 160 +++++++++++- + src/fold.c | 309 +++++++++++++++++++-- + src/join.c | 345 ++++++++++++++++++++--- + src/pr.c | 431 ++++++++++++++++++++++++++--- + src/sort.c | 692 ++++++++++++++++++++++++++++++++++++++++++++-- + 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, 2757 insertions(+), 176 deletions(-) + diff -urNp coreutils-8.5-orig/lib/linebuffer.h coreutils-8.5/lib/linebuffer.h --- coreutils-8.5-orig/lib/linebuffer.h 2010-04-23 15:44:00.000000000 +0200 +++ coreutils-8.5/lib/linebuffer.h 2010-04-26 14:24:33.000000000 +0200 @@ -2433,12 +2451,8 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c #include "system.h" #include "argmatch.h" #include "error.h" -@@ -124,14 +133,38 @@ static int decimal_point; - /* Thousands separator; if -1, then there isn't one. */ - static int thousands_sep; +@@ -126,12 +135,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 @@ -2473,7 +2487,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c /* The kind of blanks for '-b' to skip in various options. */ enum blanktype { bl_start, bl_end, bl_both }; -@@ -270,13 +303,11 @@ static bool reverse; +@@ -270,13 +301,11 @@ static bool reverse; they were read if all keys compare equal. */ static bool stable; @@ -2490,7 +2504,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c /* Flag to remove consecutive duplicate lines from the output. Only the last of a sequence of equal lines will be output. */ -@@ -714,6 +745,44 @@ reap_some (void) +@@ -714,6 +743,44 @@ reap_some (void) update_proc (pid); } @@ -2535,7 +2549,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c /* Clean up any remaining temporary files. */ static void -@@ -1158,7 +1227,7 @@ zaptemp (const char *name) +@@ -1158,7 +1225,7 @@ zaptemp (const char *name) free (node); } @@ -2544,7 +2558,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c static int struct_month_cmp (const void *m1, const void *m2) -@@ -1173,7 +1242,7 @@ struct_month_cmp (const void *m1, const +@@ -1173,7 +1240,7 @@ struct_month_cmp (const void *m1, const void *m2) /* Initialize the character class tables. */ static void @@ -2553,7 +2567,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c { size_t i; -@@ -1185,7 +1254,7 @@ inittables (void) +@@ -1185,7 +1252,7 @@ inittables (void) fold_toupper[i] = toupper (i); } @@ -2562,7 +2576,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c /* If we're not in the "C" locale, read different names for months. */ if (hard_LC_TIME) { -@@ -1268,6 +1337,64 @@ specify_nmerge (int oi, char c, char con +@@ -1268,6 +1335,84 @@ specify_nmerge (int oi, char c, char const *s) xstrtol_fatal (e, oi, c, long_options, s); } @@ -2571,12 +2585,25 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c +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); @@ -2621,13 +2648,20 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c + } + 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) -@@ -1478,7 +1605,7 @@ buffer_linelim (struct buffer const *buf +@@ -1478,7 +1623,7 @@ buffer_linelim (struct buffer const *buf) by KEY in LINE. */ static char * @@ -2636,7 +2670,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c { char *ptr = line->text, *lim = ptr + line->length - 1; size_t sword = key->sword; -@@ -1487,10 +1614,10 @@ begfield (const struct line *line, const +@@ -1487,10 +1632,10 @@ begfield (const struct line *line, const struct keyfield *key) /* The leading field separator itself is included in a field when -t is absent. */ @@ -2649,7 +2683,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c ++ptr; if (ptr < lim) ++ptr; -@@ -1516,11 +1643,70 @@ begfield (const struct line *line, const +@@ -1516,11 +1661,70 @@ begfield (const struct line *line, const struct keyfield *key) return ptr; } @@ -2721,7 +2755,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c { char *ptr = line->text, *lim = ptr + line->length - 1; size_t eword = key->eword, echar = key->echar; -@@ -1535,10 +1721,10 @@ limfield (const struct line *line, const +@@ -1535,10 +1739,10 @@ limfield (const struct line *line, const struct keyfield *key) `beginning' is the first character following the delimiting TAB. Otherwise, leave PTR pointing at the first `blank' character after the preceding field. */ @@ -2734,7 +2768,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c ++ptr; if (ptr < lim && (eword || echar)) ++ptr; -@@ -1584,10 +1770,10 @@ limfield (const struct line *line, const +@@ -1584,10 +1788,10 @@ limfield (const struct line *line, const struct keyfield *key) */ /* Make LIM point to the end of (one byte past) the current field. */ @@ -2747,7 +2781,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c if (newlim) lim = newlim; } -@@ -1618,6 +1804,113 @@ limfield (const struct line *line, const +@@ -1618,6 +1822,113 @@ limfield (const struct line *line, const struct keyfield *key) return ptr; } @@ -2861,7 +2895,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/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 -@@ -1700,8 +1993,24 @@ fillbuf (struct buffer *buf, FILE *fp, c +@@ -1700,8 +2011,24 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file) else { if (key->skipsblanks) @@ -2888,7 +2922,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c line->keybeg = line_start; } } -@@ -1739,7 +2048,7 @@ fillbuf (struct buffer *buf, FILE *fp, c +@@ -1739,7 +2066,7 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file) hideously fast. */ static int @@ -2897,7 +2931,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c { while (blanks[to_uchar (*a)]) a++; -@@ -1848,6 +2157,25 @@ human_numcompare (const char *a, const c +@@ -1848,6 +2175,25 @@ human_numcompare (const char *a, const char *b, struct keyfield *key) : strnumcmp (a, b, decimal_point, thousands_sep)); } @@ -2923,7 +2957,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c static int general_numcompare (const char *sa, const char *sb) { -@@ -1881,7 +2209,7 @@ general_numcompare (const char *sa, cons +@@ -1881,7 +2227,7 @@ general_numcompare (const char *sa, const char *sb) Return 0 if the name in S is not recognized. */ static int @@ -2932,7 +2966,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c { size_t lo = 0; size_t hi = MONTHS_PER_YEAR; -@@ -2062,11 +2390,80 @@ compare_version (char *restrict texta, s +@@ -2062,11 +2408,80 @@ compare_version (char *restrict texta, size_t lena, return diff; } @@ -3014,7 +3048,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c { struct keyfield *key = keylist; -@@ -2246,6 +2642,179 @@ keycompare (const struct line *a, const +@@ -2246,6 +2661,179 @@ keycompare (const struct line *a, const struct line *b) return key->reverse ? -diff : diff; } @@ -3194,7 +3228,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/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. */ -@@ -3244,7 +3813,7 @@ main (int argc, char **argv) +@@ -3244,7 +3832,7 @@ main (int argc, char **argv) initialize_exit_failure (SORT_FAILURE); hard_LC_COLLATE = hard_locale (LC_COLLATE); @@ -3203,7 +3237,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c hard_LC_TIME = hard_locale (LC_TIME); #endif -@@ -3265,6 +3834,27 @@ main (int argc, char **argv) +@@ -3265,6 +3853,27 @@ main (int argc, char **argv) thousands_sep = -1; } @@ -3231,7 +3265,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c have_read_stdin = false; inittables (); -@@ -3536,13 +4126,35 @@ main (int argc, char **argv) +@@ -3536,13 +4145,35 @@ main (int argc, char **argv) case 't': { @@ -3271,7 +3305,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c else { /* Provoke with `sort -txx'. Complain about -@@ -3553,9 +4165,12 @@ main (int argc, char **argv) +@@ -3553,9 +4184,12 @@ main (int argc, char **argv) quote (optarg)); } } diff --git a/coreutils.spec b/coreutils.spec index 8d9a781..fd2460c 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.5 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -348,6 +348,10 @@ fi %{_libdir}/coreutils %changelog +* Wed Nov 03 2010 Kamil Dudka - 8.5-7 +- prevent sort from assertion failure in case LC_CTYPE does not match LC_TIME + (#647938) + * Fri Oct 01 2010 Ondrej Vasik - 8.5-6 - various fixes for case conversion in tr(#611274) - change assertion failure for invalid multibyte input