From 4946316537e06d46a3c2ab124d8b07e6f8cb32e0 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Tue, 6 Dec 2022 10:38:33 -0700 Subject: [PATCH 1/2] Appease ShellCheck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ShellCheck has started failing in CI. My guess is that the ubuntu-latest runner now uses a `/bin/sh` that is actually Bash. - excludes checksec.sh, as it’s not our code - fixes lints in other files --- contrib/docker/entrypoint.sh | 2 +- test/lint/commit-script-check.sh | 6 +++--- test/lint/lint-shell.sh | 2 +- zcutil/build.sh | 2 +- zcutil/fetch-params.sh | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/contrib/docker/entrypoint.sh b/contrib/docker/entrypoint.sh index bb1d3a7f6..da9749ba2 100755 --- a/contrib/docker/entrypoint.sh +++ b/contrib/docker/entrypoint.sh @@ -55,4 +55,4 @@ fi zcash-fetch-params touch .zcash/zcash.conf echo "Starting: ${ZCASHD_CMD}" -eval exec "${ZCASHD_CMD}" "${@}" +exec "${ZCASHD_CMD}" "${@}" diff --git a/test/lint/commit-script-check.sh b/test/lint/commit-script-check.sh index 433e78393..8b55f1578 100755 --- a/test/lint/commit-script-check.sh +++ b/test/lint/commit-script-check.sh @@ -13,14 +13,14 @@ # one. Any remaining diff signals an error. export LC_ALL=C -if test "x$1" = "x"; then +if test -z "$1"; then echo "Usage: $0 ..." exit 1 fi # Check that the working tree is clean (as this script performs hard resets). TREE_CHANGES=$(git diff HEAD | wc -l) -if test "x$TREE_CHANGES" != "x0"; then +if test "$TREE_CHANGES" != "0"; then echo "The working tree is not clean." exit 1 fi @@ -32,7 +32,7 @@ for commit in $(git rev-list --reverse $1); do if git rev-list -n 1 --pretty="%s" $commit | grep -q "^scripted-diff:"; then git checkout --quiet $commit^ || exit SCRIPT="$(git rev-list --format=%b -n1 $commit | sed '/^-BEGIN VERIFY SCRIPT-$/,/^-END VERIFY SCRIPT-$/{//!b};d')" - if test "x$SCRIPT" = "x"; then + if test -z "$SCRIPT"; then echo "Error: missing script for: $commit" echo "Failed" RET=1 diff --git a/test/lint/lint-shell.sh b/test/lint/lint-shell.sh index ba0c906de..8ae62818f 100755 --- a/test/lint/lint-shell.sh +++ b/test/lint/lint-shell.sh @@ -40,7 +40,7 @@ if ! command -v shellcheck > /dev/null; then fi EXCLUDE="--exclude=$(IFS=','; echo "${disabled[*]}")" -if ! shellcheck "$EXCLUDE" $(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|univalue)/'); then +if ! shellcheck "$EXCLUDE" $(git ls-files -- '*.sh' | grep -vE '(qa/zcash/checksec\.sh|src/(|leveldb|secp256k1|univalue)/)'); then EXIT_CODE=1 fi diff --git a/zcutil/build.sh b/zcutil/build.sh index 3a7c32192..5032a9f0e 100755 --- a/zcutil/build.sh +++ b/zcutil/build.sh @@ -40,7 +40,7 @@ if [ -z "${CONFIGURE_FLAGS-}" ]; then CONFIGURE_FLAGS="" fi -if [ "x$*" = 'x--help' ] +if [ "$*" = '--help' ] then cat < Date: Tue, 6 Dec 2022 13:46:00 -0700 Subject: [PATCH 2/2] Defer fixing docker/entrypoint.sh lint failure --- contrib/docker/entrypoint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/docker/entrypoint.sh b/contrib/docker/entrypoint.sh index da9749ba2..44e3f22d1 100755 --- a/contrib/docker/entrypoint.sh +++ b/contrib/docker/entrypoint.sh @@ -55,4 +55,5 @@ fi zcash-fetch-params touch .zcash/zcash.conf echo "Starting: ${ZCASHD_CMD}" -exec "${ZCASHD_CMD}" "${@}" +# shellcheck disable=SC2294 # see #6297 +eval exec "${ZCASHD_CMD}" "${@}"