diff --git a/165a80f6e6f613d2443f19c87f9511ce2cf9818c.patch b/165a80f6e6f613d2443f19c87f9511ce2cf9818c.patch new file mode 100644 index 0000000000000000000000000000000000000000..de2fc4f166f2933bcbec7cefb657cb699798a398 --- /dev/null +++ b/165a80f6e6f613d2443f19c87f9511ce2cf9818c.patch @@ -0,0 +1,15 @@ +diff --git a/src/who.c b/src/who.c +index abf3bc734..a03927247 100644 +--- a/src/who.c ++++ b/src/who.c +@@ -450,8 +450,8 @@ make_id_equals_comment (STRUCT_UTMP const *utmp_ent) + size_t utmpsize = sizeof UT_ID (utmp_ent); + char *comment = xmalloc (strlen (_("id=")) + utmpsize + 1); + +- strcpy (comment, _("id=")); +- strncat (comment, UT_ID (utmp_ent), utmpsize); ++ char *p = stpcpy (comment, _("id=")); ++ stzncpy (p, UT_ID (utmp_ent), utmpsize); + return comment; + } + diff --git a/beafa5c0a303ce51e62963f6fafb9096ac59cac1.patch b/beafa5c0a303ce51e62963f6fafb9096ac59cac1.patch new file mode 100644 index 0000000000000000000000000000000000000000..29267805057eeb0b7e72c89b54a9723c3d20c2d7 --- /dev/null +++ b/beafa5c0a303ce51e62963f6fafb9096ac59cac1.patch @@ -0,0 +1,85 @@ +diff --git a/NEWS b/NEWS +index efb97e6b0..392d0ce1e 100644 +--- a/NEWS ++++ b/NEWS +@@ -44,6 +44,8 @@ GNU coreutils NEWS -*- outline -*- + file system types. stat -f -c%T now reports the file system type, + and tail -f uses polling for "vboxsf" and inotify for the others. + ++ timeout now supports sub-second timeouts on macOS. ++ + + * Noteworthy changes in release 8.32 (2020-03-05) [stable] + +diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4 +index 08efde330..266235113 100644 +--- a/m4/jm-macros.m4 ++++ b/m4/jm-macros.m4 +@@ -72,7 +72,7 @@ AC_DEFUN([coreutils_MACROS], + # Used by sort.c. + AC_CHECK_FUNCS_ONCE([nl_langinfo]) + # Used by timeout.c +- AC_CHECK_FUNCS_ONCE([setrlimit prctl]) ++ AC_CHECK_FUNCS_ONCE([setitimer setrlimit prctl]) + + # Used by tail.c. + AC_CHECK_FUNCS([inotify_init], +diff --git a/src/timeout.c b/src/timeout.c +index 2b5d930e9..ca6ab87eb 100644 +--- a/src/timeout.c ++++ b/src/timeout.c +@@ -114,14 +114,9 @@ static void + settimeout (double duration, bool warn) + { + +-/* timer_settime() provides potentially nanosecond resolution. +- setitimer() is more portable (to Darwin for example), +- but only provides microsecond resolution and thus is +- a little more awkward to use with timespecs, as well as being +- deprecated by POSIX. Instead we fallback to single second +- resolution provided by alarm(). */ +- + #if HAVE_TIMER_SETTIME ++ /* timer_settime() provides potentially nanosecond resolution. */ ++ + struct timespec ts = dtotimespec (duration); + struct itimerspec its = { {0, 0}, ts }; + timer_t timerid; +@@ -138,8 +133,37 @@ settimeout (double duration, bool warn) + } + else if (warn && errno != ENOSYS) + error (0, errno, _("warning: timer_create")); ++ ++#elif HAVE_SETITIMER ++ /* setitimer() is more portable (to Darwin for example), ++ but only provides microsecond resolution. */ ++ ++ struct timeval tv; ++ struct timespec ts = dtotimespec (duration); ++ tv.tv_sec = ts.tv_sec; ++ tv.tv_usec = (ts.tv_nsec + 999) / 1000; ++ if (tv.tv_usec == 1000 * 1000) ++ { ++ if (tv.tv_sec != TYPE_MAXIMUM (time_t)) ++ { ++ tv.tv_sec++; ++ tv.tv_usec = 0; ++ } ++ else ++ tv.tv_usec--; ++ } ++ struct itimerval it = { {0, 0}, tv }; ++ if (setitimer (ITIMER_REAL, &it, NULL) == 0) ++ return; ++ else ++ { ++ if (warn && errno != ENOSYS) ++ error (0, errno, _("warning: setitimer")); ++ } + #endif + ++ /* fallback to single second resolution provided by alarm(). */ ++ + unsigned int timeint; + if (UINT_MAX <= duration) + timeint = UINT_MAX; diff --git a/coreutils.spec b/coreutils.spec index f5a08aa750f6eecebb0afdb66bc44e9d689578f4..3f98f4ba0e3620cde6790ce6f7ecb80c34cedc88 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,6 +1,6 @@ Name: coreutils Version: 8.32 -Release: 2 +Release: 3 License: GPLv3+ Summary: A set of basic GNU tools commonly used in shell scripts Url: https://www.gnu.org/software/coreutils/ @@ -25,6 +25,8 @@ Patch8: skip-the-tests-that-require-selinux-if-selinux-is-di.patch Patch9: coreutils-8.32-ls-removed-dir.patch Patch10: coreutils-8.32-leaf-opt-xfs.patch +Patch6000: 165a80f6e6f613d2443f19c87f9511ce2cf9818c.patch +Patch6001: beafa5c0a303ce51e62963f6fafb9096ac59cac1.patch Conflicts: filesystem < 3 # To avoid clobbering installs @@ -135,6 +137,9 @@ fi %{_mandir}/man*/* %changelog +* 20201109063007633193 patch-tracking 8.32-3 +- append patch file of upstream repository from <165a80f6e6f613d2443f19c87f9511ce2cf9818c> to + * Wed Aug 26 2020 chenbo pan - 8.32-2 - fix patch error @@ -221,4 +226,4 @@ fi - reintroduce very old Provides (mktemp, sh-utils, textwrap, fileutils, stat) * Thu Jul 12 2018 hexiaowen - 8.30-1 -- Pacakge init +- Pacakge init \ No newline at end of file