From 4b0adc63f542c60f97e9c1d5febada2df021c666 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Mon, 25 Nov 2024 13:54:03 +0100 Subject: [PATCH] Use command -v rather than which Which is technically not POSIX and command -v works everywhere. This fixes building and running the test suite on openSUSE Tumbleweed. Signed-off-by: Zygmunt Krynicki --- common/Make.rules | 2 +- tests/regression/apparmor/Makefile | 6 +++--- tests/regression/apparmor/complain.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/Make.rules b/common/Make.rules index fb6d92541..d55c8a5f5 100644 --- a/common/Make.rules +++ b/common/Make.rules @@ -35,7 +35,7 @@ VERSION=$(shell cat $(COMMONDIR)/Version) pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH))))) map = $(foreach a,$(2),$(call $(1),$(a))) -AWK:=$(shell which awk) +AWK:=$(shell command -v awk) ifndef AWK $(error awk utility required for build but not available) endif diff --git a/tests/regression/apparmor/Makefile b/tests/regression/apparmor/Makefile index 2d70cd1f0..3b2cbea2c 100644 --- a/tests/regression/apparmor/Makefile +++ b/tests/regression/apparmor/Makefile @@ -27,7 +27,7 @@ manually, or build against in-tree libapparmor.${nl}\ endif # LIBAPPARMOR not set LDLIBS += $(LIBAPPARMOR) - AA_EXEC = $(shell which aa-exec) + AA_EXEC = $(shell command -v aa-exec) ifeq ($(AA_EXEC),) AA_EXEC_ERROR_MESSAGE = $(error ${nl}\ ************************************************************************${nl}\ @@ -166,7 +166,7 @@ SRC+=syscall_sysctl.c endif # Only do xattrs_profile test if we have the required setfattr binary -ifneq (,$(shell which -s setfattr && echo TRUE)) +ifneq (,$(shell command -v setfattr)) SRC+=xattrs_profile.c else $(warning ${nl}\ @@ -295,7 +295,7 @@ TESTS=aa_exec \ nfs # Only do xattrs_profile test if we have the required setfattr binary -ifneq (,$(shell which -s setfattr && echo TRUE)) +ifneq (,$(shell command -v setfattr)) TESTS+=xattrs_profile endif diff --git a/tests/regression/apparmor/complain.sh b/tests/regression/apparmor/complain.sh index ffca342e7..6b9b137d6 100644 --- a/tests/regression/apparmor/complain.sh +++ b/tests/regression/apparmor/complain.sh @@ -29,5 +29,5 @@ runchecktest "Complain mode profile (file exec no permission entry)" pass exec e # This test will fail on a kernel that doesn't have # https://lists.ubuntu.com/archives/apparmor/2024-August/013338.html applied -genprofile -C $(which echo):cx +genprofile -C $(command -v echo):cx runchecktest "Complain mode profile (file exec cx permission entry)" pass exec echo PASS