From 14d35c651cc6df9659fc9ac417f00b3ae6f277e9 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 13 Feb 2022 07:30:42 +0000 Subject: [PATCH] Test suite: don't use fragile shell construct mixing string and array The previous code happened to work only because we always pass either 0 or 1 arguments to these functions. If we ever passed them 2+ arguments, unexpected things would happen. For details, see https://www.shellcheck.net/wiki/SC2145 --- tests/regression/apparmor/dbus.inc | 2 +- tests/regression/apparmor/dbus_message.sh | 2 +- tests/regression/apparmor/dbus_service.sh | 2 +- tests/regression/apparmor/dbus_unrequested_reply.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/regression/apparmor/dbus.inc b/tests/regression/apparmor/dbus.inc index b234a348f..b28dd4fa3 100755 --- a/tests/regression/apparmor/dbus.inc +++ b/tests/regression/apparmor/dbus.inc @@ -14,7 +14,7 @@ ${__dbus_var_decl} $test { @{gen $test} unix, - $@ + $* signal receive peer=unconfined, } EOF diff --git a/tests/regression/apparmor/dbus_message.sh b/tests/regression/apparmor/dbus_message.sh index 27807c429..53ba4a2be 100755 --- a/tests/regression/apparmor/dbus_message.sh +++ b/tests/regression/apparmor/dbus_message.sh @@ -33,7 +33,7 @@ confined_args="--log=$confined_log $listnames" message_gendbusprofile() { gendbusprofile "${confined_log} w, - $@" + $*" } start_bus diff --git a/tests/regression/apparmor/dbus_service.sh b/tests/regression/apparmor/dbus_service.sh index 5cd698a28..34e5c042a 100755 --- a/tests/regression/apparmor/dbus_service.sh +++ b/tests/regression/apparmor/dbus_service.sh @@ -62,7 +62,7 @@ service_runchecktest() service_gendbusprofile() { gendbusprofile "$unconfined_log w, - $@" + $*" } start_bus diff --git a/tests/regression/apparmor/dbus_unrequested_reply.sh b/tests/regression/apparmor/dbus_unrequested_reply.sh index e69c8b458..01f11179a 100644 --- a/tests/regression/apparmor/dbus_unrequested_reply.sh +++ b/tests/regression/apparmor/dbus_unrequested_reply.sh @@ -63,7 +63,7 @@ ur_gendbusprofile() { gendbusprofile "$confined_log w, dbus bind bus=$bus name=$dest, - $@" + $*" } start_bus