diff --git a/SOURCES/coreutils-8.22-dd-progress.patch b/SOURCES/coreutils-8.22-dd-progress.patch index 264a432..d07a6a2 100644 --- a/SOURCES/coreutils-8.22-dd-progress.patch +++ b/SOURCES/coreutils-8.22-dd-progress.patch @@ -1,7 +1,7 @@ From af2a4ed22594badd2719c0123441d69b17bd8328 Mon Sep 17 00:00:00 2001 From: Federico Simoncelli Date: Fri, 26 Sep 2014 17:12:32 +0000 -Subject: dd: new status=progress level to print stats periodically +Subject: [PATCH] dd: new status=progress level to print stats periodically * src/dd.c: Report the transfer progress every second when the new status=progress level is used. Adjust the handling and @@ -406,8 +406,8 @@ index f877fdd..34dfba7 100755 compare $tmp_in $tmp_out || fail=1 diff --git a/tests/dd/stats.sh b/tests/dd/stats.sh new file mode 100755 -index 0000000..24b8c49` ---- a/dev/null +index 0000000..24b8c49 100755 +--- /dev/null +++ b/tests/dd/stats.sh @@ -0,0 +1,65 @@ +#!/bin/sh diff --git a/SOURCES/coreutils-8.22-df-stat.patch b/SOURCES/coreutils-8.22-df-stat.patch new file mode 100644 index 0000000..bfa3381 --- /dev/null +++ b/SOURCES/coreutils-8.22-df-stat.patch @@ -0,0 +1,72 @@ +From 9c4641f42bbecf63ec0a0e05caacbccd5332b831 Mon Sep 17 00:00:00 2001 +From: Philipp Thomas +Date: Sun, 26 Mar 2017 22:34:00 -0700 +Subject: [PATCH 1/2] df: avoid querying excluded file systems + +* src/df.c (filter_mount_list): Avoid stat() on +explicitly excluded file systems, which is especially +significant in cases like `-x nfs` which may hang. +* NEWS: Mention the bug fix. + +Upstream-commit: 7c228bc55ed3fd6d56a6ad135438066de2f54a30 +Signed-off-by: Kamil Dudka +--- + src/df.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/df.c b/src/df.c +index 5b9e8fd..e0ebed7 100644 +--- a/src/df.c ++++ b/src/df.c +@@ -632,9 +632,11 @@ filter_mount_list (bool devices_only) + On Linux we probably have me_dev populated from /proc/self/mountinfo, + however we still stat() in case another device was mounted later. */ + if ((me->me_remote && show_local_fs) ++ || (!selected_fstype (me->me_type) || excluded_fstype (me->me_type)) + || -1 == stat (me->me_mountdir, &buf)) + { +- /* If remote, and showing just local, add ME for filtering later. ++ /* If remote, and showing just local, or FS type is excluded, ++ add ME for filtering later. + If stat failed; add ME to be able to complain about it later. */ + buf.st_dev = me->me_dev; + } +-- +2.13.6 + + +From a4a61effe74766cdf047d6af52cf63613057bd87 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Thu, 23 Nov 2017 17:30:09 +0100 +Subject: [PATCH 2/2] df: limit the stat() call optimization for dummy file + systems only + +Otherwise 'df -t rootfs' mistakenly shows a dummy file system without +using the -a option, because the dummy file system is shadowed by the +actual root file system entry, for which we optimize out the stat() +call. + +The problem fixed by this patch is not observable on Fedora because +/proc/self/mountinfo (which we do not use on RHEL) does not contain +the rootfs mount entry. +--- + src/df.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/df.c b/src/df.c +index adade6d..4c6131e 100644 +--- a/src/df.c ++++ b/src/df.c +@@ -632,7 +632,8 @@ filter_mount_list (bool devices_only) + On Linux we probably have me_dev populated from /proc/self/mountinfo, + however we still stat() in case another device was mounted later. */ + if ((me->me_remote && show_local_fs) +- || (!selected_fstype (me->me_type) || excluded_fstype (me->me_type)) ++ || (me->me_dummy && (excluded_fstype (me->me_type) ++ || !selected_fstype (me->me_type))) + || -1 == stat (me->me_mountdir, &buf)) + { + /* If remote, and showing just local, or FS type is excluded, +-- +2.13.6 + diff --git a/SOURCES/coreutils-8.22-ls-interruption.patch b/SOURCES/coreutils-8.22-ls-interruption.patch new file mode 100644 index 0000000..c19d30c --- /dev/null +++ b/SOURCES/coreutils-8.22-ls-interruption.patch @@ -0,0 +1,236 @@ +From e56f09afdbd4bd920e4a1f3b03e29eaccd954dac Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Tue, 6 Sep 2016 17:38:26 +0200 +Subject: [PATCH] ls: allow interruption when reading slow directories + +Postpone installation of signal handlers until they're needed. +That is right before the first escape sequence is printed. + +* src/ls.c (signal_setup): A new function refactored from main() +to set and restore signal handlers. +(main): Move signal handler setup to put_indicator() +so that the default signal handling is untouched as long as possible. +Adjusted condition for restoring signal handlers to reflect the change. +(put_indicator): Install signal handlers if called for the very first +time. It uses the same code that was in main() prior to this commit. +* NEWS: Mention the improvement. + +See https://bugzilla.redhat.com/1365933 +Fixes http://bugs.gnu.org/24232 + +Upstream-commit: 5445f7811ff945ea13aa2a0fd797eb4c0a0e4db0 +Signed-off-by: Kamil Dudka +--- + src/ls.c | 161 ++++++++++++++++++++++++++++++++++++--------------------------- + 1 file changed, 93 insertions(+), 68 deletions(-) + +diff --git a/src/ls.c b/src/ls.c +index a89c87a..1300938 100644 +--- a/src/ls.c ++++ b/src/ls.c +@@ -1246,13 +1246,12 @@ process_signals (void) + } + } + +-int +-main (int argc, char **argv) +-{ +- int i; +- struct pending *thispend; +- int n_files; ++/* Setup signal handlers if INIT is true, ++ otherwise restore to the default. */ + ++static void ++signal_setup (bool init) ++{ + /* The signals that are trapped, and the number of such signals. */ + static int const sig[] = + { +@@ -1280,8 +1279,77 @@ main (int argc, char **argv) + enum { nsigs = ARRAY_CARDINALITY (sig) }; + + #if ! SA_NOCLDSTOP +- bool caught_sig[nsigs]; ++ static bool caught_sig[nsigs]; ++#endif ++ ++ int j; ++ ++ if (init) ++ { ++#if SA_NOCLDSTOP ++ struct sigaction act; ++ ++ sigemptyset (&caught_signals); ++ for (j = 0; j < nsigs; j++) ++ { ++ sigaction (sig[j], NULL, &act); ++ if (act.sa_handler != SIG_IGN) ++ sigaddset (&caught_signals, sig[j]); ++ } ++ ++ act.sa_mask = caught_signals; ++ act.sa_flags = SA_RESTART; ++ ++ for (j = 0; j < nsigs; j++) ++ if (sigismember (&caught_signals, sig[j])) ++ { ++ act.sa_handler = sig[j] == SIGTSTP ? stophandler : sighandler; ++ sigaction (sig[j], &act, NULL); ++ } ++#else ++ for (j = 0; j < nsigs; j++) ++ { ++ caught_sig[j] = (signal (sig[j], SIG_IGN) != SIG_IGN); ++ if (caught_sig[j]) ++ { ++ signal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler); ++ siginterrupt (sig[j], 0); ++ } ++ } + #endif ++ } ++ else /* restore. */ ++ { ++#if SA_NOCLDSTOP ++ for (j = 0; j < nsigs; j++) ++ if (sigismember (&caught_signals, sig[j])) ++ signal (sig[j], SIG_DFL); ++#else ++ for (j = 0; j < nsigs; j++) ++ if (caught_sig[j]) ++ signal (sig[j], SIG_DFL); ++#endif ++ } ++} ++ ++static inline void ++signal_init (void) ++{ ++ signal_setup (true); ++} ++ ++static inline void ++signal_restore (void) ++{ ++ signal_setup (false); ++} ++ ++int ++main (int argc, char **argv) ++{ ++ int i; ++ struct pending *thispend; ++ int n_files; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -1317,46 +1385,6 @@ main (int argc, char **argv) + || (is_colored (C_MISSING) && (format == long_format + || format == security_format))) + check_symlink_color = true; +- +- /* If the standard output is a controlling terminal, watch out +- for signals, so that the colors can be restored to the +- default state if "ls" is suspended or interrupted. */ +- +- if (0 <= tcgetpgrp (STDOUT_FILENO)) +- { +- int j; +-#if SA_NOCLDSTOP +- struct sigaction act; +- +- sigemptyset (&caught_signals); +- for (j = 0; j < nsigs; j++) +- { +- sigaction (sig[j], NULL, &act); +- if (act.sa_handler != SIG_IGN) +- sigaddset (&caught_signals, sig[j]); +- } +- +- act.sa_mask = caught_signals; +- act.sa_flags = SA_RESTART; +- +- for (j = 0; j < nsigs; j++) +- if (sigismember (&caught_signals, sig[j])) +- { +- act.sa_handler = sig[j] == SIGTSTP ? stophandler : sighandler; +- sigaction (sig[j], &act, NULL); +- } +-#else +- for (j = 0; j < nsigs; j++) +- { +- caught_sig[j] = (signal (sig[j], SIG_IGN) != SIG_IGN); +- if (caught_sig[j]) +- { +- signal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler); +- siginterrupt (sig[j], 0); +- } +- } +-#endif +- } + } + + if (dereference == DEREF_UNDEFINED) +@@ -1467,32 +1495,21 @@ main (int argc, char **argv) + print_dir_name = true; + } + +- if (print_with_color) ++ if (print_with_color && used_color) + { + int j; + +- if (used_color) +- { +- /* Skip the restore when it would be a no-op, i.e., +- when left is "\033[" and right is "m". */ +- if (!(color_indicator[C_LEFT].len == 2 +- && memcmp (color_indicator[C_LEFT].string, "\033[", 2) == 0 +- && color_indicator[C_RIGHT].len == 1 +- && color_indicator[C_RIGHT].string[0] == 'm')) +- restore_default_color (); +- } ++ /* Skip the restore when it would be a no-op, i.e., ++ when left is "\033[" and right is "m". */ ++ if (!(color_indicator[C_LEFT].len == 2 ++ && memcmp (color_indicator[C_LEFT].string, "\033[", 2) == 0 ++ && color_indicator[C_RIGHT].len == 1 ++ && color_indicator[C_RIGHT].string[0] == 'm')) ++ restore_default_color (); ++ + fflush (stdout); + +- /* Restore the default signal handling. */ +-#if SA_NOCLDSTOP +- for (j = 0; j < nsigs; j++) +- if (sigismember (&caught_signals, sig[j])) +- signal (sig[j], SIG_DFL); +-#else +- for (j = 0; j < nsigs; j++) +- if (caught_sig[j]) +- signal (sig[j], SIG_DFL); +-#endif ++ signal_restore (); + + /* Act on any signals that arrived before the default was restored. + This can process signals out of order, but there doesn't seem to +@@ -4512,6 +4529,14 @@ put_indicator (const struct bin_str *ind) + if (! used_color) + { + used_color = true; ++ ++ /* If the standard output is a controlling terminal, watch out ++ for signals, so that the colors can be restored to the ++ default state if "ls" is suspended or interrupted. */ ++ ++ if (0 <= tcgetpgrp (STDOUT_FILENO)) ++ signal_init (); ++ + prep_non_filename_text (); + } + +-- +2.13.5 + diff --git a/SOURCES/coreutils-i18n-fold-newline.patch b/SOURCES/coreutils-i18n-fold-newline.patch new file mode 100644 index 0000000..8c3a146 --- /dev/null +++ b/SOURCES/coreutils-i18n-fold-newline.patch @@ -0,0 +1,83 @@ +From 493f1291993a352e47a79fa7471880289df2efc4 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Fri, 3 Feb 2017 12:26:53 +0100 +Subject: [PATCH] fold: preserve new-lines in mutlibyte text (#1418505) + +--- + src/fold.c | 55 +++++++++++++++++++++++++++---------------------------- + 1 file changed, 27 insertions(+), 28 deletions(-) + +diff --git a/src/fold.c b/src/fold.c +index 51abea8..4106f24 100644 +--- a/src/fold.c ++++ b/src/fold.c +@@ -342,39 +342,38 @@ fold_multibyte_text (FILE *istream, size_t width, int *saved_errno) + } + + rescan: +- if (operating_mode == byte_mode) /* byte mode */ ++ if (convfail) ++ increment = 1; ++ else if (wc == L'\n') ++ { ++ /* preserve newline */ ++ fwrite (line_out, sizeof(char), offset_out, stdout); ++ START_NEW_LINE; ++ continue; ++ } ++ else if (operating_mode == byte_mode) /* byte mode */ + increment = mblength; + else if (operating_mode == character_mode) /* character mode */ + increment = 1; +- else /* column mode */ ++ else /* column mode */ + { +- if (convfail) +- increment = 1; +- else ++ switch (wc) + { +- switch (wc) +- { +- case L'\n': +- fwrite (line_out, sizeof(char), offset_out, stdout); +- START_NEW_LINE; +- continue; +- +- case L'\b': +- increment = (column > 0) ? -1 : 0; +- break; +- +- case L'\r': +- increment = -1 * column; +- break; +- +- case L'\t': +- increment = 8 - column % 8; +- break; +- +- default: +- 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; + } + } + +-- +2.13.5 + diff --git a/SPECS/coreutils.spec b/SPECS/coreutils.spec index 88e6478..ffcebd5 100644 --- a/SPECS/coreutils.spec +++ b/SPECS/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 8.22 -Release: 18%{?dist} +Release: 21%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -42,6 +42,12 @@ Patch13: coreutils-8.22-date-emptyTZ.patch #df -l: do not hang on a dead autofs mount point (#1309247) Patch14: coreutils-8.22-df-autofs.patch +# ls: allow interruption when reading slow directories (#1421802) +Patch15: coreutils-8.22-ls-interruption.patch + +# df: do not stat file systems that do not satisfy the -t/-x args (#1511947) +Patch17: coreutils-8.22-df-stat.patch + # Our patches #general patch to workaround koji build system issues Patch100: coreutils-6.10-configuration.patch @@ -72,6 +78,9 @@ Patch713: coreutils-4.5.3-langinfo.patch # (sb) lin18nux/lsb compliance - multibyte functionality patch Patch800: coreutils-i18n.patch +# fold: preserve new-lines in mutlibyte text (#1418505) +Patch801: coreutils-i18n-fold-newline.patch + #getgrouplist() patch from Ulrich Drepper. Patch908: coreutils-getgrouplist.patch #Prevent buffer overflow in who(1) (bug #158405). @@ -207,6 +216,11 @@ the old GNU fileutils, sh-utils, and textutils packages. %patch951 -p1 -b .selinuxman %patch5 -p1 -b .separate +# patches added in RHEL-7.5 +%patch801 -p1 +%patch15 -p1 +%patch17 -p1 + chmod a+x tests/misc/sort-mb-tests.sh tests/df/direct.sh tests/cp/no-ctx.sh tests/dd/stats.sh || : #fix typos/mistakes in localized documentation(#439410, #440056) @@ -430,6 +444,17 @@ fi %{_sbindir}/chroot %changelog +* Mon Dec 04 2017 Kamil Dudka - 8.22-21 +- timeout: revert the last fix for a possible race (#1439465) + +* Thu Nov 23 2017 Kamil Dudka - 8.22-20 +- df: do not stat file systems that do not satisfy the -t/-x args (#1511947) + +* Thu Sep 21 2017 Kamil Dudka - 8.22-19 +- timeout: fix race possibly terminating wrong process (#1439465) +- ls: allow interruption when reading slow directories (#1421802) +- fold: preserve new-lines in mutlibyte text (#1418505) + * Fri Jul 01 2016 Ondrej Vasik - 8.22-18 - fix xfs build failure in chrooted environment (#1263341) - update filesystem lists for stat and tail from latest upstream