From 37c40d7a19d28cf7cd006b1af7ecda62307d38bf Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Tue, 16 Nov 2021 10:34:08 +0100 Subject: [PATCH] coreutils: fix uptime command coreutils doesn't handle absent utmp files fix #6405 --- sys-apps/coreutils/coreutils-9.0.recipe | 3 +- .../coreutils/patches/coreutils-9.0.patchset | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/sys-apps/coreutils/coreutils-9.0.recipe b/sys-apps/coreutils/coreutils-9.0.recipe index 116db5072..a46aea72a 100644 --- a/sys-apps/coreutils/coreutils-9.0.recipe +++ b/sys-apps/coreutils/coreutils-9.0.recipe @@ -17,7 +17,7 @@ uptime users vdir wc who whoami yes" HOMEPAGE="https://www.gnu.org/software/coreutils/" COPYRIGHT="1994-2017 Free Software Foundation, Inc." LICENSE="GNU GPL v3" -REVISION="5" +REVISION="6" SOURCE_URI="https://ftpmirror.gnu.org/coreutils/coreutils-$portVersion.tar.xz https://ftp.gnu.org/gnu/coreutils/coreutils-$portVersion.tar.xz" CHECKSUM_SHA256="ce30acdf4a41bc5bb30dd955e9eaa75fa216b4e3deb08889ed32433c7b3b97ce" @@ -154,6 +154,7 @@ fi BUILD_PREREQUIRES=" haiku${secondaryArchSuffix}_devel cmd:awk + cmd:cmp cmd:gcc$secondaryArchSuffix cmd:grep cmd:help2man diff --git a/sys-apps/coreutils/patches/coreutils-9.0.patchset b/sys-apps/coreutils/patches/coreutils-9.0.patchset index 7312a7324..e4228a8f7 100644 --- a/sys-apps/coreutils/patches/coreutils-9.0.patchset +++ b/sys-apps/coreutils/patches/coreutils-9.0.patchset @@ -697,3 +697,40 @@ index c7eb740..dde3e4b 100644 -- 2.30.2 +From ce0ad419f18d006929850e56b6fd2d50f1857789 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 16 Nov 2021 10:22:30 +0100 +Subject: [PATCH] uptime: make utmp error not critical + +--- + src/uptime.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/uptime.c b/src/uptime.c +index fc0f0a5..779fc09 100644 +--- a/src/uptime.c ++++ b/src/uptime.c +@@ -105,7 +105,7 @@ print_uptime (size_t n, const STRUCT_UTMP *this) + #if HAVE_UTMPX_H || HAVE_UTMP_H + /* Loop through all the utmp entries we just read and count up the valid + ones, also in the process possibly gleaning boottime. */ +- while (n--) ++ while (this && n--) + { + entries += IS_USER_PROCESS (this); + if (UT_TYPE_BOOT_TIME (this)) +@@ -181,7 +181,11 @@ uptime (char const *filename, int options) + + #if HAVE_UTMPX_H || HAVE_UTMP_H + if (read_utmp (filename, &n_users, &utmp_buf, options) != 0) ++#if HAVE_OS_H ++ ; ++#else + die (EXIT_FAILURE, errno, "%s", quotef (filename)); ++#endif + #endif + + print_uptime (n_users, utmp_buf); +-- +2.30.2 +