From d09ba3adca56da1dbd58c8f318e08facaa76f963 Mon Sep 17 00:00:00 2001 From: Samuel Henrique Date: Wed, 26 Jan 2022 10:58:24 +0000 Subject: [PATCH] fix: Prevent word splitting in compilation scripts when handling paths (#1502) These invocations will all cause bugs when pwd returns something that can be interpreted by bash, the most common case being a folder with whitespaces in its name. In other words these can be triggered by calling the scripts from any folder that contains whitespaces. More info on this specific finding by shellcheck: https://github.com/koalaman/shellcheck/wiki/SC2046 --- .github/workflows/linux_cpn.yml | 2 +- .github/workflows/macosx_cpn.yml | 2 +- .github/workflows/win-cpn-32.yml | 2 +- .github/workflows/win_cpn.yml | 2 +- tools/build-gh.sh | 2 +- tools/commit-tests.sh | 2 +- tools/generate-yaml.sh | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux_cpn.yml b/.github/workflows/linux_cpn.yml index 44b55f73a..07f16b799 100644 --- a/.github/workflows/linux_cpn.yml +++ b/.github/workflows/linux_cpn.yml @@ -48,7 +48,7 @@ jobs: shell: bash run: | mkdir output && \ - tools/build-companion-nightly.sh $(pwd) $(pwd)/output/ + tools/build-companion-nightly.sh "$(pwd)" "$(pwd)/output/" - name: Compose release filename # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions diff --git a/.github/workflows/macosx_cpn.yml b/.github/workflows/macosx_cpn.yml index 350ba9702..abd1eb424 100644 --- a/.github/workflows/macosx_cpn.yml +++ b/.github/workflows/macosx_cpn.yml @@ -92,7 +92,7 @@ jobs: shell: bash run: | mkdir output && \ - tools/build-companion-nightly.sh $(pwd) $(pwd)/output/ + tools/build-companion-nightly.sh "$(pwd)" "$(pwd)/output/" - name: Compose release filename # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions diff --git a/.github/workflows/win-cpn-32.yml b/.github/workflows/win-cpn-32.yml index 5a853ab77..ecc10b96f 100644 --- a/.github/workflows/win-cpn-32.yml +++ b/.github/workflows/win-cpn-32.yml @@ -91,7 +91,7 @@ jobs: run: | mkdir output && \ CMAKE_PREFIX_PATH=$RUNNER_WORKSPACE/Qt/$QT_VERSION/$MINGW_PATH \ - tools/build-companion-nightly-win32.sh $(pwd) $(pwd)/output/ + tools/build-companion-nightly-win32.sh "$(pwd)" "$(pwd)/output/" - name: Compose release filename # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions run: echo "artifact_name=edgetx-cpn-win-32-${GITHUB_REF##*/}" >> $GITHUB_ENV diff --git a/.github/workflows/win_cpn.yml b/.github/workflows/win_cpn.yml index 68806737d..d0702796b 100644 --- a/.github/workflows/win_cpn.yml +++ b/.github/workflows/win_cpn.yml @@ -94,7 +94,7 @@ jobs: run: | mkdir output && \ CMAKE_PREFIX_PATH=$RUNNER_WORKSPACE/Qt/$QT_VERSION/$MINGW_PATH \ - tools/build-companion-nightly.sh $(pwd) $(pwd)/output/ + tools/build-companion-nightly.sh "$(pwd)" "$(pwd)/output/" - name: Compose release filename # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions diff --git a/tools/build-gh.sh b/tools/build-gh.sh index 097357516..8f398f5a7 100755 --- a/tools/build-gh.sh +++ b/tools/build-gh.sh @@ -46,7 +46,7 @@ if [[ -n ${GCC_ARM} ]] ; then export PATH=${GCC_ARM}:$PATH fi -: ${SRCDIR:=$(dirname $(pwd)/"$0")/..} +: ${SRCDIR:=$(dirname "$(pwd)/$0")/..} : ${BUILD_TYPE:=Release} : ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -DDISABLE_COMPANION=YES -Wno-dev "} diff --git a/tools/commit-tests.sh b/tools/commit-tests.sh index d110b32e5..ea243c939 100755 --- a/tools/commit-tests.sh +++ b/tools/commit-tests.sh @@ -46,7 +46,7 @@ if [[ -n ${GCC_ARM} ]] ; then export PATH=${GCC_ARM}:$PATH fi -: ${SRCDIR:=$(dirname $(pwd)/"$0")/..} +: ${SRCDIR:=$(dirname "$(pwd)/$0")/..} : ${BUILD_TYPE:=Debug} : ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -Wno-dev "} diff --git a/tools/generate-yaml.sh b/tools/generate-yaml.sh index c4f7e150b..8b769dacf 100755 --- a/tools/generate-yaml.sh +++ b/tools/generate-yaml.sh @@ -10,7 +10,7 @@ if [[ -n ${GCC_ARM} ]] ; then fi : ${FLAVOR:="t12;t8;tlite;tpro;tx12;zorro;tx16s;x12s;nv14;x7;x9d;x9dp;x9e;x9lite;x9lites;xlite;xlites"} -: ${SRCDIR:=$(dirname $(pwd)/"$0")/..} +: ${SRCDIR:=$(dirname "$(pwd)/$0")/..} : ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -DDISABLE_COMPANION=YES -Wno-dev -DYAML_STORAGE=YES "}