From 55c3d7574d748e4c5623e96411123260b4bed6a1 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Fri, 28 Jul 2023 12:54:00 +0200 Subject: [PATCH] sys-process/psmisc: Sync with Gentoo It's from Gentoo commit ebc12de27cef5884b3fc9bb1c7b5689dfb5d0147. --- .../sys-process/psmisc/Manifest | 2 + ...c-23.5-fix-killall-pidfd_send_signal.patch | 40 ++++++++++ .../sys-process/psmisc/metadata.xml | 15 ++-- .../sys-process/psmisc/psmisc-23.4-r1.ebuild | 25 +++++-- .../sys-process/psmisc/psmisc-23.5.ebuild | 73 +++++++++++++++++++ .../sys-process/psmisc/psmisc-23.6.ebuild | 68 +++++++++++++++++ 6 files changed, 208 insertions(+), 15 deletions(-) create mode 100644 sdk_container/src/third_party/portage-stable/sys-process/psmisc/files/psmisc-23.5-fix-killall-pidfd_send_signal.patch create mode 100644 sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.5.ebuild create mode 100644 sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.6.ebuild diff --git a/sdk_container/src/third_party/portage-stable/sys-process/psmisc/Manifest b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/Manifest index ed6b89da29..f8c7653711 100644 --- a/sdk_container/src/third_party/portage-stable/sys-process/psmisc/Manifest +++ b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/Manifest @@ -1 +1,3 @@ DIST psmisc-23.4.tar.xz 370000 BLAKE2B e762171c4d3252421a49b352fadb3e892f66862f003a313a0cc692f973364b06d2652a51d331314462784d94ad55189e74c4d7a023d5d7c917c5e5c05009f46b SHA512 b05781fdb283a6f132bd385d64437f8080e6bc0e11cd2e3e02227678682bb67b3c89edec34a6d067d77312811d072dc60b47ebb32b168c4c69bbc36df643a471 +DIST psmisc-23.5.tar.xz 394012 BLAKE2B 258b82c9fff3765f33cdcd4150489b3e585a47b9065b1cb4f5b432bea4aa7766aab15b160cfb948df9e835c7ac09a9f185d663ab1cd376bedea53bdaf73fd776 SHA512 e908220350491a595ceaf96025a9aa14d832cacc8901545d0864152053fedaf9dc10f45fb2870aa2a00e4d9d8947243038357e14a82b04ab5d20c53e7f841a8d +DIST psmisc-23.6.tar.xz 424736 BLAKE2B 468bf4e84695efcedb832f890b6201b7bc4aca7c5aabaf30e67f4471671421897ee7cd67f01d4b3d60c3e1c63752eb7384e627e75fa7db290cd749da08e2f788 SHA512 4daffbd1726e50d9344f8578dd4c10f0b8f7971929ec667490de31122e5f3828747e1bafb3ed3c37ed7e1758ab9ec43b8f4556b676a416a8efbc7c6c88b6985d diff --git a/sdk_container/src/third_party/portage-stable/sys-process/psmisc/files/psmisc-23.5-fix-killall-pidfd_send_signal.patch b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/files/psmisc-23.5-fix-killall-pidfd_send_signal.patch new file mode 100644 index 0000000000..0fc9c30a96 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/files/psmisc-23.5-fix-killall-pidfd_send_signal.patch @@ -0,0 +1,40 @@ +https://gitlab.com/psmisc/psmisc/-/commit/6892e321e7042e3df60a5501a1c59d076e8a856f + +From 6892e321e7042e3df60a5501a1c59d076e8a856f Mon Sep 17 00:00:00 2001 +From: Craig Small +Date: Mon, 18 Jul 2022 20:16:42 +1000 +Subject: [PATCH] killall: use kill if pidfd_send_signal() fails + +The pidfd_send_signal() system call appeared in Linux 5.1 +If psmisc is build on a system before then, or a non-Linux +system, then kill() is used instead. However if psmisc is +built on a Linux >= 5.1 system but run on a < 5.1 Linux +system the system call fails and killall doesn't work. + +The fix, as proposed by Peter T. Breuer, is to try +pidfd_send_signal() and if the return value is < 0 and +errno is ENOSYS then we know at runtime the system call +failed and we fall through to trusty old kill(). + +Note, this means that killall on systems below 5.1 still +have the race PID condition that the pidfd calls fix. + +References: + https://bugs.debian.org/1015228 +--- a/src/killall.c ++++ b/src/killall.c +@@ -326,7 +326,12 @@ my_send_signal( + { + #ifdef __NR_pidfd_send_signal + if (pid > 0) /* Not PGID */ +- return syscall(__NR_pidfd_send_signal, pidfd, sig, NULL, 0); ++ { ++ int ret = syscall(__NR_pidfd_send_signal, pidfd, sig, NULL, 0); ++ if (ret >= 0 || errno != ENOSYS) ++ return ret; ++ // fall through if no such syscall ++ } + #endif + return kill(pid, sig); + } +GitLab diff --git a/sdk_container/src/third_party/portage-stable/sys-process/psmisc/metadata.xml b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/metadata.xml index 5da9d3e987..2bdf8de904 100644 --- a/sdk_container/src/third_party/portage-stable/sys-process/psmisc/metadata.xml +++ b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/metadata.xml @@ -1,11 +1,12 @@ - - base-system@gentoo.org - Gentoo Base System - - - psmisc - + + base-system@gentoo.org + Gentoo Base System + + + psmisc/psmisc + psmisc + diff --git a/sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.4-r1.ebuild b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.4-r1.ebuild index 8f354d0fbc..d878cf0a93 100644 --- a/sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.4-r1.ebuild +++ b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.4-r1.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 @@ -11,16 +11,22 @@ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz" LICENSE="GPL-2" SLOT="0" -KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux" -IUSE="ipv6 nls selinux X" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux" +IUSE="ipv6 nls selinux test X" +RESTRICT="!test? ( test )" -RDEPEND="!=app-i18n/man-pages-l10n-4.0.0-r0 - >=sys-libs/ncurses-5.7-r7:0= +RDEPEND=" + !=app-i18n/man-pages-l10n-4.0.0-r0 + >=sys-libs/ncurses-5.7-r7:= nls? ( virtual/libintl ) - selinux? ( sys-libs/libselinux )" + selinux? ( sys-libs/libselinux ) +" DEPEND="${RDEPEND}" -BDEPEND=">=sys-devel/libtool-2.2.6b - nls? ( sys-devel/gettext )" +BDEPEND=" + >=sys-devel/libtool-2.2.6b + nls? ( sys-devel/gettext ) + test? ( dev-util/dejagnu ) +" DOCS=( AUTHORS ChangeLog NEWS README ) @@ -40,6 +46,9 @@ src_configure() { ac_cv_func_realloc_0_nonnull=yes fi + # bug #802414 + touch testsuite/global-conf.exp || die + local myeconfargs=( --disable-harden-flags $(use_enable ipv6) diff --git a/sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.5.ebuild b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.5.ebuild new file mode 100644 index 0000000000..221b3631be --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.5.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs + +DESCRIPTION="A set of tools that use the proc filesystem" +HOMEPAGE="http://psmisc.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" +IUSE="nls selinux test X" +RESTRICT="!test? ( test )" + +RDEPEND=" + !=app-i18n/man-pages-l10n-4.0.0-r0 + >=sys-libs/ncurses-5.7-r7:= + nls? ( virtual/libintl ) + selinux? ( sys-libs/libselinux ) +" +DEPEND="${RDEPEND}" +BDEPEND=" + >=sys-devel/libtool-2.2.6b + nls? ( sys-devel/gettext ) + test? ( dev-util/dejagnu ) +" + +DOCS=( AUTHORS ChangeLog NEWS README ) + +PATCHES=( + "${FILESDIR}"/${P}-fix-killall-pidfd_send_signal.patch +) + +src_configure() { + if tc-is-cross-compiler ; then + # This isn't ideal but upstream don't provide a placement + # when malloc is missing anyway, leading to errors like: + # pslog.c:(.text.startup+0x108): undefined reference to `rpl_malloc' + # See https://sourceforge.net/p/psmisc/bugs/71/ + # (and https://lists.gnu.org/archive/html/autoconf/2011-04/msg00019.html) + export ac_cv_func_malloc_0_nonnull=yes \ + ac_cv_func_realloc_0_nonnull=yes + fi + + # No longer needed in > 23.5 + # https://gitlab.com/psmisc/psmisc/-/commit/3fac667430341bdcec733da6eacd88b03813467a + # bug #802414 + touch testsuite/global-conf.exp || die + + local myeconfargs=( + --disable-harden-flags + --enable-ipv6 + $(use_enable nls) + $(use_enable selinux) + ) + econf "${myeconfargs[@]}" +} + +src_install() { + default + + use X || rm -f "${ED}"/usr/bin/pstree.x11 + + [[ -s ${ED}/usr/bin/peekfd ]] || rm -f "${ED}"/usr/bin/peekfd + [[ -e ${ED}/usr/bin/peekfd ]] || rm -f "${ED}"/usr/share/man/man1/peekfd.1 + + # fuser is needed by init.d scripts; use * wildcard for #458250 + dodir /bin + mv "${ED}"/usr/bin/*fuser "${ED}"/bin || die +} diff --git a/sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.6.ebuild b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.6.ebuild new file mode 100644 index 0000000000..688b820b49 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-process/psmisc/psmisc-23.6.ebuild @@ -0,0 +1,68 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs + +DESCRIPTION="A set of tools that use the proc filesystem" +HOMEPAGE="http://psmisc.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux" +IUSE="apparmor nls selinux test X" +RESTRICT="!test? ( test )" + +RDEPEND=" + !=app-i18n/man-pages-l10n-4.0.0-r0 + >=sys-libs/ncurses-5.7-r7:= + apparmor? ( sys-libs/libapparmor ) + nls? ( virtual/libintl ) + selinux? ( sys-libs/libselinux ) +" +DEPEND="${RDEPEND}" +BDEPEND=" + >=sys-devel/libtool-2.2.6b + nls? ( sys-devel/gettext ) + test? ( dev-util/dejagnu ) +" + +DOCS=( AUTHORS ChangeLog NEWS README ) + +src_configure() { + if tc-is-cross-compiler ; then + # This isn't ideal but upstream don't provide a placement + # when malloc is missing anyway, leading to errors like: + # pslog.c:(.text.startup+0x108): undefined reference to `rpl_malloc' + # See https://sourceforge.net/p/psmisc/bugs/71/ + # (and https://lists.gnu.org/archive/html/autoconf/2011-04/msg00019.html) + export ac_cv_func_malloc_0_nonnull=yes \ + ac_cv_func_realloc_0_nonnull=yes + fi + + local myeconfargs=( + # Hardening flags are set by our toolchain alraedy. Setting these + # in packages means toolchain & users can't set something tougher. + --disable-harden-flags + --enable-ipv6 + $(use_enable apparmor) + $(use_enable nls) + $(use_enable selinux) + ) + econf "${myeconfargs[@]}" +} + +src_install() { + default + + use X || rm -f "${ED}"/usr/bin/pstree.x11 + + [[ -s ${ED}/usr/bin/peekfd ]] || rm -f "${ED}"/usr/bin/peekfd + [[ -e ${ED}/usr/bin/peekfd ]] || rm -f "${ED}"/usr/share/man/man1/peekfd.1 + + # fuser is needed by init.d scripts; use * wildcard for #458250 + dodir /bin + mv "${ED}"/usr/bin/*fuser "${ED}"/bin || die +}