From 72b7ef7f55d513c096a44ff22ead3a026c907727 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:49:47 +0200 Subject: [PATCH 1/8] fix possible free memory read and dataloss in sort -u (upstream fix), multibyte fixes in cut and expand (by M.Briza, #821260) --- coreutils-8.17-sort-uniq-fmr.patch | 51 ++++++++++ coreutils-i18n.patch | 156 ++++++++++++++--------------- coreutils.spec | 7 ++ 3 files changed, 136 insertions(+), 78 deletions(-) create mode 100644 coreutils-8.17-sort-uniq-fmr.patch diff --git a/coreutils-8.17-sort-uniq-fmr.patch b/coreutils-8.17-sort-uniq-fmr.patch new file mode 100644 index 0000000..fb7118a --- /dev/null +++ b/coreutils-8.17-sort-uniq-fmr.patch @@ -0,0 +1,51 @@ +diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c +--- coreutils-8.17-orig/src/sort.c 2012-08-20 13:15:39.703470009 +0200 ++++ coreutils-8.17/src/sort.c 2012-08-20 13:29:47.177468563 +0200 +@@ -292,6 +292,9 @@ struct merge_node_queue + when popping. */ + }; + ++/* Used to implement --unique (-u). */ ++static struct line saved_line; ++ + /* FIXME: None of these tables work with multibyte character sets. + Also, there are many other bugs when handling multibyte characters. + One way to fix this is to rewrite 'sort' to use wide characters +@@ -3943,13 +3946,12 @@ queue_pop (struct merge_node_queue *queu + static void + write_unique (struct line const *line, FILE *tfp, char const *temp_output) + { +- static struct line saved; + + if (unique) + { +- if (saved.text && ! compare (line, &saved)) ++ if (saved_line.text && ! compare (line, &saved_line)) + return; +- saved = *line; ++ saved_line = *line; + } + + write_line (line, tfp, temp_output); +@@ -4451,6 +4453,7 @@ sort (char *const *files, size_t nfiles, + break; + } + ++ saved_line.text = NULL; + line = buffer_linelim (&buf); + if (buf.eof && !nfiles && !ntemps && !buf.left) + { +diff -urNp coreutils-8.17-orig/tests/misc/sort coreutils-8.17/tests/misc/sort +--- coreutils-8.17-orig/tests/misc/sort 2012-02-03 10:22:06.000000000 +0100 ++++ coreutils-8.17/tests/misc/sort 2012-08-20 13:31:38.685565488 +0200 +@@ -226,6 +226,10 @@ my @Tests = + ["15c", '-i -u', {IN=>"a\1\na\n"}, {OUT=>"a\1\n"}], + ["15d", '-i -u', {IN=>"\1a\na\n"}, {OUT=>"\1a\n"}], + ["15e", '-i -u', {IN=>"a\n\1\1\1\1\1a\1\1\1\1\n"}, {OUT=>"a\n"}], ++# Before 8.19, this would trigger a free-memory read. ++["unique-free-mem-read", '-u --p=1 -S32b', ++ {IN=>"a\n"."b"x900 ."\n"}, ++ {OUT=>"a\n"."b"x900 ."\n"}], + + # From Erick Branderhorst -- fixed around 1.19e + ["16a", '-f', diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index 5b0d3b8..7ddc72c 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.17-orig/lib/linebuffer.h coreutils-8.17/lib/linebuffer.h +--- coreutils-8.17-orig/lib/linebuffer.h 2012-01-06 10:14:31.000000000 +0100 ++++ coreutils-8.17/lib/linebuffer.h 2012-08-20 12:52:26.658468803 +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.17-orig/src/cut.c coreutils-8.17/src/cut.c +--- coreutils-8.17-orig/src/cut.c 2012-05-02 10:31:47.000000000 +0200 ++++ coreutils-8.17/src/cut.c 2012-08-20 12:57:52.533805458 +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.17-orig/src/expand.c coreutils-8.17/src/expand.c +--- coreutils-8.17-orig/src/expand.c 2012-05-01 22:55:08.000000000 +0200 ++++ coreutils-8.17/src/expand.c 2012-08-20 12:59:28.995468227 +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.17-orig/src/fold.c coreutils-8.17/src/fold.c +--- coreutils-8.17-orig/src/fold.c 2012-04-29 13:45:30.000000000 +0200 ++++ coreutils-8.17/src/fold.c 2012-08-20 12:52:26.662467902 +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.17-orig/src/join.c coreutils-8.17/src/join.c +--- coreutils-8.17-orig/src/join.c 2012-05-02 10:31:47.000000000 +0200 ++++ coreutils-8.17/src/join.c 2012-08-20 12:52:26.664470970 +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.17-orig/src/pr.c coreutils-8.17/src/pr.c +--- coreutils-8.17-orig/src/pr.c 2012-05-10 09:14:30.000000000 +0200 ++++ coreutils-8.17/src/pr.c 2012-08-20 12:52:26.669468730 +0200 @@ -312,6 +312,32 @@ #include @@ -2448,8 +2448,8 @@ diff -urNp coreutils-8.16-orig/src/pr.c coreutils-8.16/src/pr.c 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 +--- coreutils-8.17-orig/src/sort.c 2012-05-04 12:06:22.000000000 +0200 ++++ coreutils-8.17/src/sort.c 2012-08-20 12:52:26.675467884 +0200 @@ -22,12 +22,21 @@ #include @@ -2472,7 +2472,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; +@@ -165,12 +174,34 @@ static int thousands_sep; /* Nonzero if the corresponding locales are hard. */ static bool hard_LC_COLLATE; @@ -2508,7 +2508,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; +@@ -341,13 +372,11 @@ static bool reverse; they were read if all keys compare equal. */ static bool stable; @@ -2525,7 +2525,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) +@@ -780,6 +809,46 @@ reap_all (void) reap (-1); } @@ -2572,7 +2572,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) +@@ -1212,7 +1281,7 @@ zaptemp (char const *name) free (node); } @@ -2581,7 +2581,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 +@@ -1227,7 +1296,7 @@ struct_month_cmp (void const *m1, void c /* Initialize the character class tables. */ static void @@ -2590,7 +2590,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) +@@ -1239,7 +1308,7 @@ inittables (void) fold_toupper[i] = toupper (i); } @@ -2599,7 +2599,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 +@@ -1321,6 +1390,84 @@ specify_nmerge (int oi, char c, char con xstrtol_fatal (e, oi, c, long_options, s); } @@ -2684,7 +2684,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 +@@ -1549,7 +1696,7 @@ buffer_linelim (struct buffer const *buf by KEY in LINE. */ static char * @@ -2693,7 +2693,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 +@@ -1558,10 +1705,10 @@ begfield (struct line const *line, struc /* The leading field separator itself is included in a field when -t is absent. */ @@ -2706,7 +2706,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 +@@ -1587,11 +1734,70 @@ begfield (struct line const *line, struc return ptr; } @@ -2778,7 +2778,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 +@@ -1606,10 +1812,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. */ @@ -2791,7 +2791,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 +@@ -1655,10 +1861,10 @@ limfield (struct line const *line, struc */ /* Make LIM point to the end of (one byte past) the current field. */ @@ -2804,7 +2804,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 +@@ -1689,6 +1895,130 @@ limfield (struct line const *line, struc return ptr; } @@ -2935,7 +2935,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 +@@ -1775,8 +2105,22 @@ fillbuf (struct buffer *buf, FILE *fp, c else { if (key->skipsblanks) @@ -2960,7 +2960,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 +@@ -1897,7 +2241,7 @@ human_numcompare (char const *a, char co hideously fast. */ static int @@ -2969,7 +2969,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 +@@ -1907,6 +2251,25 @@ numcompare (char const *a, char const *b return strnumcmp (a, b, decimal_point, thousands_sep); } @@ -2995,7 +2995,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 +@@ -1957,7 +2320,7 @@ general_numcompare (char const *sa, char Return 0 if the name in S is not recognized. */ static int @@ -3004,7 +3004,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 +@@ -2232,15 +2595,14 @@ debug_key (struct line const *line, stru char saved = *lim; *lim = '\0'; @@ -3022,7 +3022,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 +@@ -2384,7 +2746,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 */ @@ -3031,7 +3031,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 +@@ -2442,11 +2804,83 @@ key_warnings (struct keyfield const *gke error (0, 0, _("option '-r' only applies to last-resort comparison")); } @@ -3116,7 +3116,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 +@@ -2531,7 +2965,7 @@ keycompare (struct line const *a, struct else if (key->human_numeric) diff = human_numcompare (ta, tb); else if (key->month) @@ -3125,7 +3125,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 +@@ -2647,6 +3081,180 @@ keycompare (struct line const *a, struct return key->reverse ? -diff : diff; } @@ -3306,7 +3306,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) +@@ -4107,7 +4715,7 @@ main (int argc, char **argv) initialize_exit_failure (SORT_FAILURE); hard_LC_COLLATE = hard_locale (LC_COLLATE); @@ -3315,7 +3315,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) +@@ -4128,6 +4736,29 @@ main (int argc, char **argv) thousands_sep = -1; } @@ -3345,7 +3345,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) +@@ -4398,13 +5029,34 @@ main (int argc, char **argv) case 't': { @@ -3384,7 +3384,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) +@@ -4415,9 +5067,12 @@ main (int argc, char **argv) quote (optarg)); } } @@ -3399,9 +3399,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.17-orig/src/unexpand.c coreutils-8.17/src/unexpand.c +--- coreutils-8.17-orig/src/unexpand.c 2012-05-01 22:55:08.000000000 +0200 ++++ coreutils-8.17/src/unexpand.c 2012-08-20 12:52:26.677470358 +0200 @@ -38,12 +38,29 @@ #include #include @@ -3655,9 +3655,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.17-orig/src/uniq.c coreutils-8.17/src/uniq.c +--- coreutils-8.17-orig/src/uniq.c 2012-05-01 22:55:08.000000000 +0200 ++++ coreutils-8.17/src/uniq.c 2012-08-20 12:52:26.679468083 +0200 @@ -21,6 +21,16 @@ #include #include @@ -4023,10 +4023,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.17-orig/tests/Makefile.am coreutils-8.17/tests/Makefile.am +--- coreutils-8.17-orig/tests/Makefile.am 2012-08-20 12:52:07.846555240 +0200 ++++ coreutils-8.17/tests/Makefile.am 2012-08-20 12:52:26.680469779 +0200 +@@ -246,6 +246,7 @@ TESTS = \ misc/sort-debug-warn \ misc/sort-discrim \ misc/sort-files0-from \ @@ -4034,7 +4034,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 = \ +@@ -543,6 +544,10 @@ TESTS = \ $(root_tests) pr_data = \ @@ -4045,9 +4045,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.17-orig/tests/misc/cut coreutils-8.17/tests/misc/cut +--- coreutils-8.17-orig/tests/misc/cut 2012-02-03 10:22:06.000000000 +0100 ++++ coreutils-8.17/tests/misc/cut 2012-08-20 12:52:26.681467766 +0200 @@ -23,14 +23,15 @@ use strict; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -4077,41 +4077,41 @@ 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.17-orig/tests/misc/mb1.I coreutils-8.17/tests/misc/mb1.I +--- coreutils-8.17-orig/tests/misc/mb1.I 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.17/tests/misc/mb1.I 2012-08-20 12:52:26.682468139 +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.17-orig/tests/misc/mb1.X coreutils-8.17/tests/misc/mb1.X +--- coreutils-8.17-orig/tests/misc/mb1.X 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.17/tests/misc/mb1.X 2012-08-20 12:52:26.682468139 +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.17-orig/tests/misc/mb2.I coreutils-8.17/tests/misc/mb2.I +--- coreutils-8.17-orig/tests/misc/mb2.I 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.17/tests/misc/mb2.I 2012-08-20 12:52:26.683472746 +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.17-orig/tests/misc/mb2.X coreutils-8.17/tests/misc/mb2.X +--- coreutils-8.17-orig/tests/misc/mb2.X 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.17/tests/misc/mb2.X 2012-08-20 12:52:26.684468471 +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.17-orig/tests/misc/sort-mb-tests coreutils-8.17/tests/misc/sort-mb-tests +--- coreutils-8.17-orig/tests/misc/sort-mb-tests 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.17/tests/misc/sort-mb-tests 2012-08-20 12:52:26.684468471 +0200 @@ -0,0 +1,58 @@ +#! /bin/sh +case $# in diff --git a/coreutils.spec b/coreutils.spec index 9281d4d..1aa2fc7 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -19,6 +19,7 @@ Source203: coreutils-runuser-l.pamd # From upstream Patch1: coreutils-8.17-ls-rootdir-symlink.patch +Patch2: coreutils-8.17-sort-uniq-fmr.patch # Our patches #general patch to workaround koji build system issues @@ -146,6 +147,7 @@ the old GNU fileutils, sh-utils, and textutils packages. # From upstream %patch1 -p1 -b .roodirsymlink +%patch2 -p1 -b .fmr # Our patches %patch100 -p1 -b .configure @@ -419,6 +421,11 @@ fi %{?!norunuser:%{_sbindir}/runuser} %changelog +* Mon Aug 20 2012 Ondrej Vasik 8.17-5 +- fix possible free memory read and dataloss in sort -u + (upstream fix) +- multibyte fixes in cut and expand (by M.Briza, #821260) + * Wed Jul 18 2012 Fedora Release Engineering - 8.17-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild From c28ebe0f20860000e09c0b17b791db1e7e609e97 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:59:51 +0200 Subject: [PATCH 2/8] release++ --- coreutils.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreutils.spec b/coreutils.spec index 1aa2fc7..8de4dda 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.17 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ From ea6e077444f017fa26a5171345acdacd3eacf113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Mon, 5 Nov 2012 11:50:50 +0100 Subject: [PATCH 3/8] fix support for ecryptfs mount of Private in su (#722323) --- coreutils-su.pamd | 2 +- coreutils.spec | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/coreutils-su.pamd b/coreutils-su.pamd index 1981f58..030657f 100644 --- a/coreutils-su.pamd +++ b/coreutils-su.pamd @@ -4,7 +4,7 @@ auth sufficient pam_rootok.so #auth sufficient pam_wheel.so trust use_uid # Uncomment the following line to require a user to be in the "wheel" group. #auth required pam_wheel.so use_uid -auth include system-auth +auth substack system-auth auth include postlogin account sufficient pam_succeed_if.so uid = 0 use_uid quiet account include system-auth diff --git a/coreutils.spec b/coreutils.spec index 8de4dda..7eed016 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -421,6 +421,9 @@ fi %{?!norunuser:%{_sbindir}/runuser} %changelog +* Mon Nov 05 2012 Ondrej Vasik 8.17-6 +- fix support for ecryptfs mount of "Private" in su (#722323) + * Mon Aug 20 2012 Ondrej Vasik 8.17-5 - fix possible free memory read and dataloss in sort -u (upstream fix) From d3438ce2788ff24c052e62efe62b8023ca7a5824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Mon, 5 Nov 2012 12:22:41 +0100 Subject: [PATCH 4/8] cp: avoid data-corrupting free-memory-read (upstream fix) --- coreutils-8.17-cp-freememoryread.patch | 29 ++++++++++++++++++++++++++ coreutils.spec | 3 +++ 2 files changed, 32 insertions(+) create mode 100644 coreutils-8.17-cp-freememoryread.patch diff --git a/coreutils-8.17-cp-freememoryread.patch b/coreutils-8.17-cp-freememoryread.patch new file mode 100644 index 0000000..be4a429 --- /dev/null +++ b/coreutils-8.17-cp-freememoryread.patch @@ -0,0 +1,29 @@ +diff -urNp coreutils-8.17-orig/src/extent-scan.c coreutils-8.17/src/extent-scan.c +--- coreutils-8.17-orig/src/extent-scan.c 2012-05-02 10:31:47.000000000 +0200 ++++ coreutils-8.17/src/extent-scan.c 2012-11-05 12:05:36.732370966 +0100 +@@ -89,7 +89,7 @@ extern bool + extent_scan_read (struct extent_scan *scan) + { + unsigned int si = 0; +- struct extent_info *last_ei IF_LINT ( = scan->ext_info); ++ struct extent_info *last_ei = scan->ext_info; + + while (true) + { +@@ -127,8 +127,14 @@ extent_scan_read (struct extent_scan *sc + + assert (scan->ei_count <= SIZE_MAX - fiemap->fm_mapped_extents); + scan->ei_count += fiemap->fm_mapped_extents; +- scan->ext_info = xnrealloc (scan->ext_info, scan->ei_count, +- sizeof (struct extent_info)); ++ { ++ /* last_ei points into a buffer that may be freed via xnrealloc. ++ Record its offset and adjust after allocation. */ ++ size_t prev_idx = last_ei - scan->ext_info; ++ scan->ext_info = xnrealloc (scan->ext_info, scan->ei_count, ++ sizeof (struct extent_info)); ++ last_ei = scan->ext_info + prev_idx; ++ } + + unsigned int i = 0; + for (i = 0; i < fiemap->fm_mapped_extents; i++) diff --git a/coreutils.spec b/coreutils.spec index 7eed016..c874dc6 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -20,6 +20,7 @@ Source203: coreutils-runuser-l.pamd # From upstream Patch1: coreutils-8.17-ls-rootdir-symlink.patch Patch2: coreutils-8.17-sort-uniq-fmr.patch +Patch3: coreutils-8.17-cp-freememoryread.patch # Our patches #general patch to workaround koji build system issues @@ -148,6 +149,7 @@ the old GNU fileutils, sh-utils, and textutils packages. # From upstream %patch1 -p1 -b .roodirsymlink %patch2 -p1 -b .fmr +%patch3 -p1 -b .freememoryread # Our patches %patch100 -p1 -b .configure @@ -423,6 +425,7 @@ fi %changelog * Mon Nov 05 2012 Ondrej Vasik 8.17-6 - fix support for ecryptfs mount of "Private" in su (#722323) +- cp: avoid data-corrupting free-memory-read (upstream fix) * Mon Aug 20 2012 Ondrej Vasik 8.17-5 - fix possible free memory read and dataloss in sort -u From 0700256c127dca13ad965576bac58f63fabda89a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Mon, 5 Nov 2012 12:24:09 +0100 Subject: [PATCH 5/8] Relase++ --- coreutils.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreutils.spec b/coreutils.spec index c874dc6..4b7b55f 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.17 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ From c04182840fd2531c6d7d78c952eb122952d6218e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Mon, 5 Nov 2012 12:52:33 +0100 Subject: [PATCH 6/8] Disable gnulib getlogin test, it fails in mock/koji too often --- coreutils-6.10-configuration.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/coreutils-6.10-configuration.patch b/coreutils-6.10-configuration.patch index 7f5e6ee..ed4cd2e 100644 --- a/coreutils-6.10-configuration.patch +++ b/coreutils-6.10-configuration.patch @@ -42,6 +42,19 @@ diff -urNp coreutils-8.13-orig/gnulib-tests/gnulib.mk coreutils-8.13/gnulib-test ## end gnulib module fchdir-tests +@@ -874,9 +874,9 @@ EXTRA_DIST += test-getloadavg.c signatur + + ## begin gnulib module getlogin-tests + +-TESTS += test-getlogin +-check_PROGRAMS += test-getlogin +-EXTRA_DIST += test-getlogin.c signature.h macros.h ++#TESTS += test-getlogin ++#check_PROGRAMS += test-getlogin ++#EXTRA_DIST += test-getlogin.c signature.h macros.h + + ## end gnulib module getlogin-tests + @@ -918,10 +918,10 @@ EXTRA_DIST += test-link.h test-link.c si ## begin gnulib module linkat-tests From 1b40d50d5e34ef5a47fcee49d6df689a458a2251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Tue, 11 Dec 2012 12:14:16 +0100 Subject: [PATCH 7/8] fix showing duplicates in df (#709351, O.Oprala, B.Voelker) --- coreutils-8.17-df-duplicates.patch | 264 +++++++++++++++++++++++++++++ coreutils.spec | 9 +- 2 files changed, 271 insertions(+), 2 deletions(-) create mode 100644 coreutils-8.17-df-duplicates.patch diff --git a/coreutils-8.17-df-duplicates.patch b/coreutils-8.17-df-duplicates.patch new file mode 100644 index 0000000..06983ad --- /dev/null +++ b/coreutils-8.17-df-duplicates.patch @@ -0,0 +1,264 @@ +diff -urNp coreutils-8.17-orig/doc/coreutils.texi coreutils-8.17/doc/coreutils.texi +--- coreutils-8.17-orig/doc/coreutils.texi 2012-05-10 09:14:30.000000000 +0200 ++++ coreutils-8.17/doc/coreutils.texi 2012-12-11 11:30:38.730760947 +0100 +@@ -10561,6 +10561,14 @@ Normally the disk space is printed in un + 1024 bytes, but this can be overridden (@pxref{Block size}). + Non-integer quantities are rounded up to the next higher unit. + ++For bind mounts and without arguments, @command{df} only outputs the statistics ++for the first occurence of that device in the list of file systems (@var{mtab}), ++i.e., it hides duplicate entries, unless the @option{-a} option is specified. ++ ++By default, @command{df} omits the early-boot pseudo file system type ++@samp{rootfs}, unless the @option{-a} option is specified or that file system ++type is explicitly to be included by using the @option{-t} option. ++ + @cindex disk device file + @cindex device file, disk + If an argument @var{file} is a disk device file containing a mounted +diff -urNp coreutils-8.17-orig/src/df.c coreutils-8.17/src/df.c +--- coreutils-8.17-orig/src/df.c 2012-05-01 22:55:08.000000000 +0200 ++++ coreutils-8.17/src/df.c 2012-12-11 11:30:38.803069545 +0100 +@@ -46,6 +46,17 @@ + /* If true, show inode information. */ + static bool inode_format; + ++/* Filled with device numbers of examined file systems to avoid ++ duplicities in output. */ ++struct devlist ++{ ++ dev_t dev_num; ++ struct devlist *next; ++}; ++ ++/* Store of already-processed device numbers. */ ++static struct devlist *devlist_head; ++ + /* If true, show even file systems with zero size or + uninteresting types. */ + static bool show_all_fs; +@@ -57,6 +68,12 @@ static bool show_local_fs; + command line argument -- even if it's a dummy (automounter) entry. */ + static bool show_listed_fs; + ++/* If true, include rootfs in the output. */ ++static bool show_rootfs; ++ ++/* The literal name of the initial root file system. */ ++static char const *ROOTFS = "rootfs"; ++ + /* Human-readable options for output. */ + static int human_output_opts; + +@@ -350,6 +367,29 @@ excluded_fstype (const char *fstype) + return false; + } + ++/* Check if the device was already examined. */ ++ ++static bool ++dev_examined (char const *mount_dir, char const *devname) ++{ ++ struct stat buf; ++ if (-1 == stat (mount_dir, &buf)) ++ return false; ++ ++ struct devlist *devlist = devlist_head; ++ for ( ; devlist; devlist = devlist->next) ++ if (devlist->dev_num == buf.st_dev) ++ return true; ++ ++ /* Add the device number to the global list devlist. */ ++ devlist = xmalloc (sizeof *devlist); ++ devlist->dev_num = buf.st_dev; ++ devlist->next = devlist_head; ++ devlist_head = devlist; ++ ++ return false; ++} ++ + /* Return true if N is a known integer value. On many file systems, + UINTMAX_MAX represents an unknown value; on AIX, UINTMAX_MAX - 1 + represents unknown. Use a rule that works on AIX file systems, and +@@ -474,6 +514,15 @@ get_dev (char const *disk, char const *m + if (!selected_fstype (fstype) || excluded_fstype (fstype)) + return; + ++ if (process_all && !show_all_fs && !show_listed_fs) ++ { ++ /* No arguments nor "df -a", then check if df has to ... */ ++ if (!show_rootfs && STREQ (disk, ROOTFS)) ++ return; /* ... skip rootfs: (unless -trootfs is given. */ ++ if (dev_examined (mount_point, disk)) ++ return; /* ... skip duplicate entries (bind mounts). */ ++ } ++ + /* If MOUNT_POINT is NULL, then the file system is not mounted, and this + program reports on the file system that the special file is on. + It would be better to report on the unmounted file system, +@@ -972,6 +1021,7 @@ main (int argc, char **argv) + /* Accept -F as a synonym for -t for compatibility with Solaris. */ + case 't': + add_fs_type (optarg); ++ show_rootfs = selected_fstype (ROOTFS); + break; + + case 'v': /* For SysV compatibility. */ +@@ -1105,6 +1155,14 @@ main (int argc, char **argv) + + if (! file_systems_processed) + error (EXIT_FAILURE, 0, _("no file systems processed")); ++ IF_LINT ( ++ while (devlist_head) ++ { ++ struct devlist *devlist = devlist_head->next; ++ free (devlist_head); ++ devlist_head = devlist; ++ } ++ ); + + exit (exit_status); + } +diff -urNp coreutils-8.17-orig/tests/df/skip-duplicates coreutils-8.17/tests/df/skip-duplicates +--- coreutils-8.17-orig/tests/df/skip-duplicates 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.17/tests/df/skip-duplicates 2012-12-11 11:30:38.820762450 +0100 +@@ -0,0 +1,77 @@ ++#!/bin/sh ++# Test df's behavior when the mount list contains duplicate entries. ++# This test is skipped on systems that lack LD_PRELOAD support; that's fine. ++ ++# Copyright (C) 2012 Free Software Foundation, Inc. ++ ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../src ++print_ver_ df ++ ++df || skip_ "df fails" ++ ++# Simulate an mtab file with two entries of the same device number. ++cat > k.c <<'EOF' || framework_failure_ ++#include ++#include ++ ++struct mntent *getmntent (FILE *fp) ++{ ++ /* Prove that LD_PRELOAD works. */ ++ static int done = 0; ++ if (!done) ++ { ++ fclose (fopen ("x", "w")); ++ ++done; ++ } ++ ++ static struct mntent mntent; ++ ++ while (done++ < 3) ++ { ++ mntent.mnt_fsname = "fsname"; ++ mntent.mnt_dir = "/"; ++ mntent.mnt_type = "-"; ++ ++ return &mntent; ++ } ++ return NULL; ++} ++EOF ++ ++# Then compile/link it: ++gcc --std=gnu99 -shared -fPIC -ldl -O2 k.c -o k.so \ ++ || skip_ "getmntent hack does not work on this platform" ++ ++# Test if LD_PRELOAD works: ++LD_PRELOAD=./k.so df ++test -f x || skip_ "internal test failure: maybe LD_PRELOAD doesn't work?" ++ ++# The fake mtab file should only contain 2 entries, both ++# having the same device number; thus the output should ++# consist of a header and one entry. ++LD_PRELOAD=./k.so df >out || fail=1 ++test $(wc -l out || fail=1 ++test $(wc -l out || fail=1 ++test $(wc -l . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../src ++print_ver_ df ++ ++df || skip_ "df fails" ++ ++# Verify that rootfs is in mtab (and shown when the -a option is specified). ++df -a >out || fail=1 ++grep '^rootfs' out || skip_ "no rootfs in mtab" ++ ++# Ensure that rootfs is supressed when no options is specified. ++df >out || fail=1 ++grep '^rootfs' out && { fail=1; cat out; } ++ ++# Ensure that the rootfs is shown when explicitly specifying "-t rootfs". ++df -t rootfs >out || fail=1 ++grep '^rootfs' out || { fail=1; cat out; } ++ ++# Ensure that the rootfs is shown when explicitly specifying "-t rootfs", ++# even when the -a option is specified. ++df -t rootfs -a >out || fail=1 ++grep '^rootfs' out || { fail=1; cat out; } ++ ++# Ensure that the rootfs is omitted in all_fs mode when it is explicitly ++# black-listed. ++df -a -x rootfs >out || fail=1 ++grep '^rootfs' out && { fail=1; cat out; } ++ ++Exit $fail +diff -urNp coreutils-8.17-orig/tests/Makefile.am coreutils-8.17/tests/Makefile.am +--- coreutils-8.17-orig/tests/Makefile.am 2012-05-10 16:36:42.000000000 +0200 ++++ coreutils-8.17/tests/Makefile.am 2012-12-11 11:32:23.021760237 +0100 +@@ -373,6 +373,8 @@ TESTS = \ + cp/symlink-slash \ + cp/thru-dangling \ + df/unreadable \ ++ df/skip-duplicates \ ++ df/skip-rootfs \ + dd/direct \ + dd/misc \ + dd/nocache \ diff --git a/coreutils.spec b/coreutils.spec index 4b7b55f..6d4f4bf 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.17 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -21,6 +21,7 @@ Source203: coreutils-runuser-l.pamd Patch1: coreutils-8.17-ls-rootdir-symlink.patch Patch2: coreutils-8.17-sort-uniq-fmr.patch Patch3: coreutils-8.17-cp-freememoryread.patch +Patch4: coreutils-8.17-df-duplicates.patch # Our patches #general patch to workaround koji build system issues @@ -150,6 +151,7 @@ the old GNU fileutils, sh-utils, and textutils packages. %patch1 -p1 -b .roodirsymlink %patch2 -p1 -b .fmr %patch3 -p1 -b .freememoryread +%patch4 -p1 -b .duplic # Our patches %patch100 -p1 -b .configure @@ -180,7 +182,7 @@ the old GNU fileutils, sh-utils, and textutils packages. %patch951 -p1 -b .selinuxman %patch952 -p1 -b .cpZ -chmod a+x tests/misc/sort-mb-tests tests/df/direct || : +chmod a+x tests/misc/sort-mb-tests tests/df/direct tests/df/skip-duplicates tests/df/skip-rootfs || : #fix typos/mistakes in localized documentation(#439410, #440056) find ./po/ -name "*.p*" | xargs \ @@ -423,6 +425,9 @@ fi %{?!norunuser:%{_sbindir}/runuser} %changelog +* Tue Dec 11 2012 Ondrej Vasik 8.17-7 +- fix showing duplicates in df (#709351, O.Oprala, B.Voelker) + * Mon Nov 05 2012 Ondrej Vasik 8.17-6 - fix support for ecryptfs mount of "Private" in su (#722323) - cp: avoid data-corrupting free-memory-read (upstream fix) From 8def2175102337e5c315fa9c0dbe265a76358dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Thu, 24 Jan 2013 17:16:25 +0100 Subject: [PATCH 8/8] fix multiple segmantation faults in i18n patch (by SUSE) (#869442, #902917)- CVE2013-0223/CVE2013-0221/CVE2013-0222 --- coreutils-i18n.patch | 162 +++++++++++++++++++++++++------------------ coreutils.spec | 6 +- 2 files changed, 100 insertions(+), 68 deletions(-) diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index 7ddc72c..704941f 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -1,6 +1,6 @@ diff -urNp coreutils-8.17-orig/lib/linebuffer.h coreutils-8.17/lib/linebuffer.h --- coreutils-8.17-orig/lib/linebuffer.h 2012-01-06 10:14:31.000000000 +0100 -+++ coreutils-8.17/lib/linebuffer.h 2012-08-20 12:52:26.658468803 +0200 ++++ coreutils-8.17/lib/linebuffer.h 2013-01-24 17:11:53.530457138 +0100 @@ -21,6 +21,11 @@ # include @@ -25,7 +25,7 @@ diff -urNp coreutils-8.17-orig/lib/linebuffer.h coreutils-8.17/lib/linebuffer.h /* Initialize linebuffer LINEBUFFER for use. */ diff -urNp coreutils-8.17-orig/src/cut.c coreutils-8.17/src/cut.c --- coreutils-8.17-orig/src/cut.c 2012-05-02 10:31:47.000000000 +0200 -+++ coreutils-8.17/src/cut.c 2012-08-20 12:57:52.533805458 +0200 ++++ coreutils-8.17/src/cut.c 2013-01-24 17:11:53.532456847 +0100 @@ -28,6 +28,11 @@ #include #include @@ -635,7 +635,7 @@ diff -urNp coreutils-8.17-orig/src/cut.c coreutils-8.17/src/cut.c if (optind == argc) diff -urNp coreutils-8.17-orig/src/expand.c coreutils-8.17/src/expand.c --- coreutils-8.17-orig/src/expand.c 2012-05-01 22:55:08.000000000 +0200 -+++ coreutils-8.17/src/expand.c 2012-08-20 12:59:28.995468227 +0200 ++++ coreutils-8.17/src/expand.c 2013-01-24 17:11:53.534459250 +0100 @@ -37,12 +37,29 @@ #include #include @@ -825,7 +825,7 @@ diff -urNp coreutils-8.17-orig/src/expand.c coreutils-8.17/src/expand.c error (EXIT_FAILURE, errno, "-"); diff -urNp coreutils-8.17-orig/src/fold.c coreutils-8.17/src/fold.c --- coreutils-8.17-orig/src/fold.c 2012-04-29 13:45:30.000000000 +0200 -+++ coreutils-8.17/src/fold.c 2012-08-20 12:52:26.662467902 +0200 ++++ coreutils-8.17/src/fold.c 2013-01-24 17:11:53.535456924 +0100 @@ -22,12 +22,34 @@ #include #include @@ -1225,7 +1225,7 @@ diff -urNp coreutils-8.17-orig/src/fold.c coreutils-8.17/src/fold.c case 's': /* Break at word boundaries. */ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c --- coreutils-8.17-orig/src/join.c 2012-05-02 10:31:47.000000000 +0200 -+++ coreutils-8.17/src/join.c 2012-08-20 12:52:26.664470970 +0200 ++++ coreutils-8.17/src/join.c 2013-01-24 17:11:53.537387892 +0100 @@ -22,18 +22,32 @@ #include #include @@ -1444,7 +1444,7 @@ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c static void freeline (struct line *line) { -@@ -313,56 +472,115 @@ keycmp (struct line const *line1, struct +@@ -313,56 +472,130 @@ keycmp (struct line const *line1, struct size_t jf_1, size_t jf_2) { /* Start of field to compare in each file. */ @@ -1458,6 +1458,7 @@ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c + size_t len[2]; /* Length of fields to compare. */ int diff; + int i, j; ++ int mallocd = 0; if (jf_1 < line1->nfields) { @@ -1513,7 +1514,8 @@ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c + + for (i = 0; i < 2; i++) + { -+ copy[i] = alloca (len[i] + 1); ++ mallocd = 1; ++ copy[i] = xmalloc (len[i] + 1); + + for (j = 0; j < MIN (len[0], len[1]);) + { @@ -1553,7 +1555,8 @@ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c + { + for (i = 0; i < 2; i++) + { -+ copy[i] = alloca (len[i] + 1); ++ mallocd = 1; ++ copy[i] = xmalloc (len[i] + 1); + + for (j = 0; j < MIN (len[0], len[1]); j++) + copy[i][j] = toupper (beg[i][j]); @@ -1572,9 +1575,21 @@ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c } + if (hard_LC_COLLATE) -+ return xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]); ++ { ++ diff = xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]); ++ ++ if (mallocd) ++ for (i = 0; i < 2; i++) ++ free (copy[i]); ++ ++ return diff; ++ } + diff = memcmp (copy[0], copy[1], MIN (len[0], len[1])); + ++ if (mallocd) ++ for (i = 0; i < 2; i++) ++ free (copy[i]); ++ + if (diff) return diff; @@ -1583,7 +1598,7 @@ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c } /* Check that successive input lines PREV and CURRENT from input file -@@ -454,6 +672,11 @@ get_line (FILE *fp, struct line **linep, +@@ -454,6 +687,11 @@ get_line (FILE *fp, struct line **linep, } ++line_no[which - 1]; @@ -1595,7 +1610,7 @@ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c xfields (line); if (prevline[which - 1]) -@@ -553,21 +776,28 @@ prfield (size_t n, struct line const *li +@@ -553,21 +791,28 @@ prfield (size_t n, struct line const *li /* Output all the fields in line, other than the join field. */ @@ -1627,7 +1642,7 @@ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c prfield (i, line); } } -@@ -578,7 +808,6 @@ static void +@@ -578,7 +823,6 @@ static void prjoin (struct line const *line1, struct line const *line2) { const struct outlist *outlist; @@ -1635,7 +1650,7 @@ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c size_t field; struct line const *line; -@@ -612,7 +841,7 @@ prjoin (struct line const *line1, struct +@@ -612,7 +856,7 @@ prjoin (struct line const *line1, struct o = o->next; if (o == NULL) break; @@ -1644,7 +1659,7 @@ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c } putchar ('\n'); } -@@ -1090,21 +1319,46 @@ main (int argc, char **argv) +@@ -1090,21 +1334,46 @@ main (int argc, char **argv) case 't': { @@ -1703,7 +1718,7 @@ diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c case NOCHECK_ORDER_OPTION: diff -urNp coreutils-8.17-orig/src/pr.c coreutils-8.17/src/pr.c --- coreutils-8.17-orig/src/pr.c 2012-05-10 09:14:30.000000000 +0200 -+++ coreutils-8.17/src/pr.c 2012-08-20 12:52:26.669468730 +0200 ++++ coreutils-8.17/src/pr.c 2013-01-24 17:11:53.543389383 +0100 @@ -312,6 +312,32 @@ #include @@ -2448,8 +2463,8 @@ diff -urNp coreutils-8.17-orig/src/pr.c coreutils-8.17/src/pr.c 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 2012-05-04 12:06:22.000000000 +0200 -+++ coreutils-8.17/src/sort.c 2012-08-20 12:52:26.675467884 +0200 +--- coreutils-8.17-orig/src/sort.c 2013-01-24 17:03:36.008333014 +0100 ++++ coreutils-8.17/src/sort.c 2013-01-24 17:11:53.549332078 +0100 @@ -22,12 +22,21 @@ #include @@ -2508,7 +2523,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 }; -@@ -341,13 +372,11 @@ static bool reverse; +@@ -344,13 +375,11 @@ static bool reverse; they were read if all keys compare equal. */ static bool stable; @@ -2525,7 +2540,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. */ -@@ -780,6 +809,46 @@ reap_all (void) +@@ -783,6 +812,46 @@ reap_all (void) reap (-1); } @@ -2572,7 +2587,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c /* Clean up any remaining temporary files. */ static void -@@ -1212,7 +1281,7 @@ zaptemp (char const *name) +@@ -1215,7 +1284,7 @@ zaptemp (char const *name) free (node); } @@ -2581,7 +2596,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) -@@ -1227,7 +1296,7 @@ struct_month_cmp (void const *m1, void c +@@ -1230,7 +1299,7 @@ struct_month_cmp (void const *m1, void c /* Initialize the character class tables. */ static void @@ -2590,7 +2605,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c { size_t i; -@@ -1239,7 +1308,7 @@ inittables (void) +@@ -1242,7 +1311,7 @@ inittables (void) fold_toupper[i] = toupper (i); } @@ -2599,7 +2614,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) { -@@ -1321,6 +1390,84 @@ specify_nmerge (int oi, char c, char con +@@ -1324,6 +1393,84 @@ specify_nmerge (int oi, char c, char con xstrtol_fatal (e, oi, c, long_options, s); } @@ -2684,7 +2699,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) -@@ -1549,7 +1696,7 @@ buffer_linelim (struct buffer const *buf +@@ -1552,7 +1699,7 @@ buffer_linelim (struct buffer const *buf by KEY in LINE. */ static char * @@ -2693,7 +2708,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; -@@ -1558,10 +1705,10 @@ begfield (struct line const *line, struc +@@ -1561,10 +1708,10 @@ begfield (struct line const *line, struc /* The leading field separator itself is included in a field when -t is absent. */ @@ -2706,7 +2721,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c ++ptr; if (ptr < lim) ++ptr; -@@ -1587,11 +1734,70 @@ begfield (struct line const *line, struc +@@ -1590,11 +1737,70 @@ begfield (struct line const *line, struc return ptr; } @@ -2778,7 +2793,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; -@@ -1606,10 +1812,10 @@ limfield (struct line const *line, struc +@@ -1609,10 +1815,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. */ @@ -2791,7 +2806,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c ++ptr; if (ptr < lim && (eword || echar)) ++ptr; -@@ -1655,10 +1861,10 @@ limfield (struct line const *line, struc +@@ -1658,10 +1864,10 @@ limfield (struct line const *line, struc */ /* Make LIM point to the end of (one byte past) the current field. */ @@ -2804,7 +2819,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c if (newlim) lim = newlim; } -@@ -1689,6 +1895,130 @@ limfield (struct line const *line, struc +@@ -1692,6 +1898,130 @@ limfield (struct line const *line, struc return ptr; } @@ -2935,7 +2950,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 -@@ -1775,8 +2105,22 @@ fillbuf (struct buffer *buf, FILE *fp, c +@@ -1778,8 +2108,22 @@ fillbuf (struct buffer *buf, FILE *fp, c else { if (key->skipsblanks) @@ -2960,7 +2975,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c line->keybeg = line_start; } } -@@ -1897,7 +2241,7 @@ human_numcompare (char const *a, char co +@@ -1900,7 +2244,7 @@ human_numcompare (char const *a, char co hideously fast. */ static int @@ -2969,7 +2984,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c { while (blanks[to_uchar (*a)]) a++; -@@ -1907,6 +2251,25 @@ numcompare (char const *a, char const *b +@@ -1910,6 +2254,25 @@ numcompare (char const *a, char const *b return strnumcmp (a, b, decimal_point, thousands_sep); } @@ -2995,7 +3010,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 -@@ -1957,7 +2320,7 @@ general_numcompare (char const *sa, char +@@ -1960,7 +2323,7 @@ general_numcompare (char const *sa, char Return 0 if the name in S is not recognized. */ static int @@ -3004,7 +3019,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; -@@ -2232,15 +2595,14 @@ debug_key (struct line const *line, stru +@@ -2235,15 +2598,14 @@ debug_key (struct line const *line, stru char saved = *lim; *lim = '\0'; @@ -3022,7 +3037,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) -@@ -2384,7 +2746,7 @@ key_warnings (struct keyfield const *gke +@@ -2387,7 +2749,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 */ @@ -3031,7 +3046,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))) -@@ -2442,11 +2804,83 @@ key_warnings (struct keyfield const *gke +@@ -2445,11 +2807,87 @@ key_warnings (struct keyfield const *gke error (0, 0, _("option '-r' only applies to last-resort comparison")); } @@ -3058,13 +3073,13 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c + if (len == 0) + return 0; + -+ month = (char *) alloca (len + 1); ++ month = (char *) xmalloc (len + 1); + -+ tmp = (char *) alloca (len + 1); ++ tmp = (char *) xmalloc (len + 1); + memcpy (tmp, s, len); + tmp[len] = '\0'; + pp = (const char **)&tmp; -+ month_wcs = (wchar_t *) alloca ((len + 1) * sizeof (wchar_t)); ++ month_wcs = (wchar_t *) xmalloc ((len + 1) * sizeof (wchar_t)); + memset (&state, '\0', sizeof(mbstate_t)); + + wclength = mbsrtowcs (month_wcs, pp, len + 1, &state); @@ -3103,6 +3118,10 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c + if (ea && result) + *ea = s + strlen (monthtab[lo].name); + ++ free (month); ++ free (tmp); ++ free (month_wcs); ++ + return result; +} +#endif @@ -3116,7 +3135,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c { struct keyfield *key = keylist; -@@ -2531,7 +2965,7 @@ keycompare (struct line const *a, struct +@@ -2534,7 +2972,7 @@ keycompare (struct line const *a, struct else if (key->human_numeric) diff = human_numcompare (ta, tb); else if (key->month) @@ -3125,7 +3144,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) -@@ -2647,6 +3081,180 @@ keycompare (struct line const *a, struct +@@ -2650,6 +3088,181 @@ keycompare (struct line const *a, struct return key->reverse ? -diff : diff; } @@ -3181,7 +3200,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c + { + if (ignore || translate) + { -+ char *copy_a = (char *) alloca (lena + 1 + lenb + 1); ++ char *copy_a = (char *) xmalloc (lena + 1 + lenb + 1); + char *copy_b = copy_a + lena + 1; + size_t new_len_a, new_len_b; + size_t i, j; @@ -3257,6 +3276,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c + IGNORE_CHARS (new_len_b, lenb, textb, copy_b, + wc_b, mblength_b, state_b); + diff = xmemcoll (copy_a, new_len_a, copy_b, new_len_b); ++ free(copy_a); + } + else if (lena == 0) + diff = - NONZERO (lenb); @@ -3306,7 +3326,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. */ -@@ -4107,7 +4715,7 @@ main (int argc, char **argv) +@@ -4110,7 +4723,7 @@ main (int argc, char **argv) initialize_exit_failure (SORT_FAILURE); hard_LC_COLLATE = hard_locale (LC_COLLATE); @@ -3315,7 +3335,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c hard_LC_TIME = hard_locale (LC_TIME); #endif -@@ -4128,6 +4736,29 @@ main (int argc, char **argv) +@@ -4131,6 +4744,29 @@ main (int argc, char **argv) thousands_sep = -1; } @@ -3345,7 +3365,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c have_read_stdin = false; inittables (); -@@ -4398,13 +5029,34 @@ main (int argc, char **argv) +@@ -4401,13 +5037,34 @@ main (int argc, char **argv) case 't': { @@ -3384,7 +3404,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c else { /* Provoke with 'sort -txx'. Complain about -@@ -4415,9 +5067,12 @@ main (int argc, char **argv) +@@ -4418,9 +5075,12 @@ main (int argc, char **argv) quote (optarg)); } } @@ -3401,7 +3421,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c diff -urNp coreutils-8.17-orig/src/unexpand.c coreutils-8.17/src/unexpand.c --- coreutils-8.17-orig/src/unexpand.c 2012-05-01 22:55:08.000000000 +0200 -+++ coreutils-8.17/src/unexpand.c 2012-08-20 12:52:26.677470358 +0200 ++++ coreutils-8.17/src/unexpand.c 2013-01-24 17:11:53.551335712 +0100 @@ -38,12 +38,29 @@ #include #include @@ -3657,7 +3677,7 @@ diff -urNp coreutils-8.17-orig/src/unexpand.c coreutils-8.17/src/unexpand.c error (EXIT_FAILURE, errno, "-"); diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c --- coreutils-8.17-orig/src/uniq.c 2012-05-01 22:55:08.000000000 +0200 -+++ coreutils-8.17/src/uniq.c 2012-08-20 12:52:26.679468083 +0200 ++++ coreutils-8.17/src/uniq.c 2013-01-24 17:11:53.552332659 +0100 @@ -21,6 +21,16 @@ #include #include @@ -3809,7 +3829,7 @@ diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c if (check_chars < oldlen) oldlen = check_chars; if (check_chars < newlen) -@@ -241,14 +346,92 @@ different (char *old, char *new, size_t +@@ -241,14 +346,100 @@ different (char *old, char *new, size_t if (ignore_case) { @@ -3817,14 +3837,18 @@ diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c - return oldlen != newlen || memcasecmp (old, new, oldlen); + size_t i; + -+ copy_old = alloca (oldlen + 1); -+ copy_new = alloca (oldlen + 1); ++ copy_old = xmalloc (oldlen + 1); ++ copy_new = xmalloc (oldlen + 1); + + for (i = 0; i < oldlen; i++) + { + copy_old[i] = toupper (old[i]); + copy_new[i] = toupper (new[i]); + } ++ bool rc = xmemcoll (copy_old, oldlen, copy_new, newlen); ++ free (copy_old); ++ free (copy_new); ++ return rc; } - else if (hard_LC_COLLATE) - return xmemcoll (old, oldlen, new, newlen) != 0; @@ -3836,6 +3860,7 @@ diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c + } + + return xmemcoll (copy_old, oldlen, copy_new, newlen); ++ +} + +#if HAVE_MBRTOWC @@ -3860,7 +3885,7 @@ diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c + + for (i = 0; i < 2; i++) + { -+ copy[i] = alloca (len[i] + 1); ++ copy[i] = xmalloc (len[i] + 1); + + for (j = 0, chars = 0; j < len[i] && chars < check_chars; chars++) + { @@ -3900,14 +3925,17 @@ diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c + copy[i][j] = '\0'; + len[i] = j; + } ++ int rc = xmemcoll (copy[0], len[0], copy[1], len[1]); ++ free (copy[0]); ++ free (copy[1]); ++ return rc; + -+ return xmemcoll (copy[0], len[0], copy[1], len[1]); } +#endif /* Output the line in linebuffer LINE to standard output provided that the switches say it should be output. -@@ -304,15 +487,43 @@ check_file (const char *infile, const ch +@@ -304,15 +495,43 @@ check_file (const char *infile, const ch { char *prevfield IF_LINT ( = NULL); size_t prevlen IF_LINT ( = 0); @@ -3951,7 +3979,7 @@ diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c if (prevline->length == 0 || different (thisfield, prevfield, thislen, prevlen)) { -@@ -331,17 +542,26 @@ check_file (const char *infile, const ch +@@ -331,17 +550,26 @@ check_file (const char *infile, const ch size_t prevlen; uintmax_t match_count = 0; bool first_delimiter = true; @@ -3978,7 +4006,7 @@ diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c if (readlinebuffer_delim (thisline, stdin, delimiter) == 0) { if (ferror (stdin)) -@@ -350,6 +570,14 @@ check_file (const char *infile, const ch +@@ -350,6 +578,14 @@ check_file (const char *infile, const ch } thisfield = find_field (thisline); thislen = thisline->length - 1 - (thisfield - thisline->buffer); @@ -3993,7 +4021,7 @@ diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c match = !different (thisfield, prevfield, thislen, prevlen); match_count += match; -@@ -382,6 +610,9 @@ check_file (const char *infile, const ch +@@ -382,6 +618,9 @@ check_file (const char *infile, const ch SWAP_LINES (prevline, thisline); prevfield = thisfield; prevlen = thislen; @@ -4003,7 +4031,7 @@ diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c if (!match) match_count = 0; } -@@ -427,6 +658,19 @@ main (int argc, char **argv) +@@ -427,6 +666,19 @@ main (int argc, char **argv) atexit (close_stdout); @@ -4024,8 +4052,8 @@ diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c skip_fields = 0; check_chars = SIZE_MAX; diff -urNp coreutils-8.17-orig/tests/Makefile.am coreutils-8.17/tests/Makefile.am ---- coreutils-8.17-orig/tests/Makefile.am 2012-08-20 12:52:07.846555240 +0200 -+++ coreutils-8.17/tests/Makefile.am 2012-08-20 12:52:26.680469779 +0200 +--- coreutils-8.17-orig/tests/Makefile.am 2013-01-24 17:03:36.144332400 +0100 ++++ coreutils-8.17/tests/Makefile.am 2013-01-24 17:11:53.554331990 +0100 @@ -246,6 +246,7 @@ TESTS = \ misc/sort-debug-warn \ misc/sort-discrim \ @@ -4034,7 +4062,7 @@ diff -urNp coreutils-8.17-orig/tests/Makefile.am coreutils-8.17/tests/Makefile.a misc/sort-float \ misc/sort-merge \ misc/sort-merge-fdlimit \ -@@ -543,6 +544,10 @@ TESTS = \ +@@ -545,6 +546,10 @@ TESTS = \ $(root_tests) pr_data = \ @@ -4047,7 +4075,7 @@ diff -urNp coreutils-8.17-orig/tests/Makefile.am coreutils-8.17/tests/Makefile.a pr/0FFnt \ diff -urNp coreutils-8.17-orig/tests/misc/cut coreutils-8.17/tests/misc/cut --- coreutils-8.17-orig/tests/misc/cut 2012-02-03 10:22:06.000000000 +0100 -+++ coreutils-8.17/tests/misc/cut 2012-08-20 12:52:26.681467766 +0200 ++++ coreutils-8.17/tests/misc/cut 2013-01-24 17:11:53.555332032 +0100 @@ -23,14 +23,15 @@ use strict; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -4079,7 +4107,7 @@ diff -urNp coreutils-8.17-orig/tests/misc/cut coreutils-8.17/tests/misc/cut ['inval4', '-f', '1-2,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, diff -urNp coreutils-8.17-orig/tests/misc/mb1.I coreutils-8.17/tests/misc/mb1.I --- coreutils-8.17-orig/tests/misc/mb1.I 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.17/tests/misc/mb1.I 2012-08-20 12:52:26.682468139 +0200 ++++ coreutils-8.17/tests/misc/mb1.I 2013-01-24 17:11:53.555332032 +0100 @@ -0,0 +1,4 @@ +Apple@10 +Banana@5 @@ -4087,7 +4115,7 @@ diff -urNp coreutils-8.17-orig/tests/misc/mb1.I coreutils-8.17/tests/misc/mb1.I +Cherry@30 diff -urNp coreutils-8.17-orig/tests/misc/mb1.X coreutils-8.17/tests/misc/mb1.X --- coreutils-8.17-orig/tests/misc/mb1.X 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.17/tests/misc/mb1.X 2012-08-20 12:52:26.682468139 +0200 ++++ coreutils-8.17/tests/misc/mb1.X 2013-01-24 17:11:53.556332141 +0100 @@ -0,0 +1,4 @@ +Banana@5 +Apple@10 @@ -4095,7 +4123,7 @@ diff -urNp coreutils-8.17-orig/tests/misc/mb1.X coreutils-8.17/tests/misc/mb1.X +Cherry@30 diff -urNp coreutils-8.17-orig/tests/misc/mb2.I coreutils-8.17/tests/misc/mb2.I --- coreutils-8.17-orig/tests/misc/mb2.I 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.17/tests/misc/mb2.I 2012-08-20 12:52:26.683472746 +0200 ++++ coreutils-8.17/tests/misc/mb2.I 2013-01-24 17:11:53.556332141 +0100 @@ -0,0 +1,4 @@ +Apple@AA10@@20 +Banana@AA5@@30 @@ -4103,7 +4131,7 @@ diff -urNp coreutils-8.17-orig/tests/misc/mb2.I coreutils-8.17/tests/misc/mb2.I +Cherry@AA30@@10 diff -urNp coreutils-8.17-orig/tests/misc/mb2.X coreutils-8.17/tests/misc/mb2.X --- coreutils-8.17-orig/tests/misc/mb2.X 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.17/tests/misc/mb2.X 2012-08-20 12:52:26.684468471 +0200 ++++ coreutils-8.17/tests/misc/mb2.X 2013-01-24 17:11:53.557333171 +0100 @@ -0,0 +1,4 @@ +Citrus@AA20@@5 +Cherry@AA30@@10 @@ -4111,7 +4139,7 @@ diff -urNp coreutils-8.17-orig/tests/misc/mb2.X coreutils-8.17/tests/misc/mb2.X +Banana@AA5@@30 diff -urNp coreutils-8.17-orig/tests/misc/sort-mb-tests coreutils-8.17/tests/misc/sort-mb-tests --- coreutils-8.17-orig/tests/misc/sort-mb-tests 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.17/tests/misc/sort-mb-tests 2012-08-20 12:52:26.684468471 +0200 ++++ coreutils-8.17/tests/misc/sort-mb-tests 2013-01-24 17:11:53.557333171 +0100 @@ -0,0 +1,58 @@ +#! /bin/sh +case $# in diff --git a/coreutils.spec b/coreutils.spec index 6d4f4bf..880319c 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.17 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -425,6 +425,10 @@ fi %{?!norunuser:%{_sbindir}/runuser} %changelog +* Thu Jan 24 2013 Ondrej Vasik 8.17-8 +- fix multiple segmantation faults in i18n patch (by SUSE) + (#869442, #902917)- CVE2013-0223/CVE2013-0221/CVE2013-0222 + * Tue Dec 11 2012 Ondrej Vasik 8.17-7 - fix showing duplicates in df (#709351, O.Oprala, B.Voelker)