[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] shellcheck: Fix minor issues in some scripts
commit e6b5a1ff939b286a6640305d4d49600dd3b7b574
Author: teor <teor@xxxxxxxxxxxxxx>
Date: Wed Nov 6 16:00:50 2019 +1000
shellcheck: Fix minor issues in some scripts
Fix minor issues in git-push-all.sh, git-setup-dirs.sh and
test_parseconf.sh.
Fixes bug 32402; not in any released version of tor.
Obviously correct changes to already reviewed code.
---
scripts/git/git-push-all.sh | 9 +++++----
scripts/git/git-setup-dirs.sh | 6 ++++--
src/test/test_parseconf.sh | 4 ++--
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/scripts/git/git-push-all.sh b/scripts/git/git-push-all.sh
index a1ba754c2..7bbeaecbd 100755
--- a/scripts/git/git-push-all.sh
+++ b/scripts/git/git-push-all.sh
@@ -309,15 +309,16 @@ else
fi
if [ "$MASTER_BRANCH" ] || [ "$MAINT_BRANCHES" ] \
|| [ "$RELEASE_BRANCHES" ]; then
- printf "Pushing with %ss delays, so CI runs in this order:\n" "$PUSH_DELAY"
+ printf "Pushing with %ss delays, so CI runs in this order:\\n" \
+ "$PUSH_DELAY"
if [ "$MASTER_BRANCH" ]; then
- printf "%s\n" "$MASTER_BRANCH"
+ printf "%s\\n" "$MASTER_BRANCH"
fi
if [ "$MAINT_BRANCHES" ]; then
- printf "%s\n" "$MAINT_BRANCHES"
+ printf "%s\\n" "$MAINT_BRANCHES"
fi
if [ "$RELEASE_BRANCHES" ]; then
- printf "%s\n" "$RELEASE_BRANCHES"
+ printf "%s\\n" "$RELEASE_BRANCHES"
fi
fi
# shellcheck disable=SC2086
diff --git a/scripts/git/git-setup-dirs.sh b/scripts/git/git-setup-dirs.sh
index 495b22b26..384c48899 100755
--- a/scripts/git/git-setup-dirs.sh
+++ b/scripts/git/git-setup-dirs.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-SCRIPT_NAME=`basename $0`
+SCRIPT_NAME=$(basename "$0")
function usage()
{
@@ -295,8 +295,10 @@ function add_remote
printf " %s Adding remote %s at %s..." "$MARKER" "$1" "$2"
local check_cmd="git remote get-url '$1'"
msg=$( eval "$check_cmd" 2>&1 )
+ ret=$?
# We don't want a remote, so we invert the exit status
- if validate_ret_skip $[ ! $? ] "Remote already exists for $1 at $msg."; then
+ if validate_ret_skip $(( ! ret )) \
+ "Remote already exists for $1 at $msg."; then
return
fi
if [ $DRY_RUN -eq 0 ]; then
diff --git a/src/test/test_parseconf.sh b/src/test/test_parseconf.sh
index 86a00f7a0..6799e13ae 100755
--- a/src/test/test_parseconf.sh
+++ b/src/test/test_parseconf.sh
@@ -88,7 +88,7 @@ TOR_BINARY="$(abspath "$TOR_BINARY")"
echo "TOR BINARY IS ${TOR_BINARY}"
TOR_MODULES_DISABLED="$("$TOR_BINARY" --list-modules | grep ": no" \
- | cut -d ":" -f1 | sort | tr "\n" "_")"
+ | cut -d ":" -f1 | sort | tr "\\n" "_")"
# Remove the last underscore, if there is one
TOR_MODULES_DISABLED=${TOR_MODULES_DISABLED%_}
@@ -239,7 +239,7 @@ for dir in "${EXAMPLEDIR}"/*; do
> "${DATA_DIR}/output.${testname}" \
&& die "FAIL: $ERROR: Tor did not report an error."
- expect_err="$(cat $ERROR)"
+ expect_err="$(cat "$ERROR")"
if grep "${expect_err}" "${DATA_DIR}/output.${testname}" >/dev/null; then
echo "OK"
else
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits