From 7a7c1a231c01c2f817bb9a808e89c17e558f8be6 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Thu, 9 Mar 2017 09:57:09 +0100 Subject: [PATCH 01/18] new upstream release 8.27 --- coreutils-8.25-DIR_COLORS.patch | 119 +++++++------ coreutils-8.26-date-fix-tz-regre.patch | 82 --------- coreutils-8.26-test-lock.patch | 206 +--------------------- coreutils-8.26.tar.xz.sig | 17 -- coreutils-8.27.tar.xz.sig | 16 ++ coreutils-getgrouplist.patch | 2 +- coreutils-i18n-fix2-expand-unexpand.patch | 4 +- coreutils-i18n-fold-newline.patch | 31 ++-- coreutils-i18n-un-expand-BOM.patch | 50 ++++-- coreutils-i18n.patch | 31 ++-- coreutils-selinux.patch | 2 +- coreutils.spec | 16 +- sources | 2 +- 13 files changed, 163 insertions(+), 415 deletions(-) delete mode 100644 coreutils-8.26-date-fix-tz-regre.patch delete mode 100644 coreutils-8.26.tar.xz.sig create mode 100644 coreutils-8.27.tar.xz.sig diff --git a/coreutils-8.25-DIR_COLORS.patch b/coreutils-8.25-DIR_COLORS.patch index a8a2d1a..94923b0 100644 --- a/coreutils-8.25-DIR_COLORS.patch +++ b/coreutils-8.25-DIR_COLORS.patch @@ -4,16 +4,16 @@ Date: Fri, 17 Jun 2016 16:58:18 +0200 Subject: [PATCH] downstream changes to default DIR_COLORS --- - DIR_COLORS | 44 ++++---- - DIR_COLORS.256color | 294 +++++++++++++++++++++++------------------------- - DIR_COLORS.lightbgcolor | 207 +++++++++++++++++----------------- - 3 files changed, 271 insertions(+), 274 deletions(-) + DIR_COLORS | 41 ++++--- + DIR_COLORS.256color | 302 ++++++++++++++++++++++++------------------------ + DIR_COLORS.lightbgcolor | 215 +++++++++++++++++----------------- + 3 files changed, 286 insertions(+), 272 deletions(-) diff --git a/DIR_COLORS b/DIR_COLORS index d2ea453..27af9d7 100644 --- a/DIR_COLORS +++ b/DIR_COLORS -@@ -1,12 +1,18 @@ +@@ -1,6 +1,10 @@ # Configuration file for dircolors, a utility to help you set the # LS_COLORS environment variable used by GNU ls with the --color option. @@ -21,20 +21,20 @@ index d2ea453..27af9d7 100644 +# You can copy this file to .dir_colors in your $HOME directory to override +# the system defaults. + - # Copyright (C) 1996-2016 Free Software Foundation, Inc. + # Copyright (C) 1996-2017 Free Software Foundation, Inc. # Copying and distribution of this file, with or without modification, # are permitted provided the copyright notice and this notice are preserved. +@@ -8,6 +12,9 @@ + # The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the + # slackware version of dircolors) are recognized but ignored. --# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the --# slackware version of dircolors) are recognized but ignored. -+# The keywords OPTIONS and EIGHTBIT (honored by the slackware version of -+# dircolors) are recognized but ignored. For compatibility reasons, the -+# pattern "^COLOR.*none" is recognized as a way to disable colorization. -+# See https://bugzilla.redhat.com/1349579 for details. - ++# For compatibility, the pattern "^COLOR.*none" is recognized as a way to ++# disable colorization. See https://bugzilla.redhat.com/1349579 for details. ++ # Below are TERM entries, which can be a glob patterns, to match # against the TERM environment variable to determine if it is colorizable. -@@ -56,7 +62,7 @@ DOOR 01;35 # door + TERM Eterm +@@ -56,7 +63,7 @@ DOOR 01;35 # door BLK 40;33;01 # block device driver CHR 40;33;01 # character device driver ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ... @@ -43,7 +43,7 @@ index d2ea453..27af9d7 100644 SETUID 37;41 # file that is setuid (u+s) SETGID 30;43 # file that is setgid (g+s) CAPABILITY 30;41 # file with capability -@@ -181,21 +187,21 @@ EXEC 01;32 +@@ -185,21 +192,21 @@ EXEC 01;32 .ogx 01;35 # audio formats @@ -72,7 +72,7 @@ index d2ea453..27af9d7 100644 +.ra 01;36 +.wav 01;36 - # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions + # https://wiki.xiph.org/MIME_Types_and_File_Extensions -.oga 00;36 -.opus 00;36 -.spx 00;36 @@ -85,26 +85,23 @@ diff --git a/DIR_COLORS.256color b/DIR_COLORS.256color index d2ea453..74c34ba 100644 --- a/DIR_COLORS.256color +++ b/DIR_COLORS.256color -@@ -1,39 +1,22 @@ --# Configuration file for dircolors, a utility to help you set the --# LS_COLORS environment variable used by GNU ls with the --color option. +@@ -1,3 +1,9 @@ +# Configuration file for the 256color ls utility + +# This file goes in the /etc directory, and must be world readable. +# You can copy this file to .dir_colors in your $HOME directory to override +# the system defaults. ++ + # Configuration file for dircolors, a utility to help you set the + # LS_COLORS environment variable used by GNU ls with the --color option. - # Copyright (C) 1996-2016 Free Software Foundation, Inc. - # Copying and distribution of this file, with or without modification, - # are permitted provided the copyright notice and this notice are preserved. - --# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the --# slackware version of dircolors) are recognized but ignored. -+# The keywords OPTIONS and EIGHTBIT (honored by the slackware version of -+# dircolors) are recognized but ignored. For compatibility reasons, the -+# pattern "^COLOR.*none" is recognized as a way to disable colorization. -+# See https://bugzilla.redhat.com/1349579 for details. +@@ -8,32 +14,13 @@ + # The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the + # slackware version of dircolors) are recognized but ignored. ++# For compatibility, the pattern "^COLOR.*none" is recognized as a way to ++# disable colorization. See https://bugzilla.redhat.com/1349579 for details. ++ # Below are TERM entries, which can be a glob patterns, to match # against the TERM environment variable to determine if it is colorizable. -TERM Eterm @@ -136,7 +133,7 @@ index d2ea453..74c34ba 100644 # Below are the color init strings for the basic file types. A color init # string consists of one or more of the following numeric codes: -@@ -43,29 +26,40 @@ TERM xterm* +@@ -43,29 +30,40 @@ TERM xterm* # 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white # Background color codes: # 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white @@ -193,7 +190,7 @@ index d2ea453..74c34ba 100644 # List any file extensions like '.gz' or '.tar' that you would like ls # to colorize below. Put the extension, a space, and the color init string. -@@ -83,119 +77,115 @@ EXEC 01;32 +@@ -83,123 +81,123 @@ EXEC 01;32 #.csh 01;32 # archives or compressed (bright red) @@ -240,6 +237,10 @@ index d2ea453..74c34ba 100644 -.7z 01;31 -.rz 01;31 -.cab 01;31 +-.wim 01;31 +-.swm 01;31 +-.dwm 01;31 +-.esd 01;31 +.tar 38;5;9 +.tgz 38;5;9 +.arc 38;5;9 @@ -262,6 +263,8 @@ index d2ea453..74c34ba 100644 +.lz 38;5;9 +.lzo 38;5;9 +.xz 38;5;9 ++.zst 38;5;9 ++.tzst 38;5;9 +.bz2 38;5;9 +.bz 38;5;9 +.tbz 38;5;9 @@ -281,6 +284,10 @@ index d2ea453..74c34ba 100644 +.7z 38;5;9 +.rz 38;5;9 +.cab 38;5;9 ++.wim 38;5;9 ++.swm 38;5;9 ++.dwm 38;5;9 ++.esd 38;5;9 # image formats -.jpg 01;35 @@ -332,6 +339,8 @@ index d2ea453..74c34ba 100644 -.emf 01;35 +.jpg 38;5;13 +.jpeg 38;5;13 ++.mjpg 38;5;13 ++.mjpeg 38;5;13 +.gif 38;5;13 +.bmp 38;5;13 +.pbm 38;5;13 @@ -376,7 +385,7 @@ index d2ea453..74c34ba 100644 +.cgm 38;5;13 +.emf 38;5;13 - # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions + # https://wiki.xiph.org/MIME_Types_and_File_Extensions -.ogv 01;35 -.ogx 01;35 +.ogv 38;5;13 @@ -408,7 +417,7 @@ index d2ea453..74c34ba 100644 +.ra 38;5;45 +.wav 38;5;45 - # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions + # https://wiki.xiph.org/MIME_Types_and_File_Extensions -.oga 00;36 -.opus 00;36 -.spx 00;36 @@ -421,29 +430,27 @@ diff --git a/DIR_COLORS.lightbgcolor b/DIR_COLORS.lightbgcolor index d2ea453..95d6879 100644 --- a/DIR_COLORS.lightbgcolor +++ b/DIR_COLORS.lightbgcolor -@@ -1,12 +1,17 @@ --# Configuration file for dircolors, a utility to help you set the --# LS_COLORS environment variable used by GNU ls with the --color option. +@@ -1,3 +1,9 @@ +# Configuration file for the color ls utility - modified for lighter backgrounds + +# This file goes in the /etc directory, and must be world readable. +# You can copy this file to .dir_colors in your $HOME directory to override +# the system defaults. ++ + # Configuration file for dircolors, a utility to help you set the + # LS_COLORS environment variable used by GNU ls with the --color option. - # Copyright (C) 1996-2016 Free Software Foundation, Inc. - # Copying and distribution of this file, with or without modification, - # are permitted provided the copyright notice and this notice are preserved. - --# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the --# slackware version of dircolors) are recognized but ignored. -+# The keywords OPTIONS and EIGHTBIT (honored by the slackware version of -+# dircolors) are recognized but ignored. For compatibility reasons, the -+# pattern "^COLOR.*none" is recognized as a way to disable colorization. -+# See https://bugzilla.redhat.com/1349579 for details. +@@ -8,6 +14,9 @@ + # The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the + # slackware version of dircolors) are recognized but ignored. ++# For compatibility, the pattern "^COLOR.*none" is recognized as a way to ++# disable colorization. See https://bugzilla.redhat.com/1349579 for details. ++ # Below are TERM entries, which can be a glob patterns, to match # against the TERM environment variable to determine if it is colorizable. -@@ -46,17 +51,17 @@ TERM xterm* + TERM Eterm +@@ -46,17 +55,17 @@ TERM xterm* #NORMAL 00 # no color code at all #FILE 00 # regular file: use no color at all RESET 0 # reset to "normal" color @@ -466,7 +473,7 @@ index d2ea453..95d6879 100644 SETUID 37;41 # file that is setuid (u+s) SETGID 30;43 # file that is setgid (g+s) CAPABILITY 30;41 # file with capability -@@ -65,7 +70,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky +@@ -65,7 +74,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable # This is for files with execute permission: @@ -475,7 +482,7 @@ index d2ea453..95d6879 100644 # List any file extensions like '.gz' or '.tar' that you would like ls # to colorize below. Put the extension, a space, and the color init string. -@@ -82,103 +87,99 @@ EXEC 01;32 +@@ -82,107 +91,107 @@ EXEC 01;32 #.sh 01;32 #.csh 01;32 @@ -523,6 +530,10 @@ index d2ea453..95d6879 100644 -.7z 01;31 -.rz 01;31 -.cab 01;31 +-.wim 01;31 +-.swm 01;31 +-.dwm 01;31 +-.esd 01;31 +# archives or compressed (red) +.tar 00;31 +.tgz 00;31 @@ -546,6 +557,8 @@ index d2ea453..95d6879 100644 +.lz 00;31 +.lzo 00;31 +.xz 00;31 ++.zst 00;31 ++.tzst 00;31 +.bz2 00;31 +.bz 00;31 +.tbz 00;31 @@ -565,6 +578,10 @@ index d2ea453..95d6879 100644 +.7z 00;31 +.rz 00;31 +.cab 00;31 ++.wim 00;31 ++.swm 00;31 ++.dwm 00;31 ++.esd 00;31 # image formats -.jpg 01;35 @@ -616,6 +633,8 @@ index d2ea453..95d6879 100644 -.emf 01;35 +.jpg 00;35 +.jpeg 00;35 ++.mjpg 00;35 ++.mjpeg 00;35 +.gif 00;35 +.bmp 00;35 +.pbm 00;35 @@ -660,7 +679,7 @@ index d2ea453..95d6879 100644 +.cgm 00;35 +.emf 00;35 - # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions + # https://wiki.xiph.org/MIME_Types_and_File_Extensions -.ogv 01;35 -.ogx 01;35 +.ogv 00;35 diff --git a/coreutils-8.26-date-fix-tz-regre.patch b/coreutils-8.26-date-fix-tz-regre.patch deleted file mode 100644 index 158c80a..0000000 --- a/coreutils-8.26-date-fix-tz-regre.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 12284825dcc5d9485ebaa78aedd93f450bad7b73 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?P=C3=A1draig=20Brady?= -Date: Fri, 20 Jan 2017 12:40:35 +0000 -Subject: [PATCH 1/2] date: fix TZ= regression - -On 17/03/16 17:38, Paul Eggert wrote: -> On 03/16/2016 08:51 PM, Assaf Gordon wrote: ->> I suspect it has something to do with this commit: ->> commit 037e3b9847feb46cf6b58d99ce960d3987faaf52 -> -> You're right, and thanks for that detailed bug report. I installed the -> attached patch, which fixed the bug for me. - -This introduced a bug unfortunately due to the side effects of -parse_datetime(). -parse_datetime resets the TZ env variable but doesn't call tzset(). -Hence using the wrong timezone for output. -Previously localtime() called tzset() implicitly. -Perhaps we should call tzset() in parse_datetime() if needed? -I'm not sure as to whether this undoes the fix for bug 23035? - -Anyway this avoids the issue on GNU/Linux. - -Signed-off-by: Kamil Dudka ---- - src/date.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/date.c b/src/date.c -index 619a72b..2b3d890 100644 ---- a/src/date.c -+++ b/src/date.c -@@ -571,6 +571,8 @@ show_date (const char *format, struct timespec when, timezone_t tz) - { - struct tm tm; - -+ tzset (); -+ - if (localtime_rz (tz, &when.tv_sec, &tm)) - { - if (format == rfc_2822_format) --- -2.7.4 - - -From 3c082157634bd4fbc79c26e9c56abb4da79e9a2d Mon Sep 17 00:00:00 2001 -From: Paul Eggert -Date: Fri, 20 Jan 2017 18:24:02 -0800 -Subject: [PATCH 2/2] date: test for TZ= regression - -Problem reported by Paul Wise for Debian, in: -https://bugs.debian.org/851934 -This is fallout from the fix for GNU Bug#23035. -* tests/misc/date.pl: Test the fix. - -Upstream-commit: b14be5085cd1aefd473a000456b21270e6070711 -Signed-off-by: Kamil Dudka ---- - tests/misc/date-debug.sh | 4 ++-- - tests/misc/date.pl | 6 ++++++ - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/tests/misc/date.pl b/tests/misc/date.pl -index 7e45e98..be8b39e 100755 ---- a/tests/misc/date.pl -+++ b/tests/misc/date.pl -@@ -291,6 +291,12 @@ my @Tests = - {ERR => "date: invalid date 'TZ=\"\"\"'\n"}, - {EXIT => 1}, - ], -+ -+ # https://bugs.debian.org/851934#10 -+ ['cross-TZ-mishandled', "-d 'TZ=\"EST5\" 1970-01-01 00:00'", -+ {ENV => 'TZ=PST8'}, -+ {OUT => 'Wed Dec 31 21:00:00 PST 1969'}, -+ ], - ); - - # Repeat the cross-dst test, using Jan 1, 2005 and every interval from 1..364. --- -2.7.4 - diff --git a/coreutils-8.26-test-lock.patch b/coreutils-8.26-test-lock.patch index 786aa33..d66928c 100644 --- a/coreutils-8.26-test-lock.patch +++ b/coreutils-8.26-test-lock.patch @@ -1,211 +1,7 @@ -From 4f6cb65ce4d643aca0c6bf7db2e8b32c0d08eb89 Mon Sep 17 00:00:00 2001 -From: Bruno Haible -Date: Sat, 24 Dec 2016 18:21:59 +0100 -Subject: [PATCH 1/2] lock test: Fix performance problem on multi-core - machines. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -* tests/test-lock.c (USE_VOLATILE): New macro. -(struct atomic_int): New type. -(init_atomic_int, get_atomic_int_value, set_atomic_int_value): New -functions. -(lock_checker_done, rwlock_checker_done, reclock_checker_done): Define -as 'struct atomic_int'. -(lock_checker_thread, test_lock, rwlock_checker_thread, test_rwlock, -reclock_checker_thread, test_recursive_lock): Use the new functions. -Reported by Eric Blake in -https://www.redhat.com/archives/libvir-list/2012-March/msg00854.html -and by Pádraig Brady in -http://lists.gnu.org/archive/html/bug-gnulib/2016-12/msg00117.html. - -Upstream-commit: 480d374e596a0ee3fed168ab42cd84c313ad3c89 -Signed-off-by: Kamil Dudka ---- - gnulib-tests/test-lock.c | 79 ++++++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 67 insertions(+), 12 deletions(-) - -diff --git a/gnulib-tests/test-lock.c b/gnulib-tests/test-lock.c -index cb734b4..aa6de27 100644 ---- a/gnulib-tests/test-lock.c -+++ b/gnulib-tests/test-lock.c -@@ -50,6 +50,13 @@ - Uncomment this to see if the operating system has a fair scheduler. */ - #define EXPLICIT_YIELD 1 - -+/* Whether to use 'volatile' on some variables that communicate information -+ between threads. If set to 0, a lock is used to protect these variables. -+ If set to 1, 'volatile' is used; this is theoretically equivalent but can -+ lead to much slower execution (e.g. 30x slower total run time on a 40-core -+ machine. */ -+#define USE_VOLATILE 0 -+ - /* Whether to print debugging messages. */ - #define ENABLE_DEBUGGING 0 - -@@ -103,6 +110,51 @@ - # define yield() - #endif - -+#if USE_VOLATILE -+struct atomic_int { -+ volatile int value; -+}; -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+} -+static int -+get_atomic_int_value (struct atomic_int *ai) -+{ -+ return ai->value; -+} -+static void -+set_atomic_int_value (struct atomic_int *ai, int new_value) -+{ -+ ai->value = new_value; -+} -+#else -+struct atomic_int { -+ gl_lock_define (, lock) -+ int value; -+}; -+static void -+init_atomic_int (struct atomic_int *ai) -+{ -+ gl_lock_init (ai->lock); -+} -+static int -+get_atomic_int_value (struct atomic_int *ai) -+{ -+ gl_lock_lock (ai->lock); -+ int ret = ai->value; -+ gl_lock_unlock (ai->lock); -+ return ret; -+} -+static void -+set_atomic_int_value (struct atomic_int *ai, int new_value) -+{ -+ gl_lock_lock (ai->lock); -+ ai->value = new_value; -+ gl_lock_unlock (ai->lock); -+} -+#endif -+ - #define ACCOUNT_COUNT 4 - - static int account[ACCOUNT_COUNT]; -@@ -170,12 +222,12 @@ lock_mutator_thread (void *arg) - return NULL; - } - --static volatile int lock_checker_done; -+static struct atomic_int lock_checker_done; - - static void * - lock_checker_thread (void *arg) - { -- while (!lock_checker_done) -+ while (get_atomic_int_value (&lock_checker_done) == 0) - { - dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ()); - gl_lock_lock (my_lock); -@@ -200,7 +252,8 @@ test_lock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- lock_checker_done = 0; -+ init_atomic_int (&lock_checker_done); -+ set_atomic_int_value (&lock_checker_done, 0); - - /* Spawn the threads. */ - checkerthread = gl_thread_create (lock_checker_thread, NULL); -@@ -210,7 +263,7 @@ test_lock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- lock_checker_done = 1; -+ set_atomic_int_value (&lock_checker_done, 1); - gl_thread_join (checkerthread, NULL); - check_accounts (); - } -@@ -254,12 +307,12 @@ rwlock_mutator_thread (void *arg) - return NULL; - } - --static volatile int rwlock_checker_done; -+static struct atomic_int rwlock_checker_done; - - static void * - rwlock_checker_thread (void *arg) - { -- while (!rwlock_checker_done) -+ while (get_atomic_int_value (&rwlock_checker_done) == 0) - { - dbgprintf ("Checker %p before check rdlock\n", gl_thread_self_pointer ()); - gl_rwlock_rdlock (my_rwlock); -@@ -284,7 +337,8 @@ test_rwlock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- rwlock_checker_done = 0; -+ init_atomic_int (&rwlock_checker_done); -+ set_atomic_int_value (&rwlock_checker_done, 0); - - /* Spawn the threads. */ - for (i = 0; i < THREAD_COUNT; i++) -@@ -295,7 +349,7 @@ test_rwlock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- rwlock_checker_done = 1; -+ set_atomic_int_value (&rwlock_checker_done, 1); - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (checkerthreads[i], NULL); - check_accounts (); -@@ -356,12 +410,12 @@ reclock_mutator_thread (void *arg) - return NULL; - } - --static volatile int reclock_checker_done; -+static struct atomic_int reclock_checker_done; - - static void * - reclock_checker_thread (void *arg) - { -- while (!reclock_checker_done) -+ while (get_atomic_int_value (&reclock_checker_done) == 0) - { - dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ()); - gl_recursive_lock_lock (my_reclock); -@@ -386,7 +440,8 @@ test_recursive_lock (void) - /* Initialization. */ - for (i = 0; i < ACCOUNT_COUNT; i++) - account[i] = 1000; -- reclock_checker_done = 0; -+ init_atomic_int (&reclock_checker_done); -+ set_atomic_int_value (&reclock_checker_done, 0); - - /* Spawn the threads. */ - checkerthread = gl_thread_create (reclock_checker_thread, NULL); -@@ -396,7 +451,7 @@ test_recursive_lock (void) - /* Wait for the threads to terminate. */ - for (i = 0; i < THREAD_COUNT; i++) - gl_thread_join (threads[i], NULL); -- reclock_checker_done = 1; -+ set_atomic_int_value (&reclock_checker_done, 1); - gl_thread_join (checkerthread, NULL); - check_accounts (); - } --- -2.7.4 - - From 0d04ee8ddedb2bf33d64f148f246a3b7ec4fef21 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Mon, 23 Jan 2017 12:35:41 +0100 -Subject: [PATCH 2/2] test-lock: disable the rwlock test +Subject: [PATCH] test-lock: disable the rwlock test It hangs indefinitely if the system rwlock implementation does not prevent writer starvation (and glibc does not implement it). diff --git a/coreutils-8.26.tar.xz.sig b/coreutils-8.26.tar.xz.sig deleted file mode 100644 index fe1635d..0000000 --- a/coreutils-8.26.tar.xz.sig +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1 - -iQIcBAABAgAGBQJYPyRpAAoJEN9v2XEwYDfZ0I4P/3oaPYXMPEOKuDDpEcLumn26 -gYIMQc1jIMbBNQe120gQmNPkRr5dTKt5Bap9qYkCj0pI/6VxVIWDo0xrOLYZi7AN -Xgr0kX2qLDFEH+EHkC1BpsAdpsgwfvLmVWPHS62CNKgVDgGiP1cRJZe8oVmlBCiR -3ES7pUsBfDn3hbdKNTTmMDtro1rQMOxfHkVCZLAva+JjdzpE+KTvzZzKkVuZZfJ/ -Mi/ZySrXZXFvPBS7GXgop4x8EodyzQMeKO+nvpIUEBY1yLQgCvni5/CBI8w/EViD -DSjj0zWsCQkEjx6HCohi8sBHUYZ+M3lB4rkFk7aevdioPZUGfLkW31LT/cUJC/VV -MIQKWzQtZO/WCJuyEbWP2m25c4MtnnhTm5yoi29yT/CoTRlUWkIQpXm4oD1cJXHy -PpHveu8qM0qRaAtVdXE3pmapIMYUV4g7vxSuCjZRrgiDLhp/K7Lzt5xBhl++kPU2 -U9uc202eah4Towo0pbHsuEJT0vk0GGLq8/17dCa/ss8wV+86ZLxl0kZYy4CNEnIW -vsCN6CJ5AoAEVrMN1F7ZJYnH4hoJedvIczThnAkNTqYYE3wnN9stOe28Oy/a0/tg -bt5/Mn0JbmQei890uU8zcEdUjidHqGV4hKk1E2UC4UCyHG/VcHv9gfr8OaD/xPDr -SoauDCHpBU7J7FT/DX+k -=vkKy ------END PGP SIGNATURE----- diff --git a/coreutils-8.27.tar.xz.sig b/coreutils-8.27.tar.xz.sig new file mode 100644 index 0000000..7555c00 --- /dev/null +++ b/coreutils-8.27.tar.xz.sig @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIcBAABAgAGBQJYwOwaAAoJEN9v2XEwYDfZQrUP/RdXj/ug35e+u+VD1ts9/b8n +7JihJmxngEZQAJECNTMbJ7mNj6DhpMY0Jg/Hwg7zJT28T6QDeS1Iuk3Id4uM5eFa +CgHKAZumntSMTkQdNvnCEFEIqu+L8BtBYGcOaw66wAFNFw3jdJUUs2sOST2r46jR +N7aY9oARKJuHfgTZ2BI2zL0Q+poXM1O0k/U+BScE6c139zJsbg+1uM9kGVtJWPkM +EPLFWkbTgjYnt+qEFrDlWL0YFOS42sgR7P1sVfBC1nAu5lwgzPy62OtGv9WCEBhm +3+PRNZ0KLW8CKp06llG/0bG4QwssWs6p/vPwrRGeAg6pKsRNN1ni27AnDThiPgvz +YbBLgU+EZj1HuibvYArHXNKY2+O5ZC3nYU6bdAffl3TAtrGFA1ncZXGiFD5UgOQ2 +V9Q38S41FUEwKGtf9tWGCRTxrb4FQ1CDzJglV9vHKetn4mgH/HpEG/q07k4RNW5d +ikfrS0xFxbqtLjlY3UqvtkrFyVQFY093ozsP7fKsq53JAtEWc3YvXR8UCbliU+gV +5qug0REBQafe9EAyH+oq0dzD2BZ3KtFcjtKI/2UzAf3idcyygsHgcEPQObqI8BfD +NscEMjdFY7+Zh5w2shQlyq4xr2aI2nXCX3+AMcS/6Yfg6W6fBvgIjtmXBrQsbWpV +DBcx50TVDa/ERBX1+FI1 +=skPR +-----END PGP SIGNATURE----- diff --git a/coreutils-getgrouplist.patch b/coreutils-getgrouplist.patch index 7defd19..5b35f42 100644 --- a/coreutils-getgrouplist.patch +++ b/coreutils-getgrouplist.patch @@ -30,7 +30,7 @@ index 76474c2..0a9d221 100644 - : getgroups (0, NULL)); + if (!username) + max_n_groups = getgroups(0, NULL); -+ else ++ else + { +#ifdef HAVE_GETGROUPLIST + max_n_groups = 0; diff --git a/coreutils-i18n-fix2-expand-unexpand.patch b/coreutils-i18n-fix2-expand-unexpand.patch index 1a63012..b34d7b7 100644 --- a/coreutils-i18n-fix2-expand-unexpand.patch +++ b/coreutils-i18n-fix2-expand-unexpand.patch @@ -22,7 +22,7 @@ index 380e020..310b349 100644 + } } - while (false); -+ ++ if (convert) { @@ -50,7 +50,7 @@ index 3bbbd66..863a90a 100644 + } } - while (false); -+ ++ if (convert) { diff --git a/coreutils-i18n-fold-newline.patch b/coreutils-i18n-fold-newline.patch index 79d1a09..f7286ef 100644 --- a/coreutils-i18n-fold-newline.patch +++ b/coreutils-i18n-fold-newline.patch @@ -4,8 +4,8 @@ Date: Fri, 3 Feb 2017 12:26:53 +0100 Subject: [PATCH] fold.c: preserve new-lines in mutlibyte text --- - src/fold.c | 55 +++++++++++++++++++++++++++---------------------------- - 1 file changed, 27 insertions(+), 28 deletions(-) + src/fold.c | 49 ++++++++++++++++++++++++------------------------- + 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/fold.c b/src/fold.c index d23edd5..8c232a7 100644 @@ -43,15 +43,24 @@ index d23edd5..8c232a7 100644 - 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; @@ -60,18 +69,6 @@ index d23edd5..8c232a7 100644 - increment = wcwidth (wc); - increment = (increment < 0) ? 0 : increment; - } -+ case L'\b': -+ increment = (column > 0) ? -1 : 0; -+ break; -+ -+ case L'\r': -+ increment = -1 * column; -+ break; -+ -+ case L'\t': -+ increment = 8 - column % 8; -+ break; -+ + default: + increment = wcwidth (wc); + increment = (increment < 0) ? 0 : increment; diff --git a/coreutils-i18n-un-expand-BOM.patch b/coreutils-i18n-un-expand-BOM.patch index 56e7fa5..2ccdcca 100644 --- a/coreutils-i18n-un-expand-BOM.patch +++ b/coreutils-i18n-un-expand-BOM.patch @@ -1,3 +1,17 @@ +From 7a7c776a4e228d180e74614fd8c8afcad5d4bdf7 Mon Sep 17 00:00:00 2001 +From: Jakub Martisko +Date: Thu, 7 Jul 2016 12:53:26 +0200 +Subject: [PATCH] coreutils-i18n-un-expand-BOM.patch + +--- + src/expand-common.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++ + src/expand-common.h | 12 ++++++ + src/expand.c | 45 +++++++++++++++++++- + src/unexpand.c | 43 ++++++++++++++++++- + tests/expand/mb.sh | 71 ++++++++++++++++++++++++++++++++ + tests/unexpand/mb.sh | 59 ++++++++++++++++++++++++++ + 6 files changed, 342 insertions(+), 2 deletions(-) + diff --git a/src/expand-common.c b/src/expand-common.c index 4657e46..97cbb09 100644 --- a/src/expand-common.c @@ -10,8 +24,8 @@ index 4657e46..97cbb09 100644 #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 @@ -40,12 +54,12 @@ index 4657e46..97cbb09 100644 +check_utf_locale(void) +{ + char* locale = setlocale (LC_CTYPE , NULL); -+ if (locale == NULL) ++ if (locale == NULL) + { + return false; + } + else if (strcasestr(locale, "utf8") == NULL && strcasestr(locale, "utf-8") == NULL) -+ { ++ { + return false; + } + return true; @@ -147,7 +161,7 @@ index 8cb2079..763bfda 100644 +extern bool +check_bom(FILE* fp, mb_file_t *mbf); + -+extern void ++extern void +print_bom(void); + /* Add tab stop TABVAL to the end of 'tab_list'. */ @@ -161,14 +175,13 @@ index 310b349..4136824 100644 FILE *fp = next_file (NULL); mb_file_t mbf; mbf_char_t c; -- + /* True if the starting locale is utf8. */ + bool using_utf_locale; -+ ++ + /* True if the first file contains BOM header. */ + bool found_bom; + using_utf_locale=check_utf_locale(); -+ + if (!fp) return; - @@ -178,13 +191,13 @@ index 310b349..4136824 100644 + if (using_utf_locale == false && found_bom == true) + { + /*try using some predefined locale */ -+ ++ + if (set_utf_locale () != 0) + { + error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale")); + } + } -+ ++ + + if (found_bom == true) + { @@ -212,7 +225,7 @@ index 310b349..4136824 100644 + { + if(using_utf_locale==false && found_bom==true) + { -+ /*First file conatined BOM header - locale was switched to UTF ++ /*First file conatined BOM header - locale was switched to UTF + /*all subsequent files should contain BOM. */ + error (EXIT_FAILURE, errno, _("combination of files with and without BOM header")); + } @@ -231,7 +244,7 @@ index 863a90a..5681b58 100644 mbf_char_t *pending_blank; + /* True if the starting locale is utf8. */ + bool using_utf_locale; -+ ++ + /* True if the first file contains BOM header. */ + bool found_bom; + using_utf_locale=check_utf_locale(); @@ -240,11 +253,11 @@ index 863a90a..5681b58 100644 return; + mbf_init (mbf, fp); + found_bom=check_bom(fp,&mbf); - ++ + if (using_utf_locale == false && found_bom == true) + { + /*try using some predefined locale */ -+ + + if (set_utf_locale () != 0) + { + error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale")); @@ -282,7 +295,7 @@ index 863a90a..5681b58 100644 + { + if(using_utf_locale==false && found_bom==true) + { -+ /*First file conatined BOM header - locale was switched to UTF ++ /*First file conatined BOM header - locale was switched to UTF + /*all subsequent files should contain BOM. */ + error (EXIT_FAILURE, errno, _("combination of files with and without BOM header")); + } @@ -301,7 +314,7 @@ index 031be7a..1621c84 100755 + + -+#BOM header test 1 ++#BOM header test 1 +printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_ +1234567812345678123456781 +. . . . @@ -380,7 +393,7 @@ index 8d75652..9d4ee3e 100755 unexpand -a < in > out || fail=1 compare exp out > /dev/null 2>&1 || fail=1 + -+#BOM header test 1 ++#BOM header test 1 +printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_ +1234567812345678123456781 +. . . . @@ -438,3 +451,6 @@ index 8d75652..9d4ee3e 100755 + +LC_ALL=C unexpand in in > out || fail=1 +compare exp out > /dev/null 2>&1 || fail=1 +-- +2.9.3 + diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index d7cf59c..ab5d8dc 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -315,7 +315,7 @@ index 8cd0d6b..d23edd5 100644 + fwrite (line_out, sizeof(char), offset_out, stdout); + START_NEW_LINE; + continue; -+ ++ + case L'\b': + increment = (column > 0) ? -1 : 0; + break; @@ -672,7 +672,7 @@ index 98b461c..9990f38 100644 + extract_field (line, ptr, lim - ptr); +} +#endif -+ ++ static void freeline (struct line *line) { @@ -2843,7 +2843,7 @@ index 87a0c93..9f755d9 100644 + while (pos < size) + { + MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail); -+ ++ + if (convfail || !(iswblank (wc) || wc == '\n')) + { + pos += mblength; @@ -2886,7 +2886,7 @@ index 87a0c93..9f755d9 100644 if (check_chars < oldlen) oldlen = check_chars; if (check_chars < newlen) -@@ -295,14 +401,103 @@ different (char *old, char *new, size_t oldlen, size_t newlen) +@@ -295,15 +401,104 @@ different (char *old, char *new, size_t oldlen, size_t newlen) if (ignore_case) { @@ -2918,8 +2918,8 @@ index 87a0c93..9f755d9 100644 + + return xmemcoll (copy_old, oldlen, copy_new, newlen); + -+} -+ + } + +#if HAVE_MBRTOWC +static int +different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate) @@ -2990,11 +2990,12 @@ index 87a0c93..9f755d9 100644 + free (copy[1]); + return rc; + - } ++} +#endif - ++ /* Output the line in linebuffer LINE to standard output provided that the switches say it should be output. + MATCH is true if the line matches the previous line. @@ -367,19 +562,38 @@ check_file (const char *infile, const char *outfile, char delimiter) char *prevfield IF_LINT ( = NULL); size_t prevlen IF_LINT ( = 0); @@ -3156,7 +3157,7 @@ diff --git a/tests/local.mk b/tests/local.mk index 568944e..192f776 100644 --- a/tests/local.mk +++ b/tests/local.mk -@@ -350,6 +350,8 @@ all_tests = \ +@@ -352,6 +352,8 @@ all_tests = \ tests/misc/sort-discrim.sh \ tests/misc/sort-files0-from.pl \ tests/misc/sort-float.sh \ @@ -3211,8 +3212,8 @@ index 8a9cad1..9293e39 100755 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 @@ -3220,8 +3221,8 @@ index 8a9cad1..9293e39 100755 ['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') @@ -3533,7 +3534,7 @@ index c3e7f8e..6ecd3ff 100755 # 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) } } @@ -3572,7 +3573,7 @@ index c3e7f8e..6ecd3ff 100755 @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; diff --git a/coreutils-selinux.patch b/coreutils-selinux.patch index cee4f7c..8274a23 100644 --- a/coreutils-selinux.patch +++ b/coreutils-selinux.patch @@ -48,7 +48,7 @@ index 1b528c6..25dbb88 100644 + case 'c': + fprintf (stderr, "%s: warning: option '-c' is deprecated, please use '--preserve=context' instead\n", argv[0]); -+ if ( x.set_security_context ) { ++ if ( x.set_security_context ) { + (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]); + exit( 1 ); + } diff --git a/coreutils.spec b/coreutils.spec index a2899d7..0af685d 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,11 +1,11 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils -Version: 8.26 -Release: 7%{?dist} +Version: 8.27 +Release: 1%{?dist} License: GPLv3+ Group: System Environment/Base -Url: http://www.gnu.org/software/coreutils/ -Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz +Url: https://www.gnu.org/software/coreutils/ +Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz Source50: supported_utils Source105: coreutils-colorls.sh Source106: coreutils-colorls.csh @@ -19,9 +19,6 @@ Source10: coreutils-find-requires.sh # disable the test-lock gnulib test prone to deadlock Patch1: coreutils-8.26-test-lock.patch -# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851934#10 -Patch2: coreutils-8.26-date-fix-tz-regre.patch - #add note about no difference between binary/text mode on Linux - md5sum manpage Patch101: coreutils-6.10-manpages.patch # downstream changes to default DIR_COLORS @@ -172,6 +169,8 @@ including documentation and translations. # will be modified by coreutils-8.25-DIR_COLORS.patch tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null +# git add DIR_COLORS{,.256color,.lightbgcolor} +# git commit -m "clone DIR_COLORS before patching" # apply all patches %autopatch -p1 @@ -301,6 +300,9 @@ fi %license COPYING %changelog +* Thu Mar 09 2017 Kamil Dudka - 8.27-1 +- new upstream release 8.27 + * Fri Feb 10 2017 Fedora Release Engineering - 8.26-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild diff --git a/sources b/sources index becdeb6..2566cf4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d5aa2072f662d4118b9f4c63b94601a6 coreutils-8.26.tar.xz +SHA512 (coreutils-8.27.tar.xz) = abf3280aaa54e9bd5851df0eda2af1de1017ca174633e52d1e592455d46ea0e99812dda46d2f320e979553cef271485d8818c595bba6ed31264511a511c93679 From 4ceb7222e4ce09a1b0816de5fe1f1f5925269ba5 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 15 Mar 2017 10:16:30 +0100 Subject: [PATCH 02/18] fix spurious build failure caused by the misc/date-debug test --- coreutils-8.27-date-debug-test.patch | 50 ++++++++++++++++++++++++++++ coreutils.spec | 10 ++++-- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 coreutils-8.27-date-debug-test.patch diff --git a/coreutils-8.27-date-debug-test.patch b/coreutils-8.27-date-debug-test.patch new file mode 100644 index 0000000..a8def7b --- /dev/null +++ b/coreutils-8.27-date-debug-test.patch @@ -0,0 +1,50 @@ +From ee2017f191f1ad177405fbd8816df0a55127804a Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Thu, 9 Mar 2017 23:59:05 -0800 +Subject: [PATCH] tests: port to tzdb-2017a + +Problem reported by Bernhard Voelker in: +http://lists.gnu.org/archive/html/coreutils/2017-03/msg00026.html +* tests/misc/date-debug.sh: Port test to tzdb 2017a, +and future-proof the America/Belize test. + +Upstream-commit: 612086660bab9bf981894da146550e9101224b17 +Signed-off-by: Kamil Dudka +--- + tests/misc/date-debug.sh | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/tests/misc/date-debug.sh b/tests/misc/date-debug.sh +index 48f4605..8e0b2af 100755 +--- a/tests/misc/date-debug.sh ++++ b/tests/misc/date-debug.sh +@@ -52,10 +52,11 @@ date: output timezone: +09:00 (set from TZ="Asia/Tokyo" environment value) + date: final: 661095000.000000000 (epoch-seconds) + date: final: (Y-M-D) 1990-12-13 13:30:00 (UTC0) + date: final: (Y-M-D) 1990-12-13 22:30:00 (output timezone TZ=+09:00) +-Thu Dec 13 07:30:00 CST 1990 ++Thu Dec 13 07:30:00 -0600 1990 + EOF + +-TZ=America/Belize date --debug -d "$in1" >out1 2>&1 || fail=1 ++TZ=America/Belize date --debug -d "$in1" +'%a %b %e %T %z %Y' >out1 2>&1 || ++ fail=1 + + compare exp1 out1 || fail=1 + +@@ -94,10 +95,10 @@ date: output timezone: -05:00 (set from TZ="America/Lima" environment value) + date: final: 1.000000000 (epoch-seconds) + date: final: (Y-M-D) 1970-01-01 00:00:01 (UTC0) + date: final: (Y-M-D) 1969-12-31 19:00:01 (output timezone TZ=-05:00) +-Wed Dec 31 19:00:01 PET 1969 ++Wed Dec 31 19:00:01 -0500 1969 + EOF + +-TZ=America/Lima date --debug -d "$in3" >out3 2>&1 || fail=1 ++TZ=America/Lima date --debug -d "$in3" +'%a %b %e %T %z %Y' >out3 2>&1 || fail=1 + compare exp3 out3 || fail=1 + + ## +-- +2.9.3 + diff --git a/coreutils.spec b/coreutils.spec index 0af685d..4744830 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.27 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -16,8 +16,11 @@ Source10: coreutils-find-requires.sh %global __find_provides %{_rpmconfigdir}/find-provides %global __find_requires %{SOURCE10} %{_rpmconfigdir}/find-requires +# upstream patches +Patch1: coreutils-8.27-date-debug-test.patch + # disable the test-lock gnulib test prone to deadlock -Patch1: coreutils-8.26-test-lock.patch +Patch100: coreutils-8.26-test-lock.patch #add note about no difference between binary/text mode on Linux - md5sum manpage Patch101: coreutils-6.10-manpages.patch @@ -300,6 +303,9 @@ fi %license COPYING %changelog +* Wed Mar 15 2017 Kamil Dudka - 8.27-2 +- fix spurious build failure caused by the misc/date-debug test + * Thu Mar 09 2017 Kamil Dudka - 8.27-1 - new upstream release 8.27 From 3d65658099fc016b2a0c90f0a2ebc7403bfcd00c Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 25 Apr 2017 13:43:39 +0200 Subject: [PATCH 03/18] Resolves: #1444802 - do not obsolete coreutils-single, so it can be installed by DNF2 This reverts commit c553cab787c2499ffaa36748a2de7c0e08fe31d5. --- coreutils.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/coreutils.spec b/coreutils.spec index 4744830..5e9e46b 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.27 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -67,8 +67,6 @@ Patch950: coreutils-selinux.patch Conflicts: filesystem < 3 # To avoid clobbering installs Conflicts: coreutils-single -# To give priority to this package -Obsoletes: coreutils-single Provides: /bin/basename Provides: /bin/cat Provides: /bin/chgrp @@ -303,6 +301,9 @@ fi %license COPYING %changelog +* Tue Apr 25 2017 Kamil Dudka - 8.27-3 +- do not obsolete coreutils-single, so it can be installed by DNF2 (#1444802) + * Wed Mar 15 2017 Kamil Dudka - 8.27-2 - fix spurious build failure caused by the misc/date-debug test From e0567d54a78f817b054755885bb5f97a2ef690ee Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Thu, 27 Apr 2017 09:51:08 +0200 Subject: [PATCH 04/18] Resolves: CVE-2017-7476 - date, touch: fix out-of-bounds write via large TZ variable --- coreutils-8.27-CVE-2017-7476.patch | 189 +++++++++++++++++++++++++++++ coreutils.spec | 8 +- 2 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 coreutils-8.27-CVE-2017-7476.patch diff --git a/coreutils-8.27-CVE-2017-7476.patch b/coreutils-8.27-CVE-2017-7476.patch new file mode 100644 index 0000000..23fdb3f --- /dev/null +++ b/coreutils-8.27-CVE-2017-7476.patch @@ -0,0 +1,189 @@ +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/coreutils.spec b/coreutils.spec index 5e9e46b..199d2e4 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.27 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -19,6 +19,9 @@ Source10: coreutils-find-requires.sh # upstream patches Patch1: coreutils-8.27-date-debug-test.patch +# date, touch: fix out-of-bounds write via large TZ variable (CVE-2017-7476) +Patch2: coreutils-8.27-CVE-2017-7476.patch + # disable the test-lock gnulib test prone to deadlock Patch100: coreutils-8.26-test-lock.patch @@ -301,6 +304,9 @@ fi %license COPYING %changelog +* Thu Apr 27 2017 Kamil Dudka - 8.27-4 +- date, touch: fix out-of-bounds write via large TZ variable (CVE-2017-7476) + * Tue Apr 25 2017 Kamil Dudka - 8.27-3 - do not obsolete coreutils-single, so it can be installed by DNF2 (#1444802) From e00cb1843f7384b4682280a1a56cef58bdc8106f Mon Sep 17 00:00:00 2001 From: Sebastian Kisela Date: Fri, 28 Apr 2017 12:48:03 +0200 Subject: [PATCH 05/18] tail: revert to polling if a followed directory is replaced (#1283760) --- coreutils-8.27-tail-inotify-recreate.patch | 168 +++++++++++++++++++++ coreutils.spec | 8 +- 2 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 coreutils-8.27-tail-inotify-recreate.patch diff --git a/coreutils-8.27-tail-inotify-recreate.patch b/coreutils-8.27-tail-inotify-recreate.patch new file mode 100644 index 0000000..1a63655 --- /dev/null +++ b/coreutils-8.27-tail-inotify-recreate.patch @@ -0,0 +1,168 @@ +From ba5fe2d4b8b6a8366f48b1ad1f97fe26c9089b53 Mon Sep 17 00:00:00 2001 +From: Sebastian Kisela +Date: Wed, 5 Apr 2017 09:40:41 +0200 +Subject: [PATCH] tail: revert to polling if a followed directory is replaced + +* src/tail.c (tail_forever_inotify): Add the IN_DELETE_SELF flag when +creating watch for the parent directory. After the parent directory +is removed, an event is caught and then we switch from inotify to +polling mode. Till now, inotify has always frozen because it waited for +an event from a watched dir, which has been already deleted and was not +added again. +* tests/tail-2/inotify-dir-recreate.sh: Add a test case. +* tests/local.mk: Reference the new test. +Fixes http://bugs.gnu.org/26363 +Reported at https://bugzilla.redhat.com/1283760 + +Upstream-commit: ba5fe2d4b8b6a8366f48b1ad1f97fe26c9089b53 + +--- + src/tail.c | 22 +++++++++- + tests/local.mk | 1 + + tests/tail-2/inotify-dir-recreate.sh | 82 ++++++++++++++++++++++++++++++++++++ + 4 files changed, 107 insertions(+), 1 deletion(-) + create mode 100755 tests/tail-2/inotify-dir-recreate.sh + +diff --git a/src/tail.c b/src/tail.c +index d1552d4..6328fe0 100644 +--- a/src/tail.c ++++ b/src/tail.c +@@ -1457,7 +1457,8 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files, + In that case the same watch descriptor is returned. */ + f[i].parent_wd = inotify_add_watch (wd, dirlen ? f[i].name : ".", + (IN_CREATE | IN_DELETE +- | IN_MOVED_TO | IN_ATTRIB)); ++ | IN_MOVED_TO | IN_ATTRIB ++ | IN_DELETE_SELF)); + + f[i].name[dirlen] = prev; + +@@ -1628,6 +1629,25 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files, + ev = void_ev; + evbuf_off += sizeof (*ev) + ev->len; + ++ /* If a directory is deleted, IN_DELETE_SELF is emitted ++ with ev->name of length 0. ++ We need to catch it, otherwise it would wait forever, ++ as wd for directory becomes inactive. Revert to polling now. */ ++ if ((ev->mask & IN_DELETE_SELF) && ! ev->len) ++ { ++ for (i = 0; i < n_files; i++) ++ { ++ if (ev->wd == f[i].parent_wd) ++ { ++ hash_free (wd_to_name); ++ error (0, 0, ++ _("directory containing watched file was removed")); ++ errno = 0; /* we've already diagnosed enough errno detail. */ ++ return true; ++ } ++ } ++ } ++ + if (ev->len) /* event on ev->name in watched directory. */ + { + size_t j; +diff --git a/tests/local.mk b/tests/local.mk +index 3fe9ba8..e890c9a 100644 +--- a/tests/local.mk ++++ b/tests/local.mk +@@ -176,6 +176,7 @@ all_tests = \ + tests/tail-2/descriptor-vs-rename.sh \ + tests/tail-2/inotify-rotate.sh \ + tests/tail-2/inotify-rotate-resources.sh \ ++ tests/tail-2/inotify-dir-recreate.sh \ + tests/chmod/no-x.sh \ + tests/chgrp/basic.sh \ + tests/rm/dangling-symlink.sh \ +diff --git a/tests/tail-2/inotify-dir-recreate.sh b/tests/tail-2/inotify-dir-recreate.sh +new file mode 100755 +index 0000000..eaa8422 +--- /dev/null ++++ b/tests/tail-2/inotify-dir-recreate.sh +@@ -0,0 +1,82 @@ ++#!/bin/sh ++# Makes sure, inotify will switch to polling mode if directory ++# of the watched file was removed and recreated. ++# (...instead of getting stuck forever) ++ ++# Copyright (C) 2006-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_ tail ++ ++ ++# Terminate any background tail process ++cleanup_() { kill $pid 2>/dev/null && wait $pid; } ++ ++cleanup_fail_ () ++{ ++ warn_ $1 ++ cleanup_ ++ fail=1 ++} ++ ++# $check_re - string to be found ++# $check_f - file to be searched ++check_tail_output_ () ++{ ++ local delay="$1" ++ grep $check_re $check_f > /dev/null || ++ { sleep $delay ; return 1; } ++} ++ ++grep_timeout_ () ++{ ++ check_re="$1" ++ check_f="$2" ++ retry_delay_ check_tail_output_ .1 5 ++} ++ ++# Prepare the file to be watched ++mkdir dir && echo 'inotify' > dir/file || framework_failure_ ++ ++#tail must print content of the file to stdout, verify ++timeout 60 tail -F dir/file &>out & pid=$! ++grep_timeout_ 'inotify' 'out' || ++{ cleanup_fail_ 'file to be tailed does not exist'; } ++ ++# Remove the directory, should get the message about the deletion ++rm -r dir || framework_failure_ ++grep_timeout_ 'polling' 'out' || ++{ cleanup_fail_ 'tail did not switch to polling mode'; } ++ ++# Recreate the dir, must get a message about recreation ++mkdir dir && touch dir/file || framework_failure_ ++grep_timeout_ 'appeared' 'out' || ++{ cleanup_fail_ 'previously removed file did not appear'; } ++ ++cleanup_ ++ ++# Expected result for the whole process ++cat <<\EOF > exp || framework_failure_ ++inotify ++tail: 'dir/file' has become inaccessible: No such file or directory ++tail: directory containing watched file was removed ++tail: inotify cannot be used, reverting to polling ++tail: 'dir/file' has appeared; following new file ++EOF ++ ++compare exp out || fail=1 ++ ++Exit $fail +-- +2.9.3 + diff --git a/coreutils.spec b/coreutils.spec index 199d2e4..5979119 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.27 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -22,6 +22,9 @@ Patch1: coreutils-8.27-date-debug-test.patch # date, touch: fix out-of-bounds write via large TZ variable (CVE-2017-7476) Patch2: coreutils-8.27-CVE-2017-7476.patch +# tail: revert to polling if a followed directory is replaced +Patch3: coreutils-8.27-tail-inotify-recreate.patch + # disable the test-lock gnulib test prone to deadlock Patch100: coreutils-8.26-test-lock.patch @@ -304,6 +307,9 @@ fi %license COPYING %changelog +* Fri Apr 28 2017 Sebastian Kisela - 8.27-5 +- tail: revert to polling if a followed directory is replaced + * Thu Apr 27 2017 Kamil Dudka - 8.27-4 - date, touch: fix out-of-bounds write via large TZ variable (CVE-2017-7476) From b9d157d0ce266b8fe3f3eac43a60d61f85c29a7a Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 3 May 2017 13:04:16 +0200 Subject: [PATCH 06/18] drop unnecessary uses of %defattr --- coreutils.spec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/coreutils.spec b/coreutils.spec index 5979119..e5ef88d 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.27 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -22,7 +22,7 @@ Patch1: coreutils-8.27-date-debug-test.patch # date, touch: fix out-of-bounds write via large TZ variable (CVE-2017-7476) Patch2: coreutils-8.27-CVE-2017-7476.patch -# tail: revert to polling if a followed directory is replaced +# tail: revert to polling if a followed directory is replaced (#1283760) Patch3: coreutils-8.27-tail-inotify-recreate.patch # disable the test-lock gnulib test prone to deadlock @@ -283,12 +283,10 @@ if [ -f %{_infodir}/%{name}.info.gz ]; then fi %files -f supported_utils -%defattr(-,root,root,-) %exclude %{_bindir}/*.single %{_libexecdir}/coreutils/*.so %files single -%defattr(-,root,root,-) %{_bindir}/*.single %{_sbindir}/chroot.single %{_libexecdir}/coreutils/*.so.single @@ -297,7 +295,6 @@ fi %license COPYING %files common -f %{name}.lang -%defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/DIR_COLORS* %config(noreplace) %{_sysconfdir}/profile.d/* %{_infodir}/coreutils* @@ -307,8 +304,11 @@ fi %license COPYING %changelog +* Wed May 03 2017 Kamil Dudka - 8.27-6 +- drop unnecessary uses of %%defattr + * Fri Apr 28 2017 Sebastian Kisela - 8.27-5 -- tail: revert to polling if a followed directory is replaced +- tail: revert to polling if a followed directory is replaced (#1283760) * Thu Apr 27 2017 Kamil Dudka - 8.27-4 - date, touch: fix out-of-bounds write via large TZ variable (CVE-2017-7476) From e0b67f5aa96fa940745ce37a666fd900e4c4a123 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 3 May 2017 12:41:53 +0200 Subject: [PATCH 07/18] Related: #246729 - drop workaround no longer needed for 10 years old rpm-build bug --- coreutils.spec | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/coreutils.spec b/coreutils.spec index e5ef88d..a80b161 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -254,17 +254,8 @@ install -p -c -m644 DIR_COLORS{,.256color,.lightbgcolor} \ install -p -c -m644 %SOURCE105 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.sh install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.csh -# Use hard links instead of symbolic links for LC_TIME files (bug #246729). -find %{buildroot}%{_datadir}/locale -type l | \ -(while read link - do - target=$(readlink "$link") - rm -f "$link" - ln "$(dirname "$link")/$target" "$link" - done) - %find_lang %name -#Add the %lang(xyz) ownership for the LC_TIME dirs as well... +# Add the %%lang(xyz) ownership for the LC_TIME dirs as well... grep LC_TIME %name.lang | cut -d'/' -f1-6 | sed -e 's/) /) %%dir /g' >>%name.lang # (sb) Deal with Installed (but unpackaged) file(s) found @@ -305,6 +296,7 @@ fi %changelog * Wed May 03 2017 Kamil Dudka - 8.27-6 +- drop workaround no longer needed for 10 years old rpm-build bug (#246729) - drop unnecessary uses of %%defattr * Fri Apr 28 2017 Sebastian Kisela - 8.27-5 From 28873d6a702898497a707c3e57f0c68f86b5196a Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 3 May 2017 13:01:02 +0200 Subject: [PATCH 08/18] do not mention a deprecated option in localized man pages --- coreutils.spec | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/coreutils.spec b/coreutils.spec index a80b161..24e789f 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -186,11 +186,6 @@ tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null find tests -name '*.sh' -perm 0644 -print -exec chmod 0755 '{}' '+' (echo "<<< done") 2>/dev/null -#fix typos/mistakes in localized documentation(#439410, #440056) -find ./po/ -name "*.p*" | xargs \ - sed -i \ - -e 's/-dpR/-cdpR/' - autoreconf -fiv %build @@ -296,6 +291,7 @@ fi %changelog * Wed May 03 2017 Kamil Dudka - 8.27-6 +- do not mention a deprecated option in localized man pages - drop workaround no longer needed for 10 years old rpm-build bug (#246729) - drop unnecessary uses of %%defattr From 34aa75941591479a138ec455ecf9cd50f0b9d04c Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 3 May 2017 13:40:56 +0200 Subject: [PATCH 09/18] Related: #1306559 - drop workaround for already fixed rpm-build bug --- coreutils-find-requires.sh | 25 ------------------------- coreutils.spec | 12 ++++++------ 2 files changed, 6 insertions(+), 31 deletions(-) delete mode 100755 coreutils-find-requires.sh diff --git a/coreutils-find-requires.sh b/coreutils-find-requires.sh deleted file mode 100755 index 27d1368..0000000 --- a/coreutils-find-requires.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# Reduce requires for coreutils-single -# Needed since it has overlapping "binaries" with the main package -# Ideally we could do the following in the spec only for the single subpackage -# %define __requires_exclude_from ^(%{_bindir}|%{_sbindir})/([^c]|c[^o]|co[^r]|cor[^e]) - -original_find_requires="$1" -shift - -# Get the list of files. -files=`sed "s/['\"]/\\\&/g"` - -single_bin='/usr/bin/coreutils' - -single=`echo $files | grep "$single_bin"` - -echo $files | tr [:blank:] '\n' | -if [ "$single" ]; then - # Only allow the coreutils multicall binary - # Also adjust for .single renaming - sed -n 's|\(.*'"$single_bin"'\)\(.single\)\?$|\1.single|p' -else - cat -fi | -$original_find_requires diff --git a/coreutils.spec b/coreutils.spec index 24e789f..eb5455e 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.27 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -10,11 +10,8 @@ Source50: supported_utils Source105: coreutils-colorls.sh Source106: coreutils-colorls.csh -# Provide our own custom requires for coreutils-single package -Source10: coreutils-find-requires.sh -%global _use_internal_dependency_generator 0 -%global __find_provides %{_rpmconfigdir}/find-provides -%global __find_requires %{SOURCE10} %{_rpmconfigdir}/find-requires +# do not make coreutils-single depend on /usr/bin/coreutils +%global __requires_exclude ^%{_bindir}/coreutils$ # upstream patches Patch1: coreutils-8.27-date-debug-test.patch @@ -290,6 +287,9 @@ fi %license COPYING %changelog +* Wed May 03 2017 Kamil Dudka - 8.27-7 +- drop workaround for already fixed rpm-build bug (#1306559) + * Wed May 03 2017 Kamil Dudka - 8.27-6 - do not mention a deprecated option in localized man pages - drop workaround no longer needed for 10 years old rpm-build bug (#246729) From fde94e26096e7eaff4d936e2ec1b882621cc5c09 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 3 May 2017 15:42:49 +0200 Subject: [PATCH 10/18] Related: #158405 - drop coreutils-overflow.patch no longer needed The bug was fixed by the following upstream commit 13 years ago: http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=COREUTILS-5_2_1-705-g5bca9fb --- coreutils-overflow.patch | 13 ------------- coreutils.spec | 7 ++++--- 2 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 coreutils-overflow.patch diff --git a/coreutils-overflow.patch b/coreutils-overflow.patch deleted file mode 100644 index d62b19a..0000000 --- a/coreutils-overflow.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/who.c b/src/who.c -index 55733b4..3ad4774 100644 ---- a/src/who.c -+++ b/src/who.c -@@ -81,7 +81,7 @@ - # define UT_TYPE_NEW_TIME(U) false - #endif - --#define IDLESTR_LEN 6 -+#define IDLESTR_LEN 10 - - #if HAVE_STRUCT_XTMP_UT_PID - # define PIDSTR_DECL_AND_INIT(Var, Utmp_ent) \ diff --git a/coreutils.spec b/coreutils.spec index eb5455e..203e7cf 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.27 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -60,8 +60,6 @@ Patch808: coreutils-i18n-fold-newline.patch #getgrouplist() patch from Ulrich Drepper. Patch908: coreutils-getgrouplist.patch -#Prevent buffer overflow in who(1) (bug #158405). -Patch912: coreutils-overflow.patch #SELINUX Patch - implements Redhat changes #(upstream did some SELinux implementation unlike with RedHat patch) @@ -287,6 +285,9 @@ fi %license COPYING %changelog +* Wed May 03 2017 Kamil Dudka - 8.27-8 +- drop coreutils-overflow.patch no longer needed (#158405) + * Wed May 03 2017 Kamil Dudka - 8.27-7 - drop workaround for already fixed rpm-build bug (#1306559) From 6f16afd4a6838ca2f01e46cb85688a0c2146587f Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 16 May 2017 14:15:41 +0200 Subject: [PATCH 11/18] add coreutils-full provides for coreutils ... to make it explicitly installable --- coreutils.spec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/coreutils.spec b/coreutils.spec index 203e7cf..13f3ed9 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.27 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -122,14 +122,17 @@ BuildRequires: glibc-langpack-en Requires: %{name}-common = %{version}-%{release} Requires: ncurses +Provides: bundled(gnulib) +Provides: coreutils-full = %{version}-%{release} Provides: fileutils = %{version}-%{release} Provides: sh-utils = %{version}-%{release} Provides: stat = %{version}-%{release} Provides: textutils = %{version}-%{release} + #old mktemp package had epoch 3, so we have to use 4 for coreutils Provides: mktemp = 4:%{version}-%{release} -Provides: bundled(gnulib) Obsoletes: mktemp < 4:%{version}-%{release} + Obsoletes: fileutils <= 4.1.9 Obsoletes: sh-utils <= 2.0.12 Obsoletes: stat <= 3.3 @@ -285,6 +288,9 @@ fi %license COPYING %changelog +* Tue May 16 2017 Kamil Dudka - 8.27-9 +- add coreutils-full provides for coreutils to make it explicitly installable + * Wed May 03 2017 Kamil Dudka - 8.27-8 - drop coreutils-overflow.patch no longer needed (#158405) From 8d0221274232d140047e21d423a183f8b3a236ec Mon Sep 17 00:00:00 2001 From: Sebastian Kisela Date: Tue, 30 May 2017 09:39:28 +0200 Subject: [PATCH 12/18] doc: mention `setpriv --no-new-privs` feature in runcon info * doc/coreutils.texi (runcon invocation): Mention setpriv usage. Discussed at https://bugzilla.redhat.com/1360903 --- coreutils-8.27-runcon-doc.patch | 33 +++++++++++++++++++++++++++++++++ coreutils.spec | 8 +++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 coreutils-8.27-runcon-doc.patch diff --git a/coreutils-8.27-runcon-doc.patch b/coreutils-8.27-runcon-doc.patch new file mode 100644 index 0000000..41c0a8a --- /dev/null +++ b/coreutils-8.27-runcon-doc.patch @@ -0,0 +1,33 @@ +From 76be8a7f9eb717b3d47009eb25d39fe7139a2c2d Mon Sep 17 00:00:00 2001 +From: Sebastian Kisela +Date: Tue, 30 May 2017 09:29:32 +0200 +Subject: [PATCH] doc: mention `setpriv --no-new-privs` feature in runcon info + +upstream commit: 6ebaf8195000d6d3590a2eac13f13b158e325452 +--- + doc/coreutils.texi | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/doc/coreutils.texi b/doc/coreutils.texi +index 68df075..e16e885 100644 +--- a/doc/coreutils.texi ++++ b/doc/coreutils.texi +@@ -16583,7 +16583,14 @@ are interpreted as arguments to the command. + With neither @var{context} nor @var{command}, print the current + security context. + +-The program accepts the following options. Also see @ref{Common options}. ++@cindex restricted security context ++@cindex NO_NEW_PRIVS ++Note also the @command{setpriv} command which can be used to set the ++NO_NEW_PRIVS bit using @command{setpriv --no-new-privs runcon ...}, ++thus disallowing usage of a security context with more privileges ++than the process would normally have. ++ ++@command{runcon} accepts the following options. Also see @ref{Common options}. + + @table @samp + +-- +2.9.4 + diff --git a/coreutils.spec b/coreutils.spec index 13f3ed9..2fadd14 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.27 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -22,6 +22,9 @@ Patch2: coreutils-8.27-CVE-2017-7476.patch # tail: revert to polling if a followed directory is replaced (#1283760) Patch3: coreutils-8.27-tail-inotify-recreate.patch +# doc: mention `setpriv --no-new-privs` feature in runcon info +Patch4: coreutils-8.27-runcon-doc.patch + # disable the test-lock gnulib test prone to deadlock Patch100: coreutils-8.26-test-lock.patch @@ -288,6 +291,9 @@ fi %license COPYING %changelog +* Tue May 30 2017 Sebastian Kisela - 8.27-10 +- doc: mention `setpriv --no-new-privs` feature in runcon info + * Tue May 16 2017 Kamil Dudka - 8.27-9 - add coreutils-full provides for coreutils to make it explicitly installable From 8fd1881fe2e138499d19e9987f12865acf53744c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 26 Jul 2017 05:30:55 +0000 Subject: [PATCH 13/18] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild --- coreutils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coreutils.spec b/coreutils.spec index 2fadd14..75442f1 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.27 -Release: 10%{?dist} +Release: 11%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -291,6 +291,9 @@ fi %license COPYING %changelog +* Wed Jul 26 2017 Fedora Release Engineering - 8.27-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + * Tue May 30 2017 Sebastian Kisela - 8.27-10 - doc: mention `setpriv --no-new-privs` feature in runcon info From 28658db74496997acdfd865a9003c4669199569b Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 26 Jul 2017 16:47:43 +0200 Subject: [PATCH 14/18] avoid build failure caused broken RPM code ... that produces debuginfo packages Bug: https://github.com/rpm-software-management/rpm/issues/280 --- coreutils.spec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/coreutils.spec b/coreutils.spec index 75442f1..51107f8 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,11 @@ +# avoid build failure caused broken RPM code that produces debuginfo packages +# reported at https://github.com/rpm-software-management/rpm/issues/280 +%undefine _debuginfo_subpackages + Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 8.27 -Release: 11%{?dist} +Release: 12%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -291,6 +295,9 @@ fi %license COPYING %changelog +* Wed Jul 26 2017 Kamil Dudka - 8.27-12 +- avoid build failure caused broken RPM code that produces debuginfo packages + * Wed Jul 26 2017 Fedora Release Engineering - 8.27-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild From 8401ff18e33727d5e9216b8ed11187d0eedbdcf5 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 28 Jul 2017 19:42:43 +0200 Subject: [PATCH 15/18] Enable separate debuginfo back Signed-off-by: Igor Gnatenko --- coreutils.spec | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/coreutils.spec b/coreutils.spec index 51107f8..cb884d3 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,11 +1,7 @@ -# avoid build failure caused broken RPM code that produces debuginfo packages -# reported at https://github.com/rpm-software-management/rpm/issues/280 -%undefine _debuginfo_subpackages - Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 8.27 -Release: 12%{?dist} +Release: 13%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -295,6 +291,9 @@ fi %license COPYING %changelog +* Fri Jul 28 2017 Igor Gnatenko - 8.27-13 +- Enable separate debuginfo back + * Wed Jul 26 2017 Kamil Dudka - 8.27-12 - avoid build failure caused broken RPM code that produces debuginfo packages From 353860c35c5c461ad77b5754a950c44af4eb6c65 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 2 Aug 2017 19:11:06 +0000 Subject: [PATCH 16/18] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild --- coreutils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coreutils.spec b/coreutils.spec index cb884d3..8c2e00d 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.27 -Release: 13%{?dist} +Release: 14%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -291,6 +291,9 @@ fi %license COPYING %changelog +* Wed Aug 02 2017 Fedora Release Engineering - 8.27-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + * Fri Jul 28 2017 Igor Gnatenko - 8.27-13 - Enable separate debuginfo back From d2d5d5d057349577871567a643eae6af84d81256 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Fri, 18 Aug 2017 17:52:50 +0200 Subject: [PATCH 17/18] Resolves: #1482445 - ptx: fix a possible crash caused by integer overflow --- coreutils-8.27-ptx-int-overflow.patch | 547 ++++++++++++++++++++++++++ coreutils.spec | 8 +- 2 files changed, 554 insertions(+), 1 deletion(-) create mode 100644 coreutils-8.27-ptx-int-overflow.patch diff --git a/coreutils-8.27-ptx-int-overflow.patch b/coreutils-8.27-ptx-int-overflow.patch new file mode 100644 index 0000000..897c2ad --- /dev/null +++ b/coreutils-8.27-ptx-int-overflow.patch @@ -0,0 +1,547 @@ +From 7408a9758924a1ccbabf9fcab401a31ef1b7c755 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Thu, 17 Aug 2017 12:02:16 -0700 +Subject: [PATCH] ptx: fix some integer overflow bugs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Problem reported by Lukas Zachar at: +http://bugzilla.redhat.com/1482445 +* src/ptx.c (line_width, gap_size, maximum_word_length) +(reference_max_width, half_line_width, before_max_width) +(keyafter_max_width, truncation_string_length, compare_words) +(compare_occurs, search_table, find_occurs_in_text, print_spaces) +(fix_output_parameters, define_all_fields): +Use ptrdiff_t, not int, for object offsets and sizes. +(WORD, OCCURS): Use ptrdiff_t, not short int. +(WORD_TABLE, number_of_occurs, generate_all_output): +Prefer ptrdiff_t to size_t where either will do. +(total_line_count, file_line_count, OCCURS, fix_output_parameters) +(define_all_fields): +Use intmax_t, not int, for line counts. +(DELTA): Remove. All uses changed. +(OCCURS, find_occurs_in_text, fix_output_parameters): +Use int, not size_t, for file indexes. +(tail_truncation, before_truncation, keyafter_truncation) +(head_truncation, search_table, define_all_fields) +(generate_all_output): +Use bool for booleans. +(digest_word_file, find_occurs_in_text): +Use x2nrealloc instead of checking for overflow by hand. +(find_occurs_in_text, fix_output_parameters, define_all_fields): +Omit unnecessary cast. +(fix_output_parameters): Don’t assume integers fit in 11 digits. +(fix_output_parameters, define_all_fields): +Use sprintf return value rather than calling strlen. +(define_all_fields): Do not rely on sprintf to generate a string +that may contain more than INT_MAX bytes. +(main): Use xstrtoimax, not xstrtoul. +Use xnmalloc to catch integer overflow. + +Upstream-commit: 1d9765a764790cc68ec52c16d7ccbf633c404f0e +Signed-off-by: Kamil Dudka +--- + src/ptx.c | 194 +++++++++++++++++++++++++++++--------------------------------- + 1 file changed, 91 insertions(+), 103 deletions(-) + +diff --git a/src/ptx.c b/src/ptx.c +index c0c9733..2aababf 100644 +--- a/src/ptx.c ++++ b/src/ptx.c +@@ -59,9 +59,9 @@ + /* Global definitions. */ + + /* FIXME: There are many unchecked integer overflows in this file, +- that will cause this command to misbehave given large inputs or +- options. Many of the "int" values below should be "size_t" or +- something else like that. */ ++ and in theory they could cause this command to have undefined ++ behavior given large inputs or options. This command should ++ diagnose any such overflow and exit. */ + + /* Program options. */ + +@@ -77,8 +77,8 @@ static bool gnu_extensions = true; /* trigger all GNU extensions */ + static bool auto_reference = false; /* refs are 'file_name:line_number:' */ + static bool input_reference = false; /* refs at beginning of input lines */ + static bool right_reference = false; /* output refs after right context */ +-static int line_width = 72; /* output line width in characters */ +-static int gap_size = 3; /* number of spaces between output fields */ ++static ptrdiff_t line_width = 72; /* output line width in characters */ ++static ptrdiff_t gap_size = 3; /* number of spaces between output fields */ + static const char *truncation_string = "/"; + /* string used to mark line truncations */ + static const char *macro_name = "xx"; /* macro name for roff or TeX output */ +@@ -105,8 +105,8 @@ static struct regex_data context_regex; /* end of context */ + static struct regex_data word_regex; /* keyword */ + + /* A BLOCK delimit a region in memory of arbitrary size, like the copy of a +- whole file. A WORD is something smaller, its length should fit in a +- short integer. A WORD_TABLE may contain several WORDs. */ ++ whole file. A WORD is similar, except it is intended for smaller regions. ++ A WORD_TABLE may contain several WORDs. */ + + typedef struct + { +@@ -118,7 +118,7 @@ BLOCK; + typedef struct + { + char *start; /* pointer to beginning of region */ +- short int size; /* length of the region */ ++ ptrdiff_t size; /* length of the region */ + } + WORD; + +@@ -126,7 +126,7 @@ typedef struct + { + WORD *start; /* array of WORDs */ + size_t alloc; /* allocated length */ +- size_t length; /* number of used entries */ ++ ptrdiff_t length; /* number of used entries */ + } + WORD_TABLE; + +@@ -149,10 +149,10 @@ static struct re_registers word_regs; + static char word_fastmap[CHAR_SET_SIZE]; + + /* Maximum length of any word read. */ +-static int maximum_word_length; ++static ptrdiff_t maximum_word_length; + + /* Maximum width of any reference used. */ +-static int reference_max_width; ++static ptrdiff_t reference_max_width; + + /* Ignore and Only word tables. */ + +@@ -162,9 +162,9 @@ static WORD_TABLE only_table; /* table of words to select */ + /* Source text table, and scanning macros. */ + + static int number_input_files; /* number of text input files */ +-static int total_line_count; /* total number of lines seen so far */ ++static intmax_t total_line_count; /* total number of lines seen so far */ + static const char **input_file_name; /* array of text input file names */ +-static int *file_line_count; /* array of 'total_line_count' values at end */ ++static intmax_t *file_line_count; /* array of line count values at end */ + + static BLOCK *text_buffers; /* files to study */ + +@@ -219,20 +219,18 @@ static BLOCK *text_buffers; /* files to study */ + + When automatic references are used, the 'reference' value is the + overall line number in all input files read so far, in this case, it +- is of type (int). When input references are used, the 'reference' ++ is of type intmax_t. When input references are used, the 'reference' + value indicates the distance between the keyword beginning and the +- start of the reference field, it is of type (DELTA) and usually ++ start of the reference field, and it fits in ptrdiff_t and is usually + negative. */ + +-typedef short int DELTA; /* to hold displacement within one context */ +- + typedef struct + { + WORD key; /* description of the keyword */ +- DELTA left; /* distance to left context start */ +- DELTA right; /* distance to right context end */ +- int reference; /* reference descriptor */ +- size_t file_index; /* corresponding file */ ++ ptrdiff_t left; /* distance to left context start */ ++ ptrdiff_t right; /* distance to right context end */ ++ intmax_t reference; /* reference descriptor */ ++ int file_index; /* corresponding file */ + } + OCCURS; + +@@ -241,7 +239,7 @@ OCCURS; + + static OCCURS *occurs_table[1]; /* all words retained from the read text */ + static size_t occurs_alloc[1]; /* allocated size of occurs_table */ +-static size_t number_of_occurs[1]; /* number of used slots in occurs_table */ ++static ptrdiff_t number_of_occurs[1]; /* number of used slots in occurs_table */ + + + /* Communication among output routines. */ +@@ -249,10 +247,17 @@ static size_t number_of_occurs[1]; /* number of used slots in occurs_table */ + /* Indicate if special output processing is requested for each character. */ + static char edited_flag[CHAR_SET_SIZE]; + +-static int half_line_width; /* half of line width, reference excluded */ +-static int before_max_width; /* maximum width of before field */ +-static int keyafter_max_width; /* maximum width of keyword-and-after field */ +-static int truncation_string_length;/* length of string that flags truncation */ ++/* Half of line width, reference excluded. */ ++static ptrdiff_t half_line_width; ++ ++/* Maximum width of before field. */ ++static ptrdiff_t before_max_width; ++ ++/* Maximum width of keyword-and-after field. */ ++static ptrdiff_t keyafter_max_width; ++ ++/* Length of string that flags truncation. */ ++static ptrdiff_t truncation_string_length; + + /* When context is limited by lines, wraparound may happen on final output: + the 'head' pointer gives access to some supplementary left context which +@@ -261,16 +266,16 @@ static int truncation_string_length;/* length of string that flags truncation */ + beginning of the output line. */ + + static BLOCK tail; /* tail field */ +-static int tail_truncation; /* flag truncation after the tail field */ ++static bool tail_truncation; /* flag truncation after the tail field */ + + static BLOCK before; /* before field */ +-static int before_truncation; /* flag truncation before the before field */ ++static bool before_truncation; /* flag truncation before the before field */ + + static BLOCK keyafter; /* keyword-and-after field */ +-static int keyafter_truncation; /* flag truncation after the keyafter field */ ++static bool keyafter_truncation; /* flag truncation after the keyafter field */ + + static BLOCK head; /* head field */ +-static int head_truncation; /* flag truncation before the head field */ ++static bool head_truncation; /* flag truncation before the head field */ + + static BLOCK reference; /* reference field for input reference mode */ + +@@ -540,8 +545,8 @@ compare_words (const void *void_first, const void *void_second) + { + #define first ((const WORD *) void_first) + #define second ((const WORD *) void_second) +- int length; /* minimum of two lengths */ +- int counter; /* cursor in words */ ++ ptrdiff_t length; /* minimum of two lengths */ ++ ptrdiff_t counter; /* cursor in words */ + int value; /* value of comparison */ + + length = first->size < second->size ? first->size : second->size; +@@ -567,7 +572,7 @@ compare_words (const void *void_first, const void *void_second) + } + } + +- return first->size - second->size; ++ return first->size < second->size ? -1 : first->size > second->size; + #undef first + #undef second + } +@@ -586,21 +591,21 @@ compare_occurs (const void *void_first, const void *void_second) + int value; + + value = compare_words (&first->key, &second->key); +- return value == 0 ? first->key.start - second->key.start : value; ++ return (value ? value ++ : first->key.start < second->key.start ? -1 ++ : first->key.start > second->key.start); + #undef first + #undef second + } + +-/*------------------------------------------------------------. +-| Return !0 if WORD appears in TABLE. Uses a binary search. | +-`------------------------------------------------------------*/ ++/* True if WORD appears in TABLE. Uses a binary search. */ + +-static int _GL_ATTRIBUTE_PURE ++static bool _GL_ATTRIBUTE_PURE + search_table (WORD *word, WORD_TABLE *table) + { +- int lowest; /* current lowest possible index */ +- int highest; /* current highest possible index */ +- int middle; /* current middle index */ ++ ptrdiff_t lowest; /* current lowest possible index */ ++ ptrdiff_t highest; /* current highest possible index */ ++ ptrdiff_t middle; /* current middle index */ + int value; /* value from last comparison */ + + lowest = 0; +@@ -614,9 +619,9 @@ search_table (WORD *word, WORD_TABLE *table) + else if (value > 0) + lowest = middle + 1; + else +- return 1; ++ return true; + } +- return 0; ++ return false; + } + + /*---------------------------------------------------------------------. +@@ -713,14 +718,8 @@ digest_word_file (const char *file_name, WORD_TABLE *table) + if (cursor > word_start) + { + if (table->length == table->alloc) +- { +- if ((SIZE_MAX / sizeof *table->start - 1) / 2 < table->alloc) +- xalloc_die (); +- table->alloc = table->alloc * 2 + 1; +- table->start = xrealloc (table->start, +- table->alloc * sizeof *table->start); +- } +- ++ table->start = x2nrealloc (table->start, &table->alloc, ++ sizeof *table->start); + table->start[table->length].start = word_start; + table->start[table->length].size = cursor - word_start; + table->length++; +@@ -744,13 +743,13 @@ digest_word_file (const char *file_name, WORD_TABLE *table) + `----------------------------------------------------------------------*/ + + static void +-find_occurs_in_text (size_t file_index) ++find_occurs_in_text (int file_index) + { + char *cursor; /* for scanning the source text */ + char *scan; /* for scanning the source text also */ + char *line_start; /* start of the current input line */ + char *line_scan; /* newlines scanned until this point */ +- int reference_length; /* length of reference in input mode */ ++ ptrdiff_t reference_length; /* length of reference in input mode */ + WORD possible_key; /* possible key, to ease searches */ + OCCURS *occurs_cursor; /* current OCCURS under construction */ + +@@ -946,16 +945,9 @@ find_occurs_in_text (size_t file_index) + where it will be constructed. */ + + if (number_of_occurs[0] == occurs_alloc[0]) +- { +- if ((SIZE_MAX / sizeof *occurs_table[0] - 1) / 2 +- < occurs_alloc[0]) +- xalloc_die (); +- occurs_alloc[0] = occurs_alloc[0] * 2 + 1; +- occurs_table[0] = +- xrealloc (occurs_table[0], +- occurs_alloc[0] * sizeof *occurs_table[0]); +- } +- ++ occurs_table[0] = x2nrealloc (occurs_table[0], ++ &occurs_alloc[0], ++ sizeof *occurs_table[0]); + occurs_cursor = occurs_table[0] + number_of_occurs[0]; + + /* Define the reference field, if any. */ +@@ -990,8 +982,7 @@ find_occurs_in_text (size_t file_index) + of the reference. The reference position is simply the + value of 'line_start'. */ + +- occurs_cursor->reference +- = (DELTA) (line_start - possible_key.start); ++ occurs_cursor->reference = line_start - possible_key.start; + if (reference_length > reference_max_width) + reference_max_width = reference_length; + } +@@ -1023,11 +1014,9 @@ find_occurs_in_text (size_t file_index) + `-----------------------------------------*/ + + static void +-print_spaces (int number) ++print_spaces (ptrdiff_t number) + { +- int counter; +- +- for (counter = number; counter > 0; counter--) ++ for (ptrdiff_t counter = number; counter > 0; counter--) + putchar (' '); + } + +@@ -1200,10 +1189,9 @@ print_field (BLOCK field) + static void + fix_output_parameters (void) + { +- size_t file_index; /* index in text input file arrays */ +- int line_ordinal; /* line ordinal value for reference */ +- char ordinal_string[12]; /* edited line ordinal for reference */ +- int reference_width; /* width for the whole reference */ ++ int file_index; /* index in text input file arrays */ ++ intmax_t line_ordinal; /* line ordinal value for reference */ ++ ptrdiff_t reference_width; /* width for the whole reference */ + int character; /* character ordinal */ + const char *cursor; /* cursor in some constant strings */ + +@@ -1219,15 +1207,15 @@ fix_output_parameters (void) + line_ordinal = file_line_count[file_index] + 1; + if (file_index > 0) + line_ordinal -= file_line_count[file_index - 1]; +- sprintf (ordinal_string, "%d", line_ordinal); +- reference_width = strlen (ordinal_string); ++ char ordinal_string[INT_BUFSIZE_BOUND (intmax_t)]; ++ reference_width = sprintf (ordinal_string, "%"PRIdMAX, line_ordinal); + if (input_file_name[file_index]) + reference_width += strlen (input_file_name[file_index]); + if (reference_width > reference_max_width) + reference_max_width = reference_width; + } + reference_max_width++; +- reference.start = xmalloc ((size_t) reference_max_width + 1); ++ reference.start = xmalloc (reference_max_width + 1); + } + + /* If the reference appears to the left of the output line, reserve some +@@ -1355,14 +1343,14 @@ fix_output_parameters (void) + static void + define_all_fields (OCCURS *occurs) + { +- int tail_max_width; /* allowable width of tail field */ +- int head_max_width; /* allowable width of head field */ ++ ptrdiff_t tail_max_width; /* allowable width of tail field */ ++ ptrdiff_t head_max_width; /* allowable width of head field */ + char *cursor; /* running cursor in source text */ + char *left_context_start; /* start of left context */ + char *right_context_end; /* end of right context */ + char *left_field_start; /* conservative start for 'head'/'before' */ + const char *file_name; /* file name for reference */ +- int line_ordinal; /* line ordinal for reference */ ++ intmax_t line_ordinal; /* line ordinal for reference */ + const char *buffer_start; /* start of buffered file for this occurs */ + const char *buffer_end; /* end of buffered file for this occurs */ + +@@ -1435,7 +1423,7 @@ define_all_fields (OCCURS *occurs) + before_truncation = cursor > left_context_start; + } + else +- before_truncation = 0; ++ before_truncation = false; + + SKIP_WHITE (before.start, buffer_end); + +@@ -1468,11 +1456,11 @@ define_all_fields (OCCURS *occurs) + + if (tail.end > tail.start) + { +- keyafter_truncation = 0; ++ keyafter_truncation = false; + tail_truncation = truncation_string && tail.end < right_context_end; + } + else +- tail_truncation = 0; ++ tail_truncation = false; + + SKIP_WHITE_BACKWARDS (tail.end, tail.start); + } +@@ -1483,7 +1471,7 @@ define_all_fields (OCCURS *occurs) + + tail.start = NULL; + tail.end = NULL; +- tail_truncation = 0; ++ tail_truncation = false; + } + + /* 'head' could not take more columns than what has been left in the right +@@ -1506,12 +1494,12 @@ define_all_fields (OCCURS *occurs) + + if (head.end > head.start) + { +- before_truncation = 0; ++ before_truncation = false; + head_truncation = (truncation_string + && head.start > left_context_start); + } + else +- head_truncation = 0; ++ head_truncation = false; + + SKIP_WHITE (head.start, head.end); + } +@@ -1522,7 +1510,7 @@ define_all_fields (OCCURS *occurs) + + head.start = NULL; + head.end = NULL; +- head_truncation = 0; ++ head_truncation = false; + } + + if (auto_reference) +@@ -1540,8 +1528,8 @@ define_all_fields (OCCURS *occurs) + if (occurs->file_index > 0) + line_ordinal -= file_line_count[occurs->file_index - 1]; + +- sprintf (reference.start, "%s:%d", file_name, line_ordinal); +- reference.end = reference.start + strlen (reference.start); ++ char *file_end = stpcpy (reference.start, file_name); ++ reference.end = file_end + sprintf (file_end, ":%"PRIdMAX, line_ordinal); + } + else if (input_reference) + { +@@ -1549,7 +1537,7 @@ define_all_fields (OCCURS *occurs) + /* Reference starts at saved position for reference and extends right + until some white space is met. */ + +- reference.start = keyafter.start + (DELTA) occurs->reference; ++ reference.start = keyafter.start + occurs->reference; + reference.end = reference.start; + SKIP_NON_WHITE (reference.end, right_context_end); + } +@@ -1753,7 +1741,7 @@ output_one_dumb_line (void) + static void + generate_all_output (void) + { +- size_t occurs_index; /* index of keyword entry being processed */ ++ ptrdiff_t occurs_index; /* index of keyword entry being processed */ + OCCURS *occurs_cursor; /* current keyword entry being processed */ + + /* The following assignments are useful to provide default values in case +@@ -1762,11 +1750,11 @@ generate_all_output (void) + + tail.start = NULL; + tail.end = NULL; +- tail_truncation = 0; ++ tail_truncation = false; + + head.start = NULL; + head.end = NULL; +- head_truncation = 0; ++ head_truncation = false; + + /* Loop over all keyword occurrences. */ + +@@ -1946,12 +1934,12 @@ main (int argc, char **argv) + + case 'g': + { +- unsigned long int tmp_ulong; +- if (xstrtoul (optarg, NULL, 0, &tmp_ulong, NULL) != LONGINT_OK +- || ! (0 < tmp_ulong && tmp_ulong <= INT_MAX)) ++ intmax_t tmp; ++ if (! (xstrtoimax (optarg, NULL, 0, &tmp, NULL) == LONGINT_OK ++ && 0 < tmp && tmp <= PTRDIFF_MAX)) + die (EXIT_FAILURE, 0, _("invalid gap width: %s"), + quote (optarg)); +- gap_size = tmp_ulong; ++ gap_size = tmp; + break; + } + +@@ -1973,12 +1961,12 @@ main (int argc, char **argv) + + case 'w': + { +- unsigned long int tmp_ulong; +- if (xstrtoul (optarg, NULL, 0, &tmp_ulong, NULL) != LONGINT_OK +- || ! (0 < tmp_ulong && tmp_ulong <= INT_MAX)) ++ intmax_t tmp; ++ if (! (xstrtoimax (optarg, NULL, 0, &tmp, NULL) == LONGINT_OK ++ && 0 < tmp && tmp <= PTRDIFF_MAX)) + die (EXIT_FAILURE, 0, _("invalid line width: %s"), + quote (optarg)); +- line_width = tmp_ulong; ++ line_width = tmp; + break; + } + +@@ -2045,9 +2033,9 @@ main (int argc, char **argv) + else if (gnu_extensions) + { + number_input_files = argc - optind; +- input_file_name = xmalloc (number_input_files * sizeof *input_file_name); +- file_line_count = xmalloc (number_input_files * sizeof *file_line_count); +- text_buffers = xmalloc (number_input_files * sizeof *text_buffers); ++ input_file_name = xnmalloc (number_input_files, sizeof *input_file_name); ++ file_line_count = xnmalloc (number_input_files, sizeof *file_line_count); ++ text_buffers = xnmalloc (number_input_files, sizeof *text_buffers); + + for (file_index = 0; file_index < number_input_files; file_index++) + { +-- +2.9.5 + diff --git a/coreutils.spec b/coreutils.spec index 8c2e00d..aada4a1 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.27 -Release: 14%{?dist} +Release: 15%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -25,6 +25,9 @@ Patch3: coreutils-8.27-tail-inotify-recreate.patch # doc: mention `setpriv --no-new-privs` feature in runcon info Patch4: coreutils-8.27-runcon-doc.patch +# ptx: fix a possible crash caused by integer overflow (#1482445) +Patch5: coreutils-8.27-ptx-int-overflow.patch + # disable the test-lock gnulib test prone to deadlock Patch100: coreutils-8.26-test-lock.patch @@ -291,6 +294,9 @@ fi %license COPYING %changelog +* Fri Aug 18 2017 Kamil Dudka - 8.27-15 +- ptx: fix a possible crash caused by integer overflow (#1482445) + * Wed Aug 02 2017 Fedora Release Engineering - 8.27-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild From 349062154529401792e83345696f22007909b4f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 22 Aug 2017 13:27:26 +0300 Subject: [PATCH 18/18] Own the %{_libexecdir}/coreutils dir According to Fedora Packaging Guidelines, packages must own all directories they put files in. Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1483938 --- coreutils.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/coreutils.spec b/coreutils.spec index aada4a1..9265112 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.27 -Release: 15%{?dist} +Release: 16%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ @@ -274,11 +274,13 @@ fi %files -f supported_utils %exclude %{_bindir}/*.single +%dir %{_libexecdir}/coreutils %{_libexecdir}/coreutils/*.so %files single %{_bindir}/*.single %{_sbindir}/chroot.single +%dir %{_libexecdir}/coreutils %{_libexecdir}/coreutils/*.so.single # duplicate the license because coreutils-common does not need to be installed %{!?_licensedir:%global license %%doc} @@ -294,6 +296,9 @@ fi %license COPYING %changelog +* Tue Aug 22 2017 Ville Skyttä - 8.27-16 +- Own the %%{_libexecdir}/coreutils dir + * Fri Aug 18 2017 Kamil Dudka - 8.27-15 - ptx: fix a possible crash caused by integer overflow (#1482445)