From 7f3d37f4bfb6f74952cfcacb4d5f9f93509f8400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 17 Oct 2024 09:17:26 +0200 Subject: [PATCH] all.sh: fix missing quotes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without quotes, when the variable is empty, the shell will see three tokens: [, -n, ]. After skipping ] as usual, it will see a single token, so it will consider it not as command, but a string to be tested for "is it empty", and since "-n" is not empty, the command will return true. With quotes it see 4 tokens: [, -n, , ] and interprets -n as desired. Signed-off-by: Manuel Pégourié-Gonnard --- tests/scripts/all-helpers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scripts/all-helpers.sh b/tests/scripts/all-helpers.sh index 7318a4a3c6..0e97f39190 100644 --- a/tests/scripts/all-helpers.sh +++ b/tests/scripts/all-helpers.sh @@ -250,10 +250,10 @@ helper_armc6_build_test() msg "size: ARM Compiler 6 ($FLAGS)" "$ARMC6_FROMELF" -z library/*.o - if [ -n ${PSA_CORE_PATH} ]; then + if [ -n "${PSA_CORE_PATH}" ]; then "$ARMC6_FROMELF" -z ${PSA_CORE_PATH}/*.o fi - if [ -n ${BUILTIN_SRC_PATH} ]; then + if [ -n "${BUILTIN_SRC_PATH}" ]; then "$ARMC6_FROMELF" -z ${BUILTIN_SRC_PATH}/*.o fi }