From 65aceb849f3e567ef5ddc4650c6d7c12b7517b23 Mon Sep 17 00:00:00 2001 From: Romain Bazile Date: Sat, 30 May 2020 18:56:19 +0200 Subject: [PATCH] Solve the space in base path problem If there is a space in the base anywhere, the scripts fails to start. This is due to the default separator used in bash (which is a space). This default separator can be change by setting the variable $IFS. In `build.sh`, the old IFS variable is saved and then replaced by `\n\b`. At the end of the script, the saved IFS is set back. In `build-docker.sh`, a simple double quote was enough. --- build-docker.sh | 2 +- build.sh | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build-docker.sh b/build-docker.sh index b6a9ea3..82fa7e1 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -41,7 +41,7 @@ if test -z "${CONFIG_FILE}"; then exit 1 else # shellcheck disable=SC1090 - source ${CONFIG_FILE} + source "${CONFIG_FILE}" fi CONTAINER_NAME=${CONTAINER_NAME:-pigen_work} diff --git a/build.sh b/build.sh index a8247ab..f640fa8 100755 --- a/build.sh +++ b/build.sh @@ -229,7 +229,10 @@ fi mkdir -p "${WORK_DIR}" log "Begin ${BASE_DIR}" -STAGE_LIST=${STAGE_LIST:-${BASE_DIR}/stage*} +SAVEIFS=$IFS +IFS=$(echo -en "\n\b") + +STAGE_LIST=${STAGE_LIST:-"${BASE_DIR}"/stage*} for STAGE_DIR in $STAGE_LIST; do STAGE_DIR=$(realpath "${STAGE_DIR}") @@ -261,3 +264,5 @@ if [ -x ${BASE_DIR}/postrun.sh ]; then fi log "End ${BASE_DIR}" + +IFS=$SAVEIFS