From a935d7431084d024f69bd19b88304861076328db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20B=C3=B6gershausen?= Date: Fri, 24 Nov 2023 07:55:03 +0100 Subject: [PATCH] ci/checkshellcheck: Double quote ... SC2086 Address the warning "Double quote to prevent globbing and word splitting. [SC2086]" When shellcheck was introduced, it was somewhat missed that there where a ton of warnings. Start to address the most common: "Double quote" There are 3 ways to adsress this: - (1) Rewrite the code - (2) Disable the warning on a file-by-file bases - (3) Disable the warning on command line This patch goes for (1) when there is only one or two lines to be changed, and (2) when there are many lines to be changed. (2) is choosen to avoid touching working shell-code with the risk that something brakes: Not all shell scripts are run on a regular bases. It is better to look at these when the file is changed the next time. And as a side-note: More wanings need to be addressed in the next commits --- test/install-mini-conda.sh | 2 +- test/pytests36/doRunTests.sh | 1 + test/pytests36/runTests.sh | 1 + test/pytests36/test-ioc-with-sim-indexer-one-TC-wrapper.sh | 1 + test/pytests36/test-ioc-with-sim-indexer-one-TC.sh | 1 + test/pythonscripts/monEL1252-YMIR-crate007.sh | 1 + test/pythonscripts/monEL6688-1252-crate007.sh | 1 + test/pythonscripts/monEL6688-YMIR.sh | 1 + test/pythonscripts/monESTIAauxbits.sh | 1 + test/pythonscripts/monPTPOffsets.sh | 1 + test/pythonscripts/monRawMtrEnc.sh | 1 + test/run-ethercatmc-ioc.sh | 1 + test/run-ethercatmc-tests.sh | 2 +- test/run-simulator-tests.sh | 4 ++-- test/simulator/startSimulator.sh | 1 + 15 files changed, 16 insertions(+), 4 deletions(-) diff --git a/test/install-mini-conda.sh b/test/install-mini-conda.sh index e08c9c68..037f6b4c 100755 --- a/test/install-mini-conda.sh +++ b/test/install-mini-conda.sh @@ -2,7 +2,7 @@ set -e -x wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh -bash miniconda.sh -b -p $HOME/miniconda +bash miniconda.sh -b -p "$HOME/miniconda" export PATH="$HOME/miniconda/bin:$PATH" hash -r conda config --set always_yes yes --set changeps1 no diff --git a/test/pytests36/doRunTests.sh b/test/pytests36/doRunTests.sh index f78a6b96..d01e8666 100755 --- a/test/pytests36/doRunTests.sh +++ b/test/pytests36/doRunTests.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC2086 set -x diff --git a/test/pytests36/runTests.sh b/test/pytests36/runTests.sh index c08165ac..ee512ebf 100755 --- a/test/pytests36/runTests.sh +++ b/test/pytests36/runTests.sh @@ -1,4 +1,5 @@ #!/bin/bash +# shellcheck disable=SC2086 # # Wrapper scipt to run tests # Usage: diff --git a/test/pytests36/test-ioc-with-sim-indexer-one-TC-wrapper.sh b/test/pytests36/test-ioc-with-sim-indexer-one-TC-wrapper.sh index 3b88a74f..4ed7a087 100755 --- a/test/pytests36/test-ioc-with-sim-indexer-one-TC-wrapper.sh +++ b/test/pytests36/test-ioc-with-sim-indexer-one-TC-wrapper.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC2086 #PVNAME=ca://IOC:m1 PVNAME=$1 diff --git a/test/pytests36/test-ioc-with-sim-indexer-one-TC.sh b/test/pytests36/test-ioc-with-sim-indexer-one-TC.sh index 45dcfa13..7b075792 100755 --- a/test/pytests36/test-ioc-with-sim-indexer-one-TC.sh +++ b/test/pytests36/test-ioc-with-sim-indexer-one-TC.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC2086 set -x diff --git a/test/pythonscripts/monEL1252-YMIR-crate007.sh b/test/pythonscripts/monEL1252-YMIR-crate007.sh index 921fc847..e08a0e1b 100755 --- a/test/pythonscripts/monEL1252-YMIR-crate007.sh +++ b/test/pythonscripts/monEL1252-YMIR-crate007.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC2086 P="LabS-MCAG:MC-MCU-07:" if ! type pvmonitor >/dev/null 2>&1; then . ~/MCAG_SetupMotionDemo/.epics.ymir-vm-ioc-01.cn.nin.ess.eu.Linux.x86_64 diff --git a/test/pythonscripts/monEL6688-1252-crate007.sh b/test/pythonscripts/monEL6688-1252-crate007.sh index 4d6dd300..c3d7ff46 100755 --- a/test/pythonscripts/monEL6688-1252-crate007.sh +++ b/test/pythonscripts/monEL6688-1252-crate007.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC2086 P="LabS-MCAG:MC-MCU-07:" if ! type pvmonitor >/dev/null 2>&1; then . ~/MCAG_SetupMotionDemo/.epics.ymir-vm-ioc-01.cn.nin.ess.eu.Linux.x86_64 diff --git a/test/pythonscripts/monEL6688-YMIR.sh b/test/pythonscripts/monEL6688-YMIR.sh index 449f341e..2272c320 100755 --- a/test/pythonscripts/monEL6688-YMIR.sh +++ b/test/pythonscripts/monEL6688-YMIR.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC2086 P="LabS-MCAG:MC-MCU-07:" if ! type pvmonitor >/dev/null 2>&1; then . ~/MCAG_SetupMotionDemo/.epics.ymir-vm-ioc-01.cn.nin.ess.eu.Linux.x86_64 diff --git a/test/pythonscripts/monESTIAauxbits.sh b/test/pythonscripts/monESTIAauxbits.sh index 1aa44712..2e861a4f 100755 --- a/test/pythonscripts/monESTIAauxbits.sh +++ b/test/pythonscripts/monESTIAauxbits.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC2086 # Script to monitor MotorPositions # The positions are timestamped inside the controller: diff --git a/test/pythonscripts/monPTPOffsets.sh b/test/pythonscripts/monPTPOffsets.sh index 61095554..c21b2fdf 100755 --- a/test/pythonscripts/monPTPOffsets.sh +++ b/test/pythonscripts/monPTPOffsets.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC2086 P="LabS-MCAG:MC-MCU-07:" if ! type pvmonitor >/dev/null 2>&1; then . ~/MCAG_SetupMotionDemo/.epics.ymir-vm-ioc-01.cn.nin.ess.eu.Linux.x86_64 diff --git a/test/pythonscripts/monRawMtrEnc.sh b/test/pythonscripts/monRawMtrEnc.sh index 449df49c..1f1f177c 100755 --- a/test/pythonscripts/monRawMtrEnc.sh +++ b/test/pythonscripts/monRawMtrEnc.sh @@ -6,6 +6,7 @@ # Monitor the values from the stepper terminal and the encoder # terminal as well. +# shellcheck disable=SC2086 # Our motor to work against if test -z "$P"; then export P=LabS-MCAG:MC-MCU-07: diff --git a/test/run-ethercatmc-ioc.sh b/test/run-ethercatmc-ioc.sh index bab48b76..70bc76a2 100755 --- a/test/run-ethercatmc-ioc.sh +++ b/test/run-ethercatmc-ioc.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC2086 # # Shell script to generate (and run) an "st.cmd" for an IOC diff --git a/test/run-ethercatmc-tests.sh b/test/run-ethercatmc-tests.sh index 84b61d6d..2024bdcb 100755 --- a/test/run-ethercatmc-tests.sh +++ b/test/run-ethercatmc-tests.sh @@ -4,7 +4,7 @@ if test -z "$1"; then exit 1 fi ./checkws.sh || { - echo >&2 $OLDPWD/checkws.sh failed + echo >&2 "$OLDPWD/checkws.sh" failed exit 1 } ( diff --git a/test/run-simulator-tests.sh b/test/run-simulator-tests.sh index 8d8709bc..90f039d7 100755 --- a/test/run-simulator-tests.sh +++ b/test/run-simulator-tests.sh @@ -4,12 +4,12 @@ if test -z "$1"; then exit 1 fi ./checkws.sh || { - echo >&2 $OLDPWD/checkws.sh failed + echo >&2 "$OLDPWD"/checkws.sh failed exit 1 } ( cd pytests36/ && PV="$1" shift - ./runTests.sh "$PV" "$f" "$@" + ./runTests.sh "$PV" "$@" ) diff --git a/test/simulator/startSimulator.sh b/test/simulator/startSimulator.sh index a90a52c7..d1623012 100755 --- a/test/simulator/startSimulator.sh +++ b/test/simulator/startSimulator.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC2086 uname_S=$(uname -s 2>/dev/null || echo unknown) uname_M=$(uname -m 2>/dev/null || echo unknown) uname_R=$(uname -r 2>/dev/null | sed -e "s/[()/]/-/g" || echo unknown)