sys-process/procps: Sync with Gentoo

It's from Gentoo commit 7ff8998d7604312e22484ba4518fe8e0efccf55b.
This commit is contained in:
Flatcar Buildbot 2025-06-30 07:15:08 +00:00
parent a58a68cb6e
commit 0a9414f461
10 changed files with 302 additions and 234 deletions

View File

@ -1,2 +1,2 @@
DIST procps-ng-3.3.17.tar.xz 1008428 BLAKE2B 43aa1a21d4f0725b1c02457f343cf1fc66bc1771b25c6eaf689c9775c190e90545bfac1729f027abc4d3d13de37ffac4828554b5b25e12bcf6af9540de1695f3 SHA512 59e9a5013430fd9da508c4655d58375dc32e025bb502bb28fb9a92a48e4f2838b3355e92b4648f7384b2050064d17079bf4595d889822ebb5030006bc154a1a7
DIST procps-ng-4.0.4.tar.xz 1401540 BLAKE2B 63b972666ef9e92042be96739ffa15c787d0346b2d3ffcb0d240b0a4e999dc90024b2c5b058df683dd9d2c436ceb812abd0b115cc877a6ca1023988b86de443f SHA512 94375544e2422fefc23d7634063c49ef1be62394c46039444f85e6d2e87e45cfadc33accba5ca43c96897b4295bfb0f88d55a30204598ddb26ef66f0420cefb4
DIST procps-ng-4.0.5.tar.xz 1517672 BLAKE2B 4b273ac7737202147fbf392995da1c5ff385df2b53ad84180b6412dc45c2a671e81d7659c0a5824c0d8c19fa37cbf2e58b0545841c74399b3717a9f27fd26c23 SHA512 c27730743210cf850c4af98e1fb81bc8ee8d550b07b9eedb34a5b9d661263d0f1bc92c4e73802a0ed8d4405854aef4bc542bff283c28e8fbb6dabb967f9e4359

View File

@ -1,47 +0,0 @@
https://bugs.gentoo.org/583036
http://www.freelists.org/post/procps/Patch-Test-suite-fails-if-procpidsmaps-is-absent,1
From: tobbs@opentrash.com
To: procps@freelists.org
Date: Sun, 11 Sep 2016 15:01:29 +0200
Subject: [procps] [Patch] Test suite fails if /proc/<pid>/smaps is absent
Message-Id: <20160911130129.9A8B3322A81@astra4649.startdedicated.de>
Summary: Some Linux systems do not have /proc/<pid>/smaps, hence the test
suite fails. Attached a patch to skip tests in that case it.
When pmap is called with either -c, -x, or -x it tries to read
/proc/<pid>/smaps (pmap.c, l. 540). If not present it exits.
The file /proc/<pid>/smaps exits on Linux systems only if the kernel is
compiled with the option CONFIG_PROC_PAGE_MONITOR (see man page proc(5)).
In the test suite some tests check the output of pmap -X et al, but they
fail if /proc/<pid>/smaps is not present, because pmap does not produce
their expected output.
Attached a patch which checks if /proc/<pid>/smaps exits, if not it
skipps the test related to it.
Note: It is unclear what the 'expected' behaviour/output of pmap should
be if the file /proc/<pid>/smaps is not present. Maybe add an additional
test to check the return code if /proc/<pid>/smaps is absent.
--- a/testsuite/pmap.test/pmap.exp
+++ b/testsuite/pmap.test/pmap.exp
@@ -45,6 +45,11 @@
spawn $pmap -qd $mypid
expect_table $test $pmap_procname $pmap_device_items "\$"
+if { [ file readable "/proc/self/smaps" ] == 0 } {
+ unsupported "Skipping test which require pmap to access /proc/<pid>/smaps, because kernel seems to be compiled without CONFIG_PROC_PAGE_MONITOR."
+
+} else {
+
set test "pmap extended output"
spawn $pmap -x $mypid
expect_table $test $pmap_ext_header $pmap_ext_items $pmap_ext_footer
@@ -66,3 +71,4 @@
spawn $pmap -XX 1
expect_pass $test "$pmap_initname\$"
+}

View File

@ -1,78 +0,0 @@
Temporary stopgap patch (a different solution was used upstream
in the next release, should be in the next after 3.3.17 -- we'll need to
add --disable-w instead).
https://bugs.gentoo.org/794997
From 7bfe2b7c12b33aabca71491360c433d2d3f7bbf4 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Wed, 24 Feb 2021 21:14:31 +0000
Subject: [PATCH 1/2] w.c: correct musl builds
No need to redefine UT_ stuff to something that does not exist.
UT_ is already provided in musl but via utmp.h header, so include
it always.
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
w.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/w.c b/w.c
index 9d07ac9e..d10639b8 100644
--- a/w.c
+++ b/w.c
@@ -57,9 +57,8 @@
#include <unistd.h>
#ifdef HAVE_UTMPX_H
# include <utmpx.h>
-#else
-# include <utmp.h>
#endif
+#include <utmp.h>
#include <arpa/inet.h>
static int ignoreuser = 0; /* for '-u' */
@@ -72,12 +71,6 @@ typedef struct utmpx utmp_t;
typedef struct utmp utmp_t;
#endif
-#if !defined(UT_HOSTSIZE) || defined(__UT_HOSTSIZE)
-# define UT_HOSTSIZE __UT_HOSTSIZE
-# define UT_LINESIZE __UT_LINESIZE
-# define UT_NAMESIZE __UT_NAMESIZE
-#endif
-
#ifdef W_SHOWFROM
# define FROM_STRING "on"
#else
--
GitLab
From 145165aba6c659f3f0f3567a323a3e6170408ea6 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Wed, 24 Feb 2021 21:16:14 +0000
Subject: [PATCH 2/2] proc/escape.c: add missing include
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
proc/escape.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/proc/escape.c b/proc/escape.c
index 2e8fb7dd..e1f4612d 100644
--- a/proc/escape.c
+++ b/proc/escape.c
@@ -21,6 +21,7 @@
#include <sys/types.h>
#include <string.h>
#include <limits.h>
+#include <langinfo.h>
#include "procps.h"
#include "escape.h"
#include "readproc.h"
--
GitLab

View File

@ -0,0 +1,34 @@
https://gitlab.com/procps-ng/procps/-/merge_requests/256
From 2cc229991d2c89c93d58d7ad4bc30fd272d8e2df Mon Sep 17 00:00:00 2001
Message-ID: <2cc229991d2c89c93d58d7ad4bc30fd272d8e2df.1750118248.git.sam@gentoo.org>
From: Sam James <sam@gentoo.org>
Date: Tue, 17 Jun 2025 00:56:23 +0100
Subject: [PATCH] testsuite: only test freetop if we built it
It's not built if configured with --without-ncurses. Similar to
aa85fb458a295135d8283cd5ffacfe8198cdae22.
Signed-off-by: Sam James <sam@gentoo.org>
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -21,7 +21,7 @@ DEJATOOL += \
if !CYGWIN
if WITH_NCURSES
-DEJATOOL += slabtop
+DEJATOOL += slabtop hugetop
endif
DEJATOOL += sysctl
@@ -37,7 +37,6 @@ endif
DEJATOOL += \
free \
- hugetop \
lib \
pgrep \
pkill \
--
2.50.0

View File

@ -0,0 +1,28 @@
https://gitlab.com/procps-ng/procps/-/commit/2dc340e47669e0b0df7f71ff082e05ac5fa36615
From 2dc340e47669e0b0df7f71ff082e05ac5fa36615 Mon Sep 17 00:00:00 2001
From: Rui Chen <rui@chenrui.dev>
Date: Thu, 26 Dec 2024 11:09:18 -0500
Subject: [PATCH] local/signals.c: guard `SIGPOLL` to fix build on macOS
Signed-off-by: Rui Chen <rui@chenrui.dev>
---
local/signals.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/local/signals.c b/local/signals.c
index 6d68c07d..12656796 100644
--- a/local/signals.c
+++ b/local/signals.c
@@ -125,7 +125,9 @@ static const mapstruct sigtable[] = {
{"VTALRM", SIGVTALRM},
{"PROF", SIGPROF},
{"WINCH", SIGWINCH},
+#ifdef SIGPOLL
{"POLL", SIGPOLL}, // in SUSv3, prioritize over IO
+#endif
#ifdef SIGIO
{"IO", SIGIO}, // possibly = POLL
#endif
--
GitLab

View File

@ -0,0 +1,57 @@
https://bugs.gentoo.org/911375
https://gitlab.com/procps-ng/procps/-/commit/90a0ddcd64c2d43dc2c2c856b1b42b5cae6b8a44
From 90a0ddcd64c2d43dc2c2c856b1b42b5cae6b8a44 Mon Sep 17 00:00:00 2001
From: Markus Mayer <mmayer@broadcom.com>
Date: Wed, 11 Dec 2024 14:53:33 -0800
Subject: [PATCH] pgrep: provide definition for __NR_pidfd_open if needed
We already implement pidfd_open() ourselves if libc doesn't provide it.
Let's also provide our own definition of __NR_pidfd_open in case the
kernel headers don't contain it.
This way, pgrep can provide its full capabilities after being built
against older kernel headers (for increased compatibility) but being run
on systems with newer kernels.
Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
configure.ac | 2 +-
src/pgrep.c | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 1e984b12..14ba3ad7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -325,7 +325,7 @@ AS_IF([[test "x$enable_pidwait" = xyes -a "x$have_pidfd_open" = xno]],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <sys/syscall.h>
#ifndef __NR_pidfd_open
-#error __NR_pidfd_open not defined
+#warning __NR_pidfd_open not defined; using our definition
#endif
])],
AC_MSG_RESULT([yes]),
diff --git a/src/pgrep.c b/src/pgrep.c
index 2c6b06b8..6fc25dd4 100644
--- a/src/pgrep.c
+++ b/src/pgrep.c
@@ -874,6 +874,15 @@ static int signal_option(int *argc, char **argv)
}
#if defined(ENABLE_PIDWAIT) && !defined(HAVE_PIDFD_OPEN)
+
+#ifndef __NR_pidfd_open
+#ifdef __alpha__
+#define __NR_pidfd_open 544
+#else
+#define __NR_pidfd_open 434
+#endif
+#endif
+
static int pidfd_open (pid_t pid, unsigned int flags)
{
return syscall(__NR_pidfd_open, pid, flags);
--
GitLab

View File

@ -1,8 +1,9 @@
--- procps-ng-3.3.11-orig/sysctl.8
+++ procps-ng-3.3.11/sysctl.8
@@ -123,21 +123,21 @@
\fB\-V\fR, \fB\-\-version\fR
Display version information and exit.
https://bugs.gentoo.org/565304
--- a/man/sysctl.8
+++ b/man/sysctl.8
@@ -177,21 +177,21 @@ skipped by \fBsysctl\fR using the \fB\-\-all\fR option.
This parameter returns no value but flushes per-cpu vm statistics.
.SH EXAMPLES
-/sbin/sysctl \-a
+/usr/sbin/sysctl \-a
@ -25,8 +26,8 @@
-/sbin/sysctl \-a \-\-pattern 'net.ipv4.conf.(eth|wlan)0.arp'
+/usr/sbin/sysctl \-a \-\-pattern 'net.ipv4.conf.(eth|wlan)0.arp'
.br
-/sbin/sysctl \-\-system \-\-pattern '^net.ipv6'
+/usr/sbin/sysctl \-\-system \-\-pattern '^net.ipv6'
.SH DEPRECATED PARAMETERS
The
.B base_reachable_time
-/sbin/sysctl \-\-pattern '\[char94]net.ipv6' \-\-system
+/usr/sbin/sysctl \-\-pattern '\[char94]net.ipv6' \-\-system
.SH SEE ALSO
.BR proc (5),
.BR sysctl.conf (5),

View File

@ -0,0 +1,39 @@
https://bugs.gentoo.org/958286
https://gitlab.com/procps-ng/procps/-/commit/c7498168cfdcf566519d8c46bd26c1be42f2e3f3
From c7498168cfdcf566519d8c46bd26c1be42f2e3f3 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Mon, 26 May 2025 00:00:00 -0500
Subject: [PATCH] top: fix vulnerability with legacy configuration files
Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/384
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
src/top/top.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/top/top.c b/src/top/top.c
index c55b08f0..eef3b219 100644
--- a/src/top/top.c
+++ b/src/top/top.c
@@ -4015,10 +4015,12 @@ static int config_wins (FILE *fp, char *buf, int wix) {
if (1 != fscanf(fp, "%3s\tfieldscur=", w->rc.winname))
return 0;
- if (Rc.id < RCF_XFORMED_ID)
- fscanf(fp, "%s\n", buf );
- else {
- for (x = 0; ; x++)
+ if (Rc.id < RCF_XFORMED_ID) {
+ fscanf(fp, "%100s\n", buf ); // buf size = LRGBUFSIZ (512)
+ if (strlen(buf) >= sizeof(CVT_FORMER)) // but if we exceed max of 86
+ return 0; // that rc file was corrupted
+ } else {
+ for (x = 0; x < PFLAGSSIZ; x++)
if (1 != fscanf(fp, "%d", &w->rc.fieldscur[x]))
break;
}
--
GitLab

View File

@ -1,98 +0,0 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# See https://bugs.gentoo.org/835813 before bumping to 4.x!
inherit flag-o-matic multilib-minimal usr-ldscript
DESCRIPTION="Standard informational utilities and process-handling tools"
HOMEPAGE="http://procps-ng.sourceforge.net/ https://gitlab.com/procps-ng/procps"
SRC_URI="https://downloads.sourceforge.net/${PN}-ng/${PN}-ng-${PV}.tar.xz"
LICENSE="GPL-2"
SLOT="0/8" # libprocps.so
KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
IUSE="elogind +kill modern-top +ncurses nls selinux static-libs systemd test unicode"
RESTRICT="!test? ( test )"
DEPEND="
elogind? ( sys-auth/elogind )
ncurses? ( >=sys-libs/ncurses-5.7-r7:=[unicode(+)?] )
selinux? ( sys-libs/libselinux[${MULTILIB_USEDEP}] )
systemd? ( sys-apps/systemd[${MULTILIB_USEDEP}] )
"
BDEPEND="
elogind? ( virtual/pkgconfig )
ncurses? ( virtual/pkgconfig )
systemd? ( virtual/pkgconfig )
test? ( dev-util/dejagnu )
"
RDEPEND="${DEPEND}
kill? (
!sys-apps/coreutils[kill]
!sys-apps/util-linux[kill]
)
!<app-i18n/man-pages-l10n-4.2.0-r1
!<app-i18n/man-pages-de-2.12-r1
!<app-i18n/man-pages-pl-0.7-r1
"
# https://bugs.gentoo.org/898830
QA_CONFIG_IMPL_DECL_SKIP=( makedev )
PATCHES=(
"${FILESDIR}"/${PN}-3.3.11-sysctl-manpage.patch # 565304
"${FILESDIR}"/${PN}-3.3.12-proc-tests.patch # 583036
)
src_prepare() {
default
# Please drop this after 3.3.17 and instead use --disable-w on musl.
# bug #794997
use elibc_musl && eapply "${FILESDIR}"/${PN}-3.3.17-musl-fix.patch
}
multilib_src_configure() {
# http://www.freelists.org/post/procps/PATCH-enable-transparent-large-file-support
append-lfs-flags #471102
local myeconfargs=(
$(multilib_native_use_with elogind) # No elogind multilib support
$(multilib_native_use_enable kill)
$(multilib_native_use_enable modern-top)
$(multilib_native_use_with ncurses)
$(use_enable nls)
$(use_enable selinux libselinux)
$(use_enable static-libs static)
$(use_with systemd)
$(use_enable unicode watch8bit)
)
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
}
multilib_src_test() {
emake check </dev/null #461302
}
multilib_src_install() {
default
dodoc "${S}"/sysctl.conf
if multilib_is_native_abi ; then
dodir /bin
mv "${ED}"/usr/bin/ps "${ED}"/bin/ || die
if use kill ; then
mv "${ED}"/usr/bin/kill "${ED}"/bin/ || die
fi
gen_usr_ldscript -a procps
fi
}
multilib_src_install_all() {
einstalldocs
find "${ED}" -type f -name '*.la' -delete || die
}

View File

@ -0,0 +1,132 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools flag-o-matic multilib-minimal toolchain-funcs
DESCRIPTION="Standard informational utilities and process-handling tools"
HOMEPAGE="https://gitlab.com/procps-ng/procps"
# Per e.g. https://gitlab.com/procps-ng/procps/-/releases/v4.0.5, the dist tarballs
# are still hosted on SF.
SRC_URI="https://downloads.sourceforge.net/${PN}-ng/${PN}-ng-${PV}.tar.xz"
S="${WORKDIR}"/${PN}-ng-${PV}
# See bug #913210
LICENSE="GPL-2+ LGPL-2+ LGPL-2.1+"
SLOT="0/1-ng"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
IUSE="elogind +kill modern-top +ncurses nls selinux static-libs skill systemd test unicode"
RESTRICT="!test? ( test )"
DEPEND="
elogind? ( sys-auth/elogind )
elibc_musl? ( sys-libs/error-standalone )
ncurses? ( >=sys-libs/ncurses-5.7-r7:=[unicode(+)?] )
selinux? ( sys-libs/libselinux[${MULTILIB_USEDEP}] )
systemd? ( sys-apps/systemd[${MULTILIB_USEDEP}] )
"
RDEPEND="
${DEPEND}
!<app-i18n/man-pages-l10n-4.2.0-r1
!<app-i18n/man-pages-de-2.12-r1
!<app-i18n/man-pages-pl-0.7-r1
!<app-i18n/man-pages-zh_CN-1.6.4.2
kill? (
!sys-apps/coreutils[kill]
!sys-apps/util-linux[kill]
)
"
BDEPEND="
elogind? ( virtual/pkgconfig )
elibc_musl? ( virtual/pkgconfig )
ncurses? ( virtual/pkgconfig )
systemd? ( virtual/pkgconfig )
test? ( dev-util/dejagnu )
"
# bug #898830
QA_CONFIG_IMPL_DECL_SKIP=( makedev )
PATCHES=(
"${FILESDIR}"/${PN}-4.0.4-xfail-pmap-test.patch
"${FILESDIR}"/${PN}-4.0.5-sysctl-manpage.patch # bug #565304
"${FILESDIR}"/${PN}-4.0.5-fix-tests-multilib.patch
"${FILESDIR}"/${PN}-4.0.5-top-legacy-config-vuln.patch # bug #958286
"${FILESDIR}"/${PN}-4.0.5-macos.patch
"${FILESDIR}"/${PN}-4.0.5-pgrep-old-linux-headers.patch # bug #911375
)
src_prepare() {
default
# Only needed for fix-tests-multilib.patch and pgrep-old-linux-headers.patch
eautoreconf
}
multilib_src_configure() {
# http://www.freelists.org/post/procps/PATCH-enable-transparent-large-file-support
# bug #471102
append-lfs-flags
# Workaround for bug #947680, can be dropped w/ >4.0.5
if use elibc_musl ; then
append-cflags "$($(tc-getPKG_CONFIG) --cflags error-standalone)"
append-libs "$($(tc-getPKG_CONFIG) --libs error-standalone)"
fi
local myeconfargs=(
# No elogind multilib support
$(multilib_native_use_with elogind)
$(multilib_native_use_enable kill)
$(multilib_native_use_enable modern-top)
$(multilib_native_enable pidof)
$(multilib_native_enable pidwait)
$(multilib_native_use_with ncurses)
# bug #794997
$(multilib_native_use_enable !elibc_musl w)
$(use_enable nls)
$(use_enable selinux libselinux)
$(use_enable static-libs static)
$(use_with systemd)
$(use_enable skill)
)
if use ncurses; then
# Only pass whis when we are building the 'watch' command
myeconfargs+=( $(multilib_native_use_enable unicode watch8bit) )
fi
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
}
multilib_src_test() {
local ps="${BUILD_DIR}/src/ps/pscommand"
if [[ $("${ps}" --no-headers -o cls -q $$) == IDL ]]; then
# bug #708230
ewarn "Skipping tests due to SCHED_IDLE"
else
# bug #461302
emake check </dev/null
fi
}
multilib_src_install() {
default
dodoc "${S}"/sysctl.conf
if multilib_is_native_abi; then
# We keep ps and kill in /bin per bug #565304.
dodir /bin
mv "${ED}"/usr/bin/ps "${ED}"/bin/ || die
if use kill; then
mv "${ED}"/usr/bin/kill "${ED}"/bin/ || die
fi
fi
}
multilib_src_install_all() {
einstalldocs
find "${ED}" -type f -name '*.la' -delete || die
}