diff --git a/backport-uptime-fix-output-on-60-seconds.patch b/backport-uptime-fix-output-on-60-seconds.patch new file mode 100644 index 0000000000000000000000000000000000000000..2ba776e8dc32bafd3aca0c55d0d6d9c31b41f1e7 --- /dev/null +++ b/backport-uptime-fix-output-on-60-seconds.patch @@ -0,0 +1,33 @@ +From bfb0eadc38e789737dec7f14dd7a7ac00f5f0761 Mon Sep 17 00:00:00 2001 +From: Robert Malz +Date: Thu, 21 Sep 2023 16:45:49 +1000 +Subject: [PATCH] uptime: fix output on 60 seconds + +When procps_uptime will return 60 seconds uptime -p will not +provide any output except "up". To stay consistent with other +time units the expected output is "up 0 minutes". + +References: + #302 + +Signed-off-by: Craig Small +--- + library/uptime.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletion(-) + +diff --git a/library/uptime.c b/library/uptime.c +index b41538f5..5faeefca 100644 +--- a/library/uptime.c ++++ b/library/uptime.c +@@ -258,7 +258,7 @@ PROCPS_EXPORT char *procps_uptime_sprint_short(void) + comma += 1; + } + +- if (upminutes || (!upminutes && uptime_secs < 60)) { ++ if (upminutes || (!upminutes && uptime_secs <= 60)) { + pos += sprintf(shortbuf + pos, "%s%d %s", + comma > 0 ? ", " : "", upminutes, + upminutes != 1 ? "minutes" : "minute"); +-- +GitLab + diff --git a/procps-ng.spec b/procps-ng.spec index 9ab0dacf560ffc06df30bc8fd79e6b0afcac194e..1b858bb6a05e4032f0180eb4066f57287118b56c 100644 --- a/procps-ng.spec +++ b/procps-ng.spec @@ -1,6 +1,6 @@ Name: procps-ng Version: 4.0.4 -Release: 2 +Release: 3 Summary: Utilities that provide system information. License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ URL: https://sourceforge.net/projects/procps-ng/ @@ -12,6 +12,7 @@ Source2: README.top Patch1: openeuler-add-M-and-N-options-for-top.patch Patch2: openeuler-top-exit-with-error-when-pid-overflow.patch Patch3: backport-library-address-remaining-cpu-distortions-stat-api.patch +Patch4: backport-uptime-fix-output-on-60-seconds.patch BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel @@ -94,6 +95,9 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof %{_mandir}/man* %changelog +* Tue Apr 23 2024 yinyongkang - 4.0.4-3 +- uptime: fix output on 60 seconds + * Tue Apr 02 2024 Liu Chao - 4.0.4-2 - library: address remaining cpu distortions, api