From dfdf9d3684518cf9458a4b433a77f90f8de500b3 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Tue, 23 Aug 2022 12:38:17 +0000 Subject: [PATCH] Run docker-compose up test setup script with env When not using a ROOTCMD when running the test-setup-docker.sh the script will fail with the following error message: ++ id -u + USER_ID=1000 docker-compose up -d ./test-setup-docker.sh: line 50: USER_ID=1000: command not found Due to Bash's simple command expansion[0] variable assignments will be interpreted as the command when no ROOTCMD is given. To work around this we use default ROOTCMD to the `env` command. [0]: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Simple-Command-Expansion Change-Id: I3e4dd844efae8971d9ba83060a7134f1f1f0e770 Co-Authored-By: Simon Westphahl --- tools/test-setup-docker.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/test-setup-docker.sh b/tools/test-setup-docker.sh index 06d849b6f..dcd588725 100755 --- a/tools/test-setup-docker.sh +++ b/tools/test-setup-docker.sh @@ -8,7 +8,11 @@ # environment. set -xeu -ROOTCMD=${ROOTCMD:-} + +# Default ROOTCMD to the 'env' command, otherwise variable assignments will be +# interpreted as command when no ROOTCMD is given. The reason for that is +# Bash's simple command expansion. +ROOTCMD=${ROOTCMD:-env} cd $(dirname $0) SCRIPT_DIR="$(pwd)"