diff --git a/files/coreutils-8.26-i18n-1.patch b/files/coreutils-8.27-i18n-1.patch rename from files/coreutils-8.26-i18n-1.patch rename to files/coreutils-8.27-i18n-1.patch --- a/files/coreutils-8.26-i18n-1.patch +++ b/files/coreutils-8.27-i18n-1.patch @@ -1,14 +1,14 @@ Submitted by: DJ Lucas (dj_AT_linuxfromscratch_DOT_org) -Date: 2016-12-03 -Initial Package Version: 8.26 +Date: 2017-03-12 +Initial Package Version: 8.27 Upstream Status: Rejected -Origin: Based on Suse's i18n patches at - https://build.opensuse.org/package/show/Base:System/coreutils/ +Origin: Based on Fedora's i18n patches at + http://pkgs.fedoraproject.org/cgit/rpms/coreutils.git/tree/ Description: Fixes i18n issues with various Coreutils programs -diff -Naurp coreutils-8.26-orig/bootstrap.conf coreutils-8.26/bootstrap.conf ---- coreutils-8.26-orig/bootstrap.conf 2016-11-06 16:15:29.000000000 -0600 -+++ coreutils-8.26/bootstrap.conf 2016-12-02 19:15:23.514391986 -0600 +diff -Naurp coreutils-8.27-orig/bootstrap.conf coreutils-8.27/bootstrap.conf +--- coreutils-8.27-orig/bootstrap.conf 2017-03-07 23:34:06.000000000 -0600 ++++ coreutils-8.27/bootstrap.conf 2017-03-11 23:47:38.068058445 -0600 @@ -152,6 +152,7 @@ gnulib_modules=" maintainer-makefile malloc-gnu @@ -17,10 +17,10 @@ mbrlen mbrtowc mbsalign -diff -Naurp coreutils-8.26-orig/configure.ac coreutils-8.26/configure.ac ---- coreutils-8.26-orig/configure.ac 2016-11-29 12:03:45.000000000 -0600 -+++ coreutils-8.26/configure.ac 2016-12-02 19:15:23.515391902 -0600 -@@ -427,6 +427,8 @@ fi +diff -Naurp coreutils-8.27-orig/configure.ac coreutils-8.27/configure.ac +--- coreutils-8.27-orig/configure.ac 2017-02-26 08:52:29.000000000 -0600 ++++ coreutils-8.27/configure.ac 2017-03-11 23:47:38.068058445 -0600 +@@ -429,6 +429,8 @@ fi # I'm leaving it here for now. This whole thing needs to be modernized... gl_WINSIZE_IN_PTEM @@ -29,9 +29,9 @@ gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \ -diff -Naurp coreutils-8.26-orig/lib/linebuffer.h coreutils-8.26/lib/linebuffer.h ---- coreutils-8.26-orig/lib/linebuffer.h 2016-07-15 14:47:39.000000000 -0500 -+++ coreutils-8.26/lib/linebuffer.h 2016-12-02 19:15:23.515391902 -0600 +diff -Naurp coreutils-8.27-orig/lib/linebuffer.h coreutils-8.27/lib/linebuffer.h +--- coreutils-8.27-orig/lib/linebuffer.h 2017-01-01 16:35:38.000000000 -0600 ++++ coreutils-8.27/lib/linebuffer.h 2017-03-11 23:47:13.089286391 -0600 @@ -21,6 +21,11 @@ # include @@ -54,19 +54,19 @@ }; /* Initialize linebuffer LINEBUFFER for use. */ -diff -Naurp coreutils-8.26-orig/lib/mbfile.c coreutils-8.26/lib/mbfile.c ---- coreutils-8.26-orig/lib/mbfile.c 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.26/lib/mbfile.c 2016-12-02 19:15:23.515391902 -0600 +diff -Naurp coreutils-8.27-orig/lib/mbfile.c coreutils-8.27/lib/mbfile.c +--- coreutils-8.27-orig/lib/mbfile.c 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.27/lib/mbfile.c 2017-03-11 23:47:38.069058397 -0600 @@ -0,0 +1,3 @@ +#include +#define MBFILE_INLINE _GL_EXTERN_INLINE +#include "mbfile.h" -diff -Naurp coreutils-8.26-orig/lib/mbfile.h coreutils-8.26/lib/mbfile.h ---- coreutils-8.26-orig/lib/mbfile.h 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.26/lib/mbfile.h 2016-12-02 19:15:23.516391818 -0600 +diff -Naurp coreutils-8.27-orig/lib/mbfile.h coreutils-8.27/lib/mbfile.h +--- coreutils-8.27-orig/lib/mbfile.h 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.27/lib/mbfile.h 2017-03-11 23:47:38.069058397 -0600 @@ -0,0 +1,255 @@ +/* Multibyte character I/O: macros for multi-byte encodings. -+ Copyright (C) 2001, 2005, 2009-2015 Free Software Foundation, Inc. ++ Copyright (C) 2001, 2005, 2009-2017 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 @@ -320,12 +320,12 @@ +_GL_INLINE_HEADER_BEGIN + +#endif /* _MBFILE_H */ -diff -Naurp coreutils-8.26-orig/m4/mbfile.m4 coreutils-8.26/m4/mbfile.m4 ---- coreutils-8.26-orig/m4/mbfile.m4 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.26/m4/mbfile.m4 2016-12-02 19:15:23.516391818 -0600 +diff -Naurp coreutils-8.27-orig/m4/mbfile.m4 coreutils-8.27/m4/mbfile.m4 +--- coreutils-8.27-orig/m4/mbfile.m4 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.27/m4/mbfile.m4 2017-03-11 23:47:38.070058349 -0600 @@ -0,0 +1,14 @@ +# mbfile.m4 serial 7 -+dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc. ++dnl Copyright (C) 2005, 2008-2017 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. @@ -338,9 +338,9 @@ + AC_REQUIRE([AC_TYPE_MBSTATE_T]) + : +]) -diff -Naurp coreutils-8.26-orig/src/cut.c coreutils-8.26/src/cut.c ---- coreutils-8.26-orig/src/cut.c 2016-10-15 16:00:55.000000000 -0500 -+++ coreutils-8.26/src/cut.c 2016-12-02 19:15:23.517391733 -0600 +diff -Naurp coreutils-8.27-orig/src/cut.c coreutils-8.27/src/cut.c +--- coreutils-8.27-orig/src/cut.c 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/src/cut.c 2017-03-11 23:47:59.526048471 -0600 @@ -28,6 +28,11 @@ #include #include @@ -902,9 +902,9 @@ } if (optind == argc) -diff -Naurp coreutils-8.26-orig/src/expand.c coreutils-8.26/src/expand.c ---- coreutils-8.26-orig/src/expand.c 2016-11-06 16:15:30.000000000 -0600 -+++ coreutils-8.26/src/expand.c 2016-12-02 19:15:23.518391649 -0600 +diff -Naurp coreutils-8.27-orig/src/expand.c coreutils-8.27/src/expand.c +--- coreutils-8.27-orig/src/expand.c 2017-02-26 15:42:25.000000000 -0600 ++++ coreutils-8.27/src/expand.c 2017-03-11 23:49:06.758133530 -0600 @@ -37,6 +37,9 @@ #include #include @@ -1057,9 +1057,9 @@ } } -diff -Naurp coreutils-8.26-orig/src/expand-common.c coreutils-8.26/src/expand-common.c ---- coreutils-8.26-orig/src/expand-common.c 2016-11-06 16:15:30.000000000 -0600 -+++ coreutils-8.26/src/expand-common.c 2016-12-02 19:15:23.518391649 -0600 +diff -Naurp coreutils-8.27-orig/src/expand-common.c coreutils-8.27/src/expand-common.c +--- coreutils-8.27-orig/src/expand-common.c 2017-03-01 11:22:55.000000000 -0600 ++++ coreutils-8.27/src/expand-common.c 2017-03-11 23:49:06.757133570 -0600 @@ -18,6 +18,7 @@ #include @@ -1068,8 +1068,8 @@ #include "system.h" #include "die.h" #include "error.h" -@@ -85,6 +86,119 @@ add_tab_stop (uintmax_t tabval) - } +@@ -105,6 +106,119 @@ set_extend_size (uintmax_t tabval) + return ok; } +extern int @@ -1188,9 +1188,9 @@ /* Add the comma or blank separated list of tab stops STOPS to the list of tab stops. */ extern void -diff -Naurp coreutils-8.26-orig/src/expand-common.h coreutils-8.26/src/expand-common.h ---- coreutils-8.26-orig/src/expand-common.h 2016-11-06 16:15:30.000000000 -0600 -+++ coreutils-8.26/src/expand-common.h 2016-12-02 19:15:23.518391649 -0600 +diff -Naurp coreutils-8.27-orig/src/expand-common.h coreutils-8.27/src/expand-common.h +--- coreutils-8.27-orig/src/expand-common.h 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/src/expand-common.h 2017-03-11 23:49:06.758133530 -0600 @@ -34,6 +34,18 @@ extern size_t max_column_width; /* The desired exit status. */ extern int exit_status; @@ -1210,9 +1210,9 @@ /* Add tab stop TABVAL to the end of 'tab_list'. */ extern void add_tab_stop (uintmax_t tabval); -diff -Naurp coreutils-8.26-orig/src/fold.c coreutils-8.26/src/fold.c ---- coreutils-8.26-orig/src/fold.c 2016-11-06 16:15:30.000000000 -0600 -+++ coreutils-8.26/src/fold.c 2016-12-02 19:15:23.519391564 -0600 +diff -Naurp coreutils-8.27-orig/src/fold.c coreutils-8.27/src/fold.c +--- coreutils-8.27-orig/src/fold.c 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/src/fold.c 2017-03-11 23:49:30.982169404 -0600 @@ -22,12 +22,34 @@ #include #include @@ -1360,16 +1360,16 @@ /* Look for the last blank. */ while (logical_end) { -@@ -215,11 +252,221 @@ fold_file (char const *filename, size_t +@@ -215,11 +252,220 @@ fold_file (char const *filename, size_t line_out[offset_out++] = c; } - saved_errno = errno; + *saved_errno = errno; - - if (offset_out) - fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); - ++ ++ if (offset_out) ++ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); ++ +} + +#if HAVE_MBRTOWC @@ -1455,39 +1455,38 @@ + } + +rescan: -+ if (operating_mode == byte_mode) /* byte mode */ ++ if (convfail) ++ increment = 1; ++ else if (wc == L'\n') ++ { ++ /* preserve newline */ ++ fwrite (line_out, sizeof(char), offset_out, stdout); ++ START_NEW_LINE; ++ continue; ++ } ++ else if (operating_mode == byte_mode) /* byte mode */ + increment = mblength; + else if (operating_mode == character_mode) /* character mode */ + increment = 1; -+ else /* column mode */ ++ else /* column mode */ + { -+ if (convfail) -+ increment = 1; -+ else ++ switch (wc) + { -+ switch (wc) -+ { -+ case L'\n': -+ fwrite (line_out, sizeof(char), offset_out, stdout); -+ START_NEW_LINE; -+ continue; -+ -+ case L'\b': -+ increment = (column > 0) ? -1 : 0; -+ break; ++ case L'\b': ++ increment = (column > 0) ? -1 : 0; ++ break; + -+ case L'\r': -+ increment = -1 * column; -+ break; ++ case L'\r': ++ increment = -1 * column; ++ break; + -+ case L'\t': -+ increment = 8 - column % 8; -+ break; ++ case L'\t': ++ increment = 8 - column % 8; ++ break; + -+ default: -+ increment = wcwidth (wc); -+ increment = (increment < 0) ? 0 : increment; -+ } ++ default: ++ increment = wcwidth (wc); ++ increment = (increment < 0) ? 0 : increment; + } + } + @@ -1541,10 +1540,10 @@ + } + + *saved_errno = errno; -+ -+ if (offset_out) -+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); -+ + + if (offset_out) + fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); + +} +#endif + @@ -1583,7 +1582,7 @@ if (ferror (istream)) { error (0, saved_errno, "%s", quotef (filename)); -@@ -252,7 +499,8 @@ main (int argc, char **argv) +@@ -252,7 +498,8 @@ main (int argc, char **argv) atexit (close_stdout); @@ -1593,7 +1592,7 @@ while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1) { -@@ -261,7 +509,15 @@ main (int argc, char **argv) +@@ -261,7 +508,15 @@ main (int argc, char **argv) switch (optc) { case 'b': /* Count bytes rather than columns. */ @@ -1610,9 +1609,9 @@ break; case 's': /* Break at word boundaries. */ -diff -Naurp coreutils-8.26-orig/src/join.c coreutils-8.26/src/join.c ---- coreutils-8.26-orig/src/join.c 2016-11-06 16:15:30.000000000 -0600 -+++ coreutils-8.26/src/join.c 2016-12-02 19:15:23.520391480 -0600 +diff -Naurp coreutils-8.27-orig/src/join.c coreutils-8.27/src/join.c +--- coreutils-8.27-orig/src/join.c 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/src/join.c 2017-03-11 23:47:13.091286290 -0600 @@ -22,19 +22,33 @@ #include #include @@ -2102,9 +2101,9 @@ } break; -diff -Naurp coreutils-8.26-orig/src/pr.c coreutils-8.26/src/pr.c ---- coreutils-8.26-orig/src/pr.c 2016-11-25 07:40:49.000000000 -0600 -+++ coreutils-8.26/src/pr.c 2016-12-02 19:15:23.522391311 -0600 +diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c +--- coreutils-8.27-orig/src/pr.c 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/src/pr.c 2017-03-11 23:47:13.094286139 -0600 @@ -311,6 +311,24 @@ #include @@ -2867,9 +2866,9 @@ /* 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 -Naurp coreutils-8.26-orig/src/sort.c coreutils-8.26/src/sort.c ---- coreutils-8.26-orig/src/sort.c 2016-11-06 16:15:30.000000000 -0600 -+++ coreutils-8.26/src/sort.c 2016-12-02 19:15:23.525391058 -0600 +diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c +--- coreutils-8.27-orig/src/sort.c 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/src/sort.c 2017-03-11 23:49:22.416505389 -0600 @@ -29,6 +29,14 @@ #include #include @@ -3897,9 +3896,9 @@ if (have_read_stdin && fclose (stdin) == EOF) sort_die (_("close failed"), "-"); -diff -Naurp coreutils-8.26-orig/src/unexpand.c coreutils-8.26/src/unexpand.c ---- coreutils-8.26-orig/src/unexpand.c 2016-11-06 16:15:30.000000000 -0600 -+++ coreutils-8.26/src/unexpand.c 2016-12-02 19:15:23.525391058 -0600 +diff -Naurp coreutils-8.27-orig/src/unexpand.c coreutils-8.27/src/unexpand.c +--- coreutils-8.27-orig/src/unexpand.c 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/src/unexpand.c 2017-03-11 23:49:06.758133530 -0600 @@ -38,6 +38,9 @@ #include #include @@ -4102,9 +4101,9 @@ } } -diff -Naurp coreutils-8.26-orig/src/uniq.c coreutils-8.26/src/uniq.c ---- coreutils-8.26-orig/src/uniq.c 2016-11-06 16:15:30.000000000 -0600 -+++ coreutils-8.26/src/uniq.c 2016-12-02 19:15:23.526390974 -0600 +diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c +--- coreutils-8.27-orig/src/uniq.c 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/src/uniq.c 2017-03-11 23:47:13.098285938 -0600 @@ -21,6 +21,17 @@ #include #include @@ -4490,13 +4489,13 @@ skip_chars = 0; skip_fields = 0; check_chars = SIZE_MAX; -diff -Naurp coreutils-8.26-orig/tests/expand/mb.sh coreutils-8.26/tests/expand/mb.sh ---- coreutils-8.26-orig/tests/expand/mb.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.26/tests/expand/mb.sh 2016-12-02 19:15:23.526390974 -0600 +diff -Naurp coreutils-8.27-orig/tests/expand/mb.sh coreutils-8.27/tests/expand/mb.sh +--- coreutils-8.27-orig/tests/expand/mb.sh 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.27/tests/expand/mb.sh 2017-03-11 23:49:06.759133489 -0600 @@ -0,0 +1,183 @@ +#!/bin/sh + -+# Copyright (C) 2012-2015 Free Software Foundation, Inc. ++# Copyright (C) 2012-2017 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 @@ -4677,9 +4676,9 @@ +compare exp out > /dev/null 2>&1 || fail=1 + +exit $fail -diff -Naurp coreutils-8.26-orig/tests/i18n/sort.sh coreutils-8.26/tests/i18n/sort.sh ---- coreutils-8.26-orig/tests/i18n/sort.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.26/tests/i18n/sort.sh 2016-12-02 19:15:23.527390889 -0600 +diff -Naurp coreutils-8.27-orig/tests/i18n/sort.sh coreutils-8.27/tests/i18n/sort.sh +--- coreutils-8.27-orig/tests/i18n/sort.sh 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.27/tests/i18n/sort.sh 2017-03-11 23:47:13.100285838 -0600 @@ -0,0 +1,29 @@ +#!/bin/sh +# Verify sort's multi-byte support. @@ -4710,10 +4709,10 @@ + + +Exit $fail -diff -Naurp coreutils-8.26-orig/tests/local.mk coreutils-8.26/tests/local.mk ---- coreutils-8.26-orig/tests/local.mk 2016-11-22 14:04:32.000000000 -0600 -+++ coreutils-8.26/tests/local.mk 2016-12-02 19:15:23.527390889 -0600 -@@ -350,6 +350,8 @@ all_tests = \ +diff -Naurp coreutils-8.27-orig/tests/local.mk coreutils-8.27/tests/local.mk +--- coreutils-8.27-orig/tests/local.mk 2017-02-28 22:25:37.000000000 -0600 ++++ coreutils-8.27/tests/local.mk 2017-03-11 23:47:38.072058253 -0600 +@@ -352,6 +352,8 @@ all_tests = \ tests/misc/sort-discrim.sh \ tests/misc/sort-files0-from.pl \ tests/misc/sort-float.sh \ @@ -4722,7 +4721,7 @@ tests/misc/sort-h-thousands-sep.sh \ tests/misc/sort-merge.pl \ tests/misc/sort-merge-fdlimit.sh \ -@@ -542,6 +544,7 @@ all_tests = \ +@@ -544,6 +546,7 @@ all_tests = \ tests/du/threshold.sh \ tests/du/trailing-slash.sh \ tests/du/two-args.sh \ @@ -4730,7 +4729,7 @@ tests/id/gnu-zero-uids.sh \ tests/id/no-context.sh \ tests/id/context.sh \ -@@ -682,6 +685,7 @@ all_tests = \ +@@ -684,6 +687,7 @@ all_tests = \ tests/touch/read-only.sh \ tests/touch/relative.sh \ tests/touch/trailing-slash.sh \ @@ -4738,9 +4737,9 @@ $(all_root_tests) # See tests/factor/create-test.sh. -diff -Naurp coreutils-8.26-orig/tests/misc/cut.pl coreutils-8.26/tests/misc/cut.pl ---- coreutils-8.26-orig/tests/misc/cut.pl 2016-03-16 07:21:24.000000000 -0500 -+++ coreutils-8.26/tests/misc/cut.pl 2016-12-02 19:15:23.527390889 -0600 +diff -Naurp coreutils-8.27-orig/tests/misc/cut.pl coreutils-8.27/tests/misc/cut.pl +--- coreutils-8.27-orig/tests/misc/cut.pl 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/tests/misc/cut.pl 2017-03-11 23:47:13.100285838 -0600 @@ -23,9 +23,11 @@ use strict; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -4763,9 +4762,9 @@ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; } push @Tests, @new; -diff -Naurp coreutils-8.26-orig/tests/misc/expand.pl coreutils-8.26/tests/misc/expand.pl ---- coreutils-8.26-orig/tests/misc/expand.pl 2016-11-06 16:15:30.000000000 -0600 -+++ coreutils-8.26/tests/misc/expand.pl 2016-12-02 19:15:23.528390805 -0600 +diff -Naurp coreutils-8.27-orig/tests/misc/expand.pl coreutils-8.27/tests/misc/expand.pl +--- coreutils-8.27-orig/tests/misc/expand.pl 2017-03-01 11:16:46.000000000 -0600 ++++ coreutils-8.27/tests/misc/expand.pl 2017-03-11 23:47:13.101285788 -0600 @@ -27,6 +27,15 @@ my $prog = 'expand'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -4782,8 +4781,8 @@ my @Tests = ( ['t1', '--tabs=3', {IN=>"a\tb"}, {OUT=>"a b"}], -@@ -140,6 +149,8 @@ my @Tests = - +@@ -152,6 +161,8 @@ my @Tests = + ['trail9', '--tab=1,2 -t/5',{IN=>"\ta\tb\tc"}, {OUT=>" a b c"}], # Test errors + # FIXME: The following tests contain ‘quoting’ specific to LC_MESSAGES @@ -4791,8 +4790,8 @@ ['e1', '--tabs="a"', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR => "$prog: tab size contains invalid character(s): 'a'\n"}], ['e2', "-t $UINTMAX_OFLOW", {IN=>''}, {OUT=>''}, {EXIT=>1}, -@@ -150,6 +161,37 @@ my @Tests = - {ERR => "$prog: tab sizes must be ascending\n"}], +@@ -168,6 +179,37 @@ my @Tests = + {ERR => "$prog: '/' specifier not at start of number: '/'\n"}], ); +if ($mb_locale ne 'C') @@ -4829,9 +4828,9 @@ my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.26-orig/tests/misc/fold.pl coreutils-8.26/tests/misc/fold.pl ---- coreutils-8.26-orig/tests/misc/fold.pl 2016-03-16 07:21:24.000000000 -0500 -+++ coreutils-8.26/tests/misc/fold.pl 2016-12-02 19:15:23.528390805 -0600 +diff -Naurp coreutils-8.27-orig/tests/misc/fold.pl coreutils-8.27/tests/misc/fold.pl +--- coreutils-8.27-orig/tests/misc/fold.pl 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/tests/misc/fold.pl 2017-03-11 23:47:13.101285788 -0600 @@ -20,9 +20,18 @@ use strict; (my $program_name = $0) =~ s|.*/||; @@ -4901,9 +4900,9 @@ -my $prog = 'fold'; my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose); exit $fail; -diff -Naurp coreutils-8.26-orig/tests/misc/join.pl coreutils-8.26/tests/misc/join.pl ---- coreutils-8.26-orig/tests/misc/join.pl 2016-03-16 07:21:24.000000000 -0500 -+++ coreutils-8.26/tests/misc/join.pl 2016-12-02 19:15:23.528390805 -0600 +diff -Naurp coreutils-8.27-orig/tests/misc/join.pl coreutils-8.27/tests/misc/join.pl +--- coreutils-8.27-orig/tests/misc/join.pl 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/tests/misc/join.pl 2017-03-11 23:47:13.102285737 -0600 @@ -25,6 +25,15 @@ my $limits = getlimits (); my $prog = 'join'; @@ -4970,9 +4969,9 @@ my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.26-orig/tests/misc/sort-mb-tests.sh coreutils-8.26/tests/misc/sort-mb-tests.sh ---- coreutils-8.26-orig/tests/misc/sort-mb-tests.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.26/tests/misc/sort-mb-tests.sh 2016-12-02 19:15:23.528390805 -0600 +diff -Naurp coreutils-8.27-orig/tests/misc/sort-mb-tests.sh coreutils-8.27/tests/misc/sort-mb-tests.sh +--- coreutils-8.27-orig/tests/misc/sort-mb-tests.sh 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.27/tests/misc/sort-mb-tests.sh 2017-03-11 23:47:13.102285737 -0600 @@ -0,0 +1,45 @@ +#!/bin/sh +# Verify sort's multi-byte support. @@ -5019,9 +5018,9 @@ +compare exp out || { fail=1; cat out; } + +Exit $fail -diff -Naurp coreutils-8.26-orig/tests/misc/sort-merge.pl coreutils-8.26/tests/misc/sort-merge.pl ---- coreutils-8.26-orig/tests/misc/sort-merge.pl 2016-03-16 07:21:24.000000000 -0500 -+++ coreutils-8.26/tests/misc/sort-merge.pl 2016-12-02 19:15:23.529390720 -0600 +diff -Naurp coreutils-8.27-orig/tests/misc/sort-merge.pl coreutils-8.27/tests/misc/sort-merge.pl +--- coreutils-8.27-orig/tests/misc/sort-merge.pl 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/tests/misc/sort-merge.pl 2017-03-11 23:47:13.102285737 -0600 @@ -26,6 +26,15 @@ my $prog = 'sort'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -5078,9 +5077,9 @@ my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.26-orig/tests/misc/sort.pl coreutils-8.26/tests/misc/sort.pl ---- coreutils-8.26-orig/tests/misc/sort.pl 2016-03-16 07:21:24.000000000 -0500 -+++ coreutils-8.26/tests/misc/sort.pl 2016-12-02 19:15:23.529390720 -0600 +diff -Naurp coreutils-8.27-orig/tests/misc/sort.pl coreutils-8.27/tests/misc/sort.pl +--- coreutils-8.27-orig/tests/misc/sort.pl 2017-01-21 08:53:43.000000000 -0600 ++++ coreutils-8.27/tests/misc/sort.pl 2017-03-11 23:47:13.103285687 -0600 @@ -24,10 +24,15 @@ my $prog = 'sort'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -5098,7 +5097,7 @@ # Since each test is run with a file name and with redirected stdin, # the name in the diagnostic is either the file name or "-". # Normalize each diagnostic to use '-'. -@@ -424,6 +429,38 @@ foreach my $t (@Tests) +@@ -423,6 +428,38 @@ foreach my $t (@Tests) } } @@ -5137,7 +5136,7 @@ @Tests = triple_test \@Tests; # Remember that triple_test creates from each test with exactly one "IN" -@@ -433,6 +470,7 @@ foreach my $t (@Tests) +@@ -432,6 +469,7 @@ foreach my $t (@Tests) # Remove the IN_PIPE version of the "output-is-input" test above. # The others aren't susceptible because they have three inputs each. @Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests; @@ -5145,9 +5144,9 @@ my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.26-orig/tests/misc/unexpand.pl coreutils-8.26/tests/misc/unexpand.pl ---- coreutils-8.26-orig/tests/misc/unexpand.pl 2016-11-06 16:15:30.000000000 -0600 -+++ coreutils-8.26/tests/misc/unexpand.pl 2016-12-02 19:15:23.530390636 -0600 +diff -Naurp coreutils-8.27-orig/tests/misc/unexpand.pl coreutils-8.27/tests/misc/unexpand.pl +--- coreutils-8.27-orig/tests/misc/unexpand.pl 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/tests/misc/unexpand.pl 2017-03-11 23:47:13.103285687 -0600 @@ -27,6 +27,14 @@ my $limits = getlimits (); my $prog = 'unexpand'; @@ -5201,9 +5200,9 @@ my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.26-orig/tests/misc/uniq.pl coreutils-8.26/tests/misc/uniq.pl ---- coreutils-8.26-orig/tests/misc/uniq.pl 2016-03-16 07:21:24.000000000 -0500 -+++ coreutils-8.26/tests/misc/uniq.pl 2016-12-02 19:15:23.530390636 -0600 +diff -Naurp coreutils-8.27-orig/tests/misc/uniq.pl coreutils-8.27/tests/misc/uniq.pl +--- coreutils-8.27-orig/tests/misc/uniq.pl 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/tests/misc/uniq.pl 2017-03-11 23:47:13.103285687 -0600 @@ -23,9 +23,17 @@ my $limits = getlimits (); my $prog = 'uniq'; my $try = "Try '$prog --help' for more information.\n"; @@ -5276,9 +5275,9 @@ @Tests = add_z_variants \@Tests; @Tests = triple_test \@Tests; -diff -Naurp coreutils-8.26-orig/tests/pr/pr-tests.pl coreutils-8.26/tests/pr/pr-tests.pl ---- coreutils-8.26-orig/tests/pr/pr-tests.pl 2016-11-25 08:01:44.000000000 -0600 -+++ coreutils-8.26/tests/pr/pr-tests.pl 2016-12-02 19:15:23.530390636 -0600 +diff -Naurp coreutils-8.27-orig/tests/pr/pr-tests.pl coreutils-8.27/tests/pr/pr-tests.pl +--- coreutils-8.27-orig/tests/pr/pr-tests.pl 2017-01-01 16:34:24.000000000 -0600 ++++ coreutils-8.27/tests/pr/pr-tests.pl 2017-03-11 23:47:13.103285687 -0600 @@ -24,6 +24,15 @@ use strict; my $prog = 'pr'; my $normalize_strerror = "s/': .*/'/"; @@ -5344,13 +5343,13 @@ my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.26-orig/tests/unexpand/mb.sh coreutils-8.26/tests/unexpand/mb.sh ---- coreutils-8.26-orig/tests/unexpand/mb.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.26/tests/unexpand/mb.sh 2016-12-02 19:15:23.531390552 -0600 +diff -Naurp coreutils-8.27-orig/tests/unexpand/mb.sh coreutils-8.27/tests/unexpand/mb.sh +--- coreutils-8.27-orig/tests/unexpand/mb.sh 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.27/tests/unexpand/mb.sh 2017-03-11 23:49:06.759133489 -0600 @@ -0,0 +1,172 @@ +#!/bin/sh + -+# Copyright (C) 2012-2015 Free Software Foundation, Inc. ++# Copyright (C) 2012-2017 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 diff --git a/files/security/cve-2017-7476.patch b/files/security/cve-2017-7476.patch new file mode 100644 --- /dev/null +++ b/files/security/cve-2017-7476.patch @@ -0,0 +1,190 @@ +From fc286e2b3af5b2ed9aec44b520265bb0968f1660 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Mon, 24 Apr 2017 01:43:36 -0700 +Subject: [PATCH 1/2] time_rz: fix heap buffer overflow vulnerability + +This issue has been assigned CVE-2017-7476 and was +detected with American Fuzzy Lop 2.41b run on the +coreutils date(1) program with ASAN enabled. + + ERROR: AddressSanitizer: heap-buffer-overflow on address 0x... + WRITE of size 8 at 0x60d00000cff8 thread T0 + #1 0x443020 in extend_abbrs lib/time_rz.c:88 + #2 0x443356 in save_abbr lib/time_rz.c:155 + #3 0x44393f in localtime_rz lib/time_rz.c:290 + #4 0x41e4fe in parse_datetime2 lib/parse-datetime.y:1798 + +A minimized reproducer is the following 120 byte TZ value, +which goes beyond the value of ABBR_SIZE_MIN (119) on x86_64. +Extend the aa...b portion to overwrite more of the heap. + + date -d $(printf 'TZ="aaa%020daaaaaab%089d"') + +localtime_rz and mktime_z were affected since commit 4bc76593. +parse_datetime was affected since commit 4e6e16b3f. + +* lib/time_rz.c (save_abbr): Rearrange the calculation determining +whether there is enough buffer space available. The rearrangement +ensures we're only dealing with positive numbers, thus avoiding +the problematic promotion of signed to unsigned causing an invalid +comparison when zone_copy is more than ABBR_SIZE_MIN bytes beyond +the start of the buffer. +* tests/test-parse-datetime.c (main): Add a test case written by +Paul Eggert, which overwrites enough of the heap so that +standard glibc will fail with "free(): invalid pointer" +without the patch applied. +Reported and analyzed at https://bugzilla.redhat.com/1444774 + +Upstream-commit: 94e01571507835ff59dd8ce2a0b56a4b566965a4 +Signed-off-by: Kamil Dudka +--- + gnulib-tests/test-parse-datetime.c | 16 ++++++++++++++++ + lib/time_rz.c | 15 +++++++++++++-- + 2 files changed, 29 insertions(+), 2 deletions(-) + +diff --git a/gnulib-tests/test-parse-datetime.c b/gnulib-tests/test-parse-datetime.c +index b42a51c..b6fe457 100644 +--- a/gnulib-tests/test-parse-datetime.c ++++ b/gnulib-tests/test-parse-datetime.c +@@ -432,5 +432,21 @@ main (int argc _GL_UNUSED, char **argv) + ASSERT ( parse_datetime (&result, "TZ=\"\\\\\"", &now)); + ASSERT ( parse_datetime (&result, "TZ=\"\\\"\"", &now)); + ++ /* Outlandishly-long time zone abbreviations should not cause problems. */ ++ { ++ static char const bufprefix[] = "TZ=\""; ++ enum { tzname_len = 2000 }; ++ static char const bufsuffix[] = "0\" 1970-01-01 01:02:03.123456789"; ++ enum { bufsize = sizeof bufprefix - 1 + tzname_len + sizeof bufsuffix }; ++ char buf[bufsize]; ++ memcpy (buf, bufprefix, sizeof bufprefix - 1); ++ memset (buf + sizeof bufprefix - 1, 'X', tzname_len); ++ strcpy (buf + bufsize - sizeof bufsuffix, bufsuffix); ++ ASSERT (parse_datetime (&result, buf, &now)); ++ LOG (buf, now, result); ++ ASSERT (result.tv_sec == 1 * 60 * 60 + 2 * 60 + 3 ++ && result.tv_nsec == 123456789); ++ } ++ + return 0; + } +diff --git a/lib/time_rz.c b/lib/time_rz.c +index adb9c1c..c41a8ef 100644 +--- a/lib/time_rz.c ++++ b/lib/time_rz.c +@@ -27,6 +27,7 @@ + #include + + #include ++#include + #include + #include + #include +@@ -35,6 +36,10 @@ + #include "flexmember.h" + #include "time-internal.h" + ++#ifndef SIZE_MAX ++# define SIZE_MAX ((size_t) -1) ++#endif ++ + #if !HAVE_TZSET + static void tzset (void) { } + #endif +@@ -43,7 +48,7 @@ static void tzset (void) { } + the largest "small" request for the GNU C library malloc. */ + enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; + +-/* Minimum size of the ABBRS member of struct abbr. ABBRS is larger ++/* Minimum size of the ABBRS member of struct tm_zone. ABBRS is larger + only in the unlikely case where an abbreviation longer than this is + used. */ + enum { ABBR_SIZE_MIN = DEFAULT_MXFAST - offsetof (struct tm_zone, abbrs) }; +@@ -150,7 +155,13 @@ save_abbr (timezone_t tz, struct tm *tm) + if (! (*zone_copy || (zone_copy == tz->abbrs && tz->tz_is_set))) + { + size_t zone_size = strlen (zone) + 1; +- if (zone_size < tz->abbrs + ABBR_SIZE_MIN - zone_copy) ++ size_t zone_used = zone_copy - tz->abbrs; ++ if (SIZE_MAX - zone_used < zone_size) ++ { ++ errno = ENOMEM; ++ return false; ++ } ++ if (zone_used + zone_size < ABBR_SIZE_MIN) + extend_abbrs (zone_copy, zone, zone_size); + else + { +-- +2.9.3 + + +From 9579f90484c71e5a22f32f35189192a82e47550e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Wed, 26 Apr 2017 20:51:39 -0700 +Subject: [PATCH 2/2] date,touch: test and document large TZ security issue + +Add a test for CVE-2017-7476 which was fixed in gnulib at: +http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=94e01571 + +* tests/misc/date-tz.sh: Add a new test which overwrites enough +of the heap to trigger a segfault, even without ASAN enabled. +* tests/local.mk: Reference the new test. +* NEWS: Mention the bug fix. + +Upstream-commit: 9287ef2b1707e2a222f8ae776ce3785abcb16fba +Signed-off-by: Kamil Dudka +--- + tests/local.mk | 1 + + tests/misc/date-tz.sh | 26 ++++++++++++++++++++++++++ + 2 files changed, 27 insertions(+) + create mode 100755 tests/misc/date-tz.sh + +diff --git a/tests/local.mk b/tests/local.mk +index 9f1a853..ec0b414 100644 +--- a/tests/local.mk ++++ b/tests/local.mk +@@ -282,6 +282,7 @@ all_tests = \ + tests/misc/csplit-suppress-matched.pl \ + tests/misc/date-debug.sh \ + tests/misc/date-sec.sh \ ++ tests/misc/date-tz.sh \ + tests/misc/dircolors.pl \ + tests/misc/dirname.pl \ + tests/misc/env-null.sh \ +diff --git a/tests/misc/date-tz.sh b/tests/misc/date-tz.sh +new file mode 100755 +index 0000000..3fe1579 +--- /dev/null ++++ b/tests/misc/date-tz.sh +@@ -0,0 +1,26 @@ ++#!/bin/sh ++# Verify TZ processing. ++ ++# Copyright (C) 2017 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=.}/tests/init.sh"; path_prepend_ ./src ++print_ver_ date ++ ++# coreutils-8.27 would overwrite the heap with large TZ values ++tz_long=$(printf '%2000s' | tr ' ' a) ++date -d "TZ=\"${tz_long}0\" 2017" || fail=1 ++ ++Exit $fail +-- +2.9.3 + + diff --git a/package.yml b/package.yml --- a/package.yml +++ b/package.yml @@ -1,8 +1,8 @@ name : coreutils -version : 8.26 -release : 14 +version : 8.27 +release : 15 source : - - http://ftp.gnu.org/gnu/coreutils/coreutils-8.26.tar.xz : 155e94d748f8e2bc327c66e0cbebdb8d6ab265d2f37c3c928f7bf6c3beba9a8e + - https://ftp.gnu.org/gnu/coreutils/coreutils-8.27.tar.xz : 8891d349ee87b9ff7870f52b6d9312a9db672d2439d289bc57084771ca21656b license : - GPL-3.0 summary : GNU core utilities @@ -24,7 +24,8 @@ - acl-devel - attr-devel setup : | - %patch -p1 < $pkgfiles/coreutils-8.26-i18n-1.patch + %patch -p1 < $pkgfiles/coreutils-8.27-i18n-1.patch + %patch -p1 < $pkgfiles/security/cve-2017-7476.patch export FORCE_UNSAFE_CONFIGURE=1 %reconfigure --enable-largefile \ --enable-no-install-program=kill,uptime diff --git a/pspec_x86_64.xml b/pspec_x86_64.xml --- a/pspec_x86_64.xml +++ b/pspec_x86_64.xml @@ -2,8 +2,8 @@ coreutils - Ikey Doherty - ikey@solus-project.com + Pierre-Yves + pyu@riseup.net GPL-3.0 system.base @@ -50,12 +50,12 @@ - - 2015-12-10 - 8.26 + + 2017-06-08 + 8.27 Packaging update - Ikey Doherty - ikey@solus-project.com + Pierre-Yves + pyu@riseup.net \ No newline at end of file