summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-12-16 02:33:42 +0000
committerSam James <sam@gentoo.org>2023-12-16 02:35:53 +0000
commit2b237c4b6a2bee9fd99ec7fe3362c6fc58a90445 (patch)
treeaabb4c0a610008d6b1ae8ee05e405b4191dca228
parentsys-block/mbuffer: add upstream submission note (diff)
downloadgentoo-2b237c4b6a2bee9fd99ec7fe3362c6fc58a90445.tar.gz
gentoo-2b237c4b6a2bee9fd99ec7fe3362c6fc58a90445.tar.bz2
gentoo-2b237c4b6a2bee9fd99ec7fe3362c6fc58a90445.zip
sys-libs/libseccomp: drop use of which for tests
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--sys-libs/libseccomp/files/libseccomp-2.5.5-which-hunt.patch69
-rw-r--r--sys-libs/libseccomp/libseccomp-2.5.5.ebuild1
2 files changed, 70 insertions, 0 deletions
diff --git a/sys-libs/libseccomp/files/libseccomp-2.5.5-which-hunt.patch b/sys-libs/libseccomp/files/libseccomp-2.5.5-which-hunt.patch
new file mode 100644
index 000000000000..90dc25bf4e7c
--- /dev/null
+++ b/sys-libs/libseccomp/files/libseccomp-2.5.5-which-hunt.patch
@@ -0,0 +1,69 @@
+https://github.com/seccomp/libseccomp/pull/424
+
+From 865adeed17cac7063cbbce0c5df225aa35c83621 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sat, 16 Dec 2023 02:17:36 +0000
+Subject: [PATCH] tests: avoid use of non-portable `which`
+
+which is not a standard POSIX utility, and indeed, each of these test scripts
+uses #!/bin/bash as its shebang, so we can use `type -P` which has the same
+behaviour as `which` for free.
+
+(If the tests used POSIX shell, we could do `command -v`, its only caveat is
+that it'll pick up functions in the user's shell, which doesn't matter 99% of
+the time anyway.)
+
+Distributions like Debian [0] and Gentoo [1] are looking to remove `which`
+from their base set of packages.
+
+[0] https://lwn.net/Articles/874049/
+[1] https://bugs.gentoo.org/646588
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/tests/38-basic-pfc_coverage.sh
++++ b/tests/38-basic-pfc_coverage.sh
+@@ -18,7 +18,7 @@
+ #
+ function check_deps() {
+ [[ -z "$1" ]] && return
+- which "$1" >& /dev/null
++ type -P "$1" >& /dev/null
+ return $?
+ }
+
+--- a/tests/55-basic-pfc_binary_tree.sh
++++ b/tests/55-basic-pfc_binary_tree.sh
+@@ -18,7 +18,7 @@
+ #
+ function check_deps() {
+ [[ -z "$1" ]] && return
+- which "$1" >& /dev/null
++ type -P "$1" >& /dev/null
+ return $?
+ }
+
+--- a/tests/regression
++++ b/tests/regression
+@@ -73,7 +73,7 @@ GLBL_SYS_API="../tools/scmp_api_level"
+ #
+ function check_deps() {
+ [[ -z "$1" ]] && return
+- which "$1" >& /dev/null
++ type -P "$1" >& /dev/null
+ return $?
+ }
+
+--- a/tests/testgen
++++ b/tests/testgen
+@@ -32,7 +32,7 @@
+ #
+ function verify_deps() {
+ [[ -z "$1" ]] && return
+- if ! which "$1" >& /dev/null; then
++ if ! type -P "$1" >& /dev/null; then
+ echo "error: install \"$1\" and include it in your \$PATH"
+ exit 1
+ fi
+--
+2.43.0
+
diff --git a/sys-libs/libseccomp/libseccomp-2.5.5.ebuild b/sys-libs/libseccomp/libseccomp-2.5.5.ebuild
index e65a98cb7fc6..51018de4ccdd 100644
--- a/sys-libs/libseccomp/libseccomp-2.5.5.ebuild
+++ b/sys-libs/libseccomp/libseccomp-2.5.5.ebuild
@@ -40,6 +40,7 @@ BDEPEND="${DEPEND}
PATCHES=(
"${FILESDIR}"/libseccomp-python-shared.patch
"${FILESDIR}"/libseccomp-2.5.3-skip-valgrind.patch
+ "${FILESDIR}"/libseccomp-2.5.5-which-hunt.patch
)
src_prepare() {