From 78e9efb8ca1e074d3c09930866d291c2e5be5864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ey=C3=9Fer?= Date: Sat, 13 Mar 2021 17:39:19 +0100 Subject: [PATCH] bfs: update to 2.2. --- ...pabilities-when-run-as-root-on-Linux.patch | 90 +++++++++++++++++++ srcpkgs/bfs/template | 4 +- 2 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/bfs/patches/tests-Drop-capabilities-when-run-as-root-on-Linux.patch diff --git a/srcpkgs/bfs/patches/tests-Drop-capabilities-when-run-as-root-on-Linux.patch b/srcpkgs/bfs/patches/tests-Drop-capabilities-when-run-as-root-on-Linux.patch new file mode 100644 index 000000000000..a2e54c397f8b --- /dev/null +++ b/srcpkgs/bfs/patches/tests-Drop-capabilities-when-run-as-root-on-Linux.patch @@ -0,0 +1,90 @@ +From f2e6186ed0ce9b68362ad25d897f1e3c697728ec Mon Sep 17 00:00:00 2001 +From: Tavian Barnes +Date: Sun, 21 Mar 2021 13:18:43 -0400 +Subject: [PATCH] tests: Drop capabilities when run as root on Linux + +bfs's tests rely on file permissions being enforced, which leads them to +work incorrectly when run as root. This is probably the most common +packaging issue for bfs, most recently seen with Void Linux's update to +bfs 2.2. + +Make it easier on packagers by using capsh, if it's available, to drop +the DAC privileges for the tests. + +Link: https://github.com/void-linux/void-packages/pull/29437#issuecomment-798670288 +Link: https://salsa.debian.org/lamby/pkg-bfs/-/commit/b173efb35da126adb39b0984219d6a2fd9ff428f +--- + tests.sh | 35 +++++++++++++++++++++++++++++------ + 1 file changed, 29 insertions(+), 6 deletions(-) + +diff --git tests.sh tests.sh +index b039eea..0bdd1d4 100755 +--- tests.sh ++++ tests.sh +@@ -34,10 +34,25 @@ if [ -t 1 ]; then + RST="$(printf '\033[0m')" + fi + +-if [ "$EUID" -eq 0 ]; then ++if command -v capsh &>/dev/null; then ++ if capsh --has-p=CAP_DAC_OVERRIDE &>/dev/null || capsh --has-p=CAP_DAC_READ_SEARCH &>/dev/null; then ++ cat >&2 <&2 <