From 0a84b64197d0ab3580d33f81d55657cd6bc91732b243bb75ce72bdedc16ccbba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Sat, 15 Mar 2025 14:57:33 +0100 Subject: [PATCH] Sync from SUSE:SLFO:Main psmisc revision c898471b89cedf0d504de0a80f6376cd --- ...to-be-able-to-use-the-mount-identity.patch | 8 +- ...,pstree-use-clock_gettime-not-uptime.patch | 160 ++++++++++++++++++ psmisc-22.21-pstree.patch | 10 +- psmisc-v23.6.tar.bz2 | 3 - psmisc-v23.6.dif => psmisc-v23.7.dif | 2 +- psmisc-v23.7.tar.bz2 | 3 + psmisc.changes | 37 ++++ psmisc.spec | 15 +- 8 files changed, 219 insertions(+), 19 deletions(-) create mode 100644 0001-killall,pstree-use-clock_gettime-not-uptime.patch delete mode 100644 psmisc-v23.6.tar.bz2 rename psmisc-v23.6.dif => psmisc-v23.7.dif (96%) create mode 100644 psmisc-v23.7.tar.bz2 diff --git a/0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch b/0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch index 8e491c0..23cdcd4 100644 --- a/0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch +++ b/0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch @@ -67,10 +67,10 @@ index 723cf02..3599fea 100644 +AC_CHECK_FUNC([name_to_handle_at],[ + AC_DEFINE([HAS_NAME_TO_HANDLE_AT], [1], [System has name_to_handle_at(2) system call])]) + - AC_CHECK_HEADERS([sys/syscall.h]) AC_CHECK_DECLS([SYS_statx], [has_syscall_statx="yes"], -@@ -105,9 +119,9 @@ AC_SUBST([TERMCAP_LIB]) + [has_syscall_statx="no"], +@@ -112,9 +126,9 @@ AC_SUBST([TERMCAP_LIB]) dnl Checks for header files. AC_HEADER_DIRENT @@ -482,7 +482,7 @@ index f2bd3e9..8e4c853 100644 - if (statn(filepath, STATX_INO, &st) != 0) + if (statn(filepath, STATX_INO, &st) != 0) { - if (errno != ENOENT && errno != ENOTDIR) + if (errno != ENOENT && errno != ENOTDIR && errno != EACCES) { @@ -1651,6 +1784,9 @@ static void check_dir( filepath, strerror(errno)); @@ -1123,7 +1123,7 @@ index f2bd3e9..8e4c853 100644 /* * Somehow the realpath(3) glibc function call, nevertheless * it avoids lstat(2) system calls. -@@ -2215,6 +2774,52 @@ char *expandpath( +@@ -2211,6 +2770,52 @@ char *expandpath( } lnkbuf[n] = '\0'; /* Don't be fooled by readlink(2) */ diff --git a/0001-killall,pstree-use-clock_gettime-not-uptime.patch b/0001-killall,pstree-use-clock_gettime-not-uptime.patch new file mode 100644 index 0000000..4c97a33 --- /dev/null +++ b/0001-killall,pstree-use-clock_gettime-not-uptime.patch @@ -0,0 +1,160 @@ +From a146bfc359a4d4d96c438f3a0fa988c6a171d40d Mon Sep 17 00:00:00 2001 +From: Craig Small +Date: Wed, 13 Mar 2024 22:01:07 +1100 +Subject: [PATCH] killall,pstree use clock_gettime not uptime + +/proc/uptime can become a container uptime in LXC containers +but the process start time is still relative to the boot time. + +This means things like "newer than" or "older than" will be incorrect +in some containers, using clock_gettime() fixes this as its always the +hosts boot time. + +References: + https://bugs.debian.org/1066090 + https://gitlab.com/procps-ng/procps/-/commit/b5e19c1730bcc68d553f44b5585704e3c92267bf#83c45d853acc8384452b404946e4a0c484b16a4e + +Signed-off-by: Craig Small +--- + ChangeLog | 4 ++++ + src/killall.c | 39 +++++++++++++++++++-------------------- + src/pstree.c | 39 +++++++++++++++++++-------------------- + 3 files changed, 42 insertions(+), 40 deletions(-) + +diff --git ChangeLog ChangeLog +index 15c5725..f4dcfd2 100644 +--- ChangeLog ++++ ChangeLog +@@ -1,3 +1,7 @@ ++Changes in NEXT ++=============== ++ * killall,pstree: Use gettime instead of uptime Debian 1066090 ++ + Changes in 23.7 + =============== + * build-sys: Make disable-statx work +diff --git src/killall.c src/killall.c +index 81dcc4b..229e61c 100644 +--- src/killall.c ++++ src/killall.c +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + + #ifdef WITH_SELINUX + #include +@@ -132,30 +133,28 @@ ask (char *name, pid_t pid, const int signal) + /* Never should get here */ + } + +-static double +-uptime() +-{ +- char * savelocale; +- char buf[2048]; +- FILE* file; +- if (!(file=fopen( PROC_BASE "/uptime", "r"))) { +- fprintf(stderr, "killall: error opening uptime file\n"); +- exit(1); +- } +- savelocale = setlocale(LC_NUMERIC,"C"); +- if (fscanf(file, "%2047s", buf) == EOF) perror("uptime"); +- fclose(file); +- setlocale(LC_NUMERIC,savelocale); +- return atof(buf); +-} + +-/* process age from jiffies to seconds via uptime */ ++/* process age from jiffies to seconds via uptime ++ * Cannot use /proc/uptime as this can change in containers ++ * but process start time does not ++ */ + static double process_age(const unsigned long long jf) + { ++ struct timespec ts; ++ double sc_clk_tck; + double age; +- double sc_clk_tck = sysconf(_SC_CLK_TCK); +- assert(sc_clk_tck > 0); +- age = uptime() - jf / sc_clk_tck; ++ ++ if (clock_gettime(CLOCK_BOOTTIME, &ts) != 0) { ++ perror("clock_gettime():"); ++ exit(EXIT_FAILURE); ++ } ++ ++ if ( (sc_clk_tck = sysconf(_SC_CLK_TCK)) < 0) { ++ perror("sysconf(CLK_TCK):"); ++ exit(EXIT_FAILURE); ++ } ++ ++ age = (ts.tv_sec + ts.tv_nsec * 1.0e-9) - jf / sc_clk_tck; + if (age < 0L) + return 0L; + return age; +diff --git src/pstree.c src/pstree.c +index 39265d1..2545e24 100644 +--- src/pstree.c ++++ src/pstree.c +@@ -44,6 +44,7 @@ + #include + #include + #include ++#include + + #include "i18n.h" + #include "comm.h" +@@ -1028,30 +1029,28 @@ static void trim_tree_by_parent(PROC * current) + trim_tree_by_parent(parent); + } + +-static double +-uptime() +-{ +- char * savelocale; +- char buf[2048]; +- FILE* file; +- if (!(file=fopen( PROC_BASE "/uptime", "r"))) { +- fprintf(stderr, "pstree: error opening uptime file\n"); +- exit(1); +- } +- savelocale = setlocale(LC_NUMERIC,"C"); +- if (fscanf(file, "%2047s", buf) == EOF) perror("uptime"); +- fclose(file); +- setlocale(LC_NUMERIC,savelocale); +- return atof(buf); +-} + +-/* process age from jiffies to seconds via uptime */ ++/* process age from jiffies to seconds via uptime ++ * Cannot use /proc/uptime as this can change in containers ++ * but process start time does not ++ */ + static double process_age(const unsigned long long jf) + { ++ struct timespec ts; ++ double sc_clk_tck; + double age; +- double sc_clk_tck = sysconf(_SC_CLK_TCK); +- assert(sc_clk_tck > 0); +- age = uptime() - jf / sc_clk_tck; ++ ++ if (clock_gettime(CLOCK_BOOTTIME, &ts) != 0) { ++ perror("clock_gettime():"); ++ exit(EXIT_FAILURE); ++ } ++ ++ if ( (sc_clk_tck = sysconf(_SC_CLK_TCK)) < 0) { ++ perror("sysconf(CLK_TCK):"); ++ exit(EXIT_FAILURE); ++ } ++ ++ age = (ts.tv_sec + ts.tv_nsec * 1.0e-9) - jf / sc_clk_tck; + if (age < 0L) + return 0L; + return age; +-- +2.35.3 + diff --git a/psmisc-22.21-pstree.patch b/psmisc-22.21-pstree.patch index c3213a0..2e28816 100644 --- a/psmisc-22.21-pstree.patch +++ b/psmisc-22.21-pstree.patch @@ -4,7 +4,7 @@ --- src/pstree.c +++ src/pstree.c 2022-12-13 07:46:58.243076344 +0000 -@@ -79,6 +79,7 @@ extern const char *__progname; +@@ -81,6 +81,7 @@ extern const char *__progname; #define UTF_HD "\342\224\254" /* U+252C, Horizontal and down */ #define VT_BEG "\033(0\017" /* use graphic chars */ @@ -12,7 +12,7 @@ #define VT_END "\033(B" /* back to normal char set */ #define VT_V "x" /* see UTF definitions above */ #define VT_VR "t" -@@ -578,6 +579,28 @@ static void out_scontext(const PROC *cur +@@ -594,6 +595,28 @@ static void out_scontext(const PROC *cur out_string("'"); } @@ -41,7 +41,7 @@ static void out_newline(void) { if (last_char && cur_x == output_width) -@@ -817,11 +840,12 @@ dump_tree(PROC * current, int level, int +@@ -833,11 +856,12 @@ dump_tree(PROC * current, int level, int for (lvl = 0; lvl < level; lvl++) { for (i = width[lvl] + 1; i; i--) out_char(' '); @@ -59,7 +59,7 @@ } if (rep < 2) -@@ -931,7 +955,7 @@ dump_tree(PROC * current, int level, int +@@ -947,7 +971,7 @@ dump_tree(PROC * current, int level, int } width[level] = comm_len + cur_x - offset + add; if (cur_x >= output_width && trunc) { @@ -68,7 +68,7 @@ out_string("+"); out_newline(); return; -@@ -955,7 +979,7 @@ dump_tree(PROC * current, int level, int +@@ -971,7 +995,7 @@ dump_tree(PROC * current, int level, int } } if (first) { diff --git a/psmisc-v23.6.tar.bz2 b/psmisc-v23.6.tar.bz2 deleted file mode 100644 index 0151e3a..0000000 --- a/psmisc-v23.6.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:91573ca0a1a50bd491b7c3cbe400126b0dadef9a2e328030d6469bb2448e0794 -size 263463 diff --git a/psmisc-v23.6.dif b/psmisc-v23.7.dif similarity index 96% rename from psmisc-v23.6.dif rename to psmisc-v23.7.dif index e35d647..318120f 100644 --- a/psmisc-v23.6.dif +++ b/psmisc-v23.7.dif @@ -5,7 +5,7 @@ --- configure.ac +++ configure.ac 2022-12-13 07:57:11.751636898 +0000 -@@ -162,7 +162,7 @@ AC_CHECK_MEMBERS([struct user_regs_struc +@@ -169,7 +169,7 @@ AC_CHECK_MEMBERS([struct user_regs_struc struct user_regs_struct.rdi, struct user_regs_struct.rsi, struct user_regs_struct.rdx], [],[], diff --git a/psmisc-v23.7.tar.bz2 b/psmisc-v23.7.tar.bz2 new file mode 100644 index 0000000..5d2fbac --- /dev/null +++ b/psmisc-v23.7.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c4b1df2e671e8194f6c3063e43cb9afa26cbe9859f1026ff6ad258ac562804f4 +size 268418 diff --git a/psmisc.changes b/psmisc.changes index d78360a..ce7175e 100644 --- a/psmisc.changes +++ b/psmisc.changes @@ -1,3 +1,40 @@ +------------------------------------------------------------------- +Tue Feb 18 12:04:10 UTC 2025 - Dr. Werner Fink + +- Looks like Factory and TW includes glibc-gconv-modules-extra at build time + +------------------------------------------------------------------- +Thu Dec 5 12:30:55 UTC 2024 - Adrian Schröter + +- add loongarch64 as peekfd supported arch + +------------------------------------------------------------------- +Mon May 27 11:55:43 UTC 2024 - Dr. Werner Fink + +- Update to 23.7 + * build-sys: Make disable-statx work + * fuser: Fallback to stat() if no statx() Debian 1030747 #48 + * fuser: silently ignore EACCES when scanning proc directories + * killall: small formatting fixes Debian #1037231 + * pstree: Do not assume root PID #49 + * pslog: include config.h #51 !36 + * misc: Update gettext to 0.21 +- Add patch from upstream 0001-killall,pstree-use-clock_gettime-not-uptime.patch +- Port the patches + * 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch + * psmisc-22.21-pstree.patch +- Port patch psmisc-v23.6.dif and rename it to psmisc-v23.7.dif + +------------------------------------------------------------------- +Thu Feb 29 15:01:09 UTC 2024 - Dominique Leuenberger + +- Use %patch -P N instead of deprecated %patchN. + +------------------------------------------------------------------- +Mon Oct 23 13:36:04 UTC 2023 - Dr. Werner Fink + +- Fix version at configure time as there was no .tarball-version + ------------------------------------------------------------------- Thu Feb 16 16:06:59 UTC 2023 - Ludwig Nussel diff --git a/psmisc.spec b/psmisc.spec index 4c788a3..eaa68c6 100644 --- a/psmisc.spec +++ b/psmisc.spec @@ -1,7 +1,7 @@ # # spec file for package psmisc # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -33,7 +33,7 @@ BuildRequires: netcat-openbsd BuildRequires: pkgconfig(libapparmor) %endif URL: https://gitlab.com/psmisc/psmisc/ -Version: 23.6 +Version: 23.7 Release: 0 Provides: ps:/usr/bin/killall Summary: Utilities for managing processes on your system @@ -41,12 +41,13 @@ License: GPL-2.0-or-later Group: System/Monitoring Source: https://gitlab.com/%{name}/%{name}/-/archive/v%{version}/%{name}-v%{version}.tar.bz2 Patch0: %{name}-v%{version}.dif +Patch1: 0001-killall,pstree-use-clock_gettime-not-uptime.patch Patch2: %{name}-22.21-pstree.patch # PATCH-ADD-SUSE boo#908068, boo#1046237, boo#1046237 # https://gitlab.com/bitstreamout/psmisc/tree/mountinfo Patch3: 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch -%define have_peekfd %ix86 x86_64 ppc ppc64 ppc64le %arm mipsel m68k aarch64 +%define have_peekfd %ix86 x86_64 ppc ppc64 ppc64le %arm mipsel m68k aarch64 loongarch64 %description The psmisc package contains utilities for managing processes on your @@ -60,9 +61,10 @@ processes that are using specified files or filesystems. %prep %setup -q -n %{name}-v%{version} -%patch2 -p0 -b .pstree -%patch3 -p0 -b .mntinf -%patch0 -p0 -b .p0 +%patch -P 1 -p0 -b .uptime +%patch -P 2 -p0 -b .pstree +%patch -P 3 -p0 -b .mntinf +%patch -P 0 -p0 -b .p0 %build grep -h src/ po/*.po|\ @@ -70,6 +72,7 @@ grep -h src/ po/*.po|\ tr ' ' '\n'|\ sort -t : -k1,1 -u|\ sed -r 's/:[0-9]+$//' > po/POTFILES.in +echo %version > .tarball-version autoreconf -fi CFLAGS="-D_GNU_SOURCE -D_DEFAULT_SOURCE ${RPM_OPT_FLAGS} -pipe -fPIE" CXXFLAGS="$CFLAGS"