From 109dbef5c9aa2587718a12196e06d6f9c206ac5e Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Wed, 5 Feb 2025 22:04:04 +0100 Subject: [PATCH 1/2] Fix bug when multiple modules where defined. In the old syntax, they were interpreted as a single string, with space. I.e. only one iteration of hte for loop was executed. Using bash arrays, we no longer have this issue --- bot/build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/build.sh b/bot/build.sh index 29444a32c2..f6e7565590 100755 --- a/bot/build.sh +++ b/bot/build.sh @@ -115,7 +115,8 @@ mkdir -p ${SINGULARITY_TMPDIR} # load modules if LOAD_MODULES is not empty if [[ ! -z ${LOAD_MODULES} ]]; then - for mod in $(echo ${LOAD_MODULES} | tr ',' '\n') + IFS=',' read -r -a modules <<< "$(echo "${LOAD_MODULES}")" + for mod in "${modules[@]}"; do echo "bot/build.sh: loading module '${mod}'" module load ${mod} From b56c708af4bdd1a5c91df6a8a3fc4f227a8aa5f7 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Wed, 5 Feb 2025 22:44:00 +0100 Subject: [PATCH 2/2] Also fix in test.sh --- bot/test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/test.sh b/bot/test.sh index 464c4817a9..fd6c4de040 100755 --- a/bot/test.sh +++ b/bot/test.sh @@ -135,7 +135,8 @@ mkdir -p ${SINGULARITY_TMPDIR} # load modules if LOAD_MODULES is not empty if [[ ! -z ${LOAD_MODULES} ]]; then - for mod in $(echo ${LOAD_MODULES} | tr ',' '\n') + IFS=',' read -r -a modules <<< "$(echo "${LOAD_MODULES}")" + for mod in "${modules[@]}"; do echo "bot/test.sh: loading module '${mod}'" module load ${mod}