From 57baea701f8852b94d8ebc3fd8e70ccc998f5036 Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 6 Nov 2019 15:40:39 +1000 Subject: [PATCH 1/2] shellcheck: Start checking most scripts for errors This check was accidentally disabled by a bad find command. Fixes bug 32402; bugfix on 0.4.2.1-alpha. Obviously correct changes to already reviewed code. --- changes/bug32402 | 3 +++ scripts/maint/checkShellScripts.sh | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 changes/bug32402 diff --git a/changes/bug32402 b/changes/bug32402 new file mode 100644 index 0000000000..0654389be3 --- /dev/null +++ b/changes/bug32402 @@ -0,0 +1,3 @@ + o Minor bugfixes (shellcheck): + - Start checking most scripts for shellcheck errors again. + Fixes bug 32402; bugfix on 0.4.2.1-alpha. diff --git a/scripts/maint/checkShellScripts.sh b/scripts/maint/checkShellScripts.sh index 318f0fb577..4c872c7ee0 100755 --- a/scripts/maint/checkShellScripts.sh +++ b/scripts/maint/checkShellScripts.sh @@ -35,12 +35,8 @@ if [ ! -d "$TOPLEVEL/src" ]; then fi # Check *.sh scripts, but ignore the ones that we can't fix -find "$TOPLEVEL" \ +find "$TOPLEVEL/contrib" "$TOPLEVEL/doc" "$TOPLEVEL/scripts" "$TOPLEVEL/src" \ -name "*.sh" \ - -path "$TOPLEVEL/contrib/*" \ - -path "$TOPLEVEL/doc/*" \ - -path "$TOPLEVEL/scripts/*" \ - -path "$TOPLEVEL/src/*" \ -not -path "$TOPLEVEL/src/ext/*" \ -not -path "$TOPLEVEL/src/rust/registry/*" \ -exec shellcheck {} + From 7f23d47f723edeea206d5438af3d109dbb4ac835 Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 6 Nov 2019 15:52:18 +1000 Subject: [PATCH 2/2] shellcheck: Fix issues in the git-*.sh scripts Fixes bug 32402; bugfix on 0.4.2.1-alpha. Obviously correct changes to already reviewed code. --- changes/bug32402_git_scripts | 3 +++ scripts/git/git-merge-forward.sh | 2 +- scripts/git/git-pull-all.sh | 2 +- scripts/git/git-push-all.sh | 21 +++++++++++---------- 4 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 changes/bug32402_git_scripts diff --git a/changes/bug32402_git_scripts b/changes/bug32402_git_scripts new file mode 100644 index 0000000000..2b10a8998a --- /dev/null +++ b/changes/bug32402_git_scripts @@ -0,0 +1,3 @@ + o Minor bugfixes (shellcheck): + - Fix minor shellcheck errors in the git-*.sh scripts. + Fixes bug 32402; bugfix on 0.4.2.1-alpha. diff --git a/scripts/git/git-merge-forward.sh b/scripts/git/git-merge-forward.sh index e481b40975..bdd0da5b75 100755 --- a/scripts/git/git-merge-forward.sh +++ b/scripts/git/git-merge-forward.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") function usage() { diff --git a/scripts/git/git-pull-all.sh b/scripts/git/git-pull-all.sh index 0d6daf432d..dc16066388 100755 --- a/scripts/git/git-pull-all.sh +++ b/scripts/git/git-pull-all.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") function usage() { diff --git a/scripts/git/git-push-all.sh b/scripts/git/git-push-all.sh index a388f01564..7c43fe24d8 100755 --- a/scripts/git/git-push-all.sh +++ b/scripts/git/git-push-all.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") function usage() { @@ -237,7 +237,7 @@ if [ "$PUSH_SAME" -eq 0 ] && [ "$TEST_BRANCH_PREFIX" ]; then fi done if [ "$SKIP_UPSTREAM" ]; then - printf "Skipping unchanged: %s remote: %s\n" \ + printf "Skipping unchanged: %s remote: %s\\n" \ "$b" "$SKIP_UPSTREAM" else if [ "$NEW_PUSH_BRANCHES" ]; then @@ -261,18 +261,19 @@ if [ "$PUSH_DELAY" -le 0 ]; then $GIT_PUSH "$@" "$UPSTREAM_REMOTE" $PUSH_BRANCHES else # Push the branches in optimal CI order, with a delay between each push - PUSH_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\n" | sort -V) - MASTER_BRANCH=$(echo "$PUSH_BRANCHES" | tr " " "\n" | grep master) + PUSH_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\\n" | sort -V) + MASTER_BRANCH=$(echo "$PUSH_BRANCHES" | tr " " "\\n" | grep master) if [ -z "$TEST_BRANCH_PREFIX" ]; then - MAINT_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\n" | grep maint) - RELEASE_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\n" | grep release | \ - tr "\n" " ") - printf "Pushing with %ss delays, so CI runs in this order:\n%s\n%s\n%s\n" \ + MAINT_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\\n" | grep maint) + RELEASE_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\\n" | grep release | \ + tr "\\n" " ") + printf \ + "Pushing with %ss delays, so CI runs in this order:\\n%s\\n%s\\n%s\\n" \ "$PUSH_DELAY" "$MASTER_BRANCH" "$MAINT_BRANCHES" "$RELEASE_BRANCHES" else # Actually test branches based on maint branches - MAINT_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\n" | grep -v master) - printf "Pushing with %ss delays, so CI runs in this order:\n%s\n%s\n" \ + MAINT_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\\n" | grep -v master) + printf "Pushing with %ss delays, so CI runs in this order:\\n%s\\n%s\\n" \ "$PUSH_DELAY" "$MASTER_BRANCH" "$MAINT_BRANCHES" # No release branches RELEASE_BRANCHES=