[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [chutney/master] Fix errors from -o nounset



commit ddabffb369bf06103cc46cee87e1c9dac8b52c66
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Jun 24 10:23:55 2020 -0400

    Fix errors from -o nounset
---
 tools/bootstrap-network.sh | 10 ++++++++++
 tools/test-network.sh      | 15 ++++++++++++---
 tools/warnings.sh          |  9 +++++++++
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/tools/bootstrap-network.sh b/tools/bootstrap-network.sh
index d253455..005e0b4 100755
--- a/tools/bootstrap-network.sh
+++ b/tools/bootstrap-network.sh
@@ -15,6 +15,16 @@
 set -o errexit
 set -o nounset
 
+# Set some default values if the variables are not already set
+: ${CHUTNEY_WARNINGS_ONLY:=false}
+: ${CHUTNEY_WARNINGS_SKIP:=false}
+: ${CHUTNEY_DIAGNOSTICS_ONLY:=false}
+: ${NETWORK_DRY_RUN:=false}
+: ${USE_COVERAGE_BINARY:=false}
+: ${CHUTNEY_DIAGNOSTICS:=false}
+: ${CHUTNEY_DATA_DIR:=}
+
+
 # Get a working chutney path
 if [ ! -d "$CHUTNEY_PATH" ] || [ ! -x "$CHUTNEY_PATH/chutney" ]; then
     # looks like a broken path: use the path to this tool instead
diff --git a/tools/test-network.sh b/tools/test-network.sh
index 91baa09..633798b 100755
--- a/tools/test-network.sh
+++ b/tools/test-network.sh
@@ -29,10 +29,19 @@ export CHUTNEY_DNS_CONF=${CHUTNEY_DNS_CONF:-/dev/null}
 # Linux, which is the only tor platform with a supported sandbox.
 #export CHUTNEY_TOR_SANDBOX=1
 
+# Set some default values if the variables are not already set
+: ${CHUTNEY_WARNINGS_ONLY:=false}
+: ${CHUTNEY_WARNINGS_SKIP:=false}
+: ${CHUTNEY_DIAGNOSTICS_ONLY:=false}
+: ${NETWORK_DRY_RUN:=false}
+: ${USE_COVERAGE_BINARY:=false}
+: ${CHUTNEY_DIAGNOSTICS:=false}
+: ${CHUTNEY_DATA_DIR:=}
+
 # what we say when we fail
 UPDATE_YOUR_CHUTNEY="Please update your chutney using 'git pull'."
 
-until [ -z "$1" ]
+until [ -z "${1:-}" ]
 do
     case "$1" in
         # the path to the chutney directory
@@ -237,8 +246,8 @@ fi
 #    $CHUTNEY_TOR and $CHUTNEY_TOR_GENCERT, or $PATH
 #
 # Find the Tor build dir using the src/tools dir
-if [ ! -d "$TOR_DIR" ]; then
-    if [ -d "$BUILDDIR/src/tools" ]; then
+if [ ! -d "${TOR_DIR:-}" ]; then
+    if [ -d "${BUILDDIR:-}/src/tools" ]; then
         # Choose the build directory
         # But only if it looks like one
         $ECHO "$myname: \$TOR_DIR not set, trying \$BUILDDIR"
diff --git a/tools/warnings.sh b/tools/warnings.sh
index 577c543..7793b28 100755
--- a/tools/warnings.sh
+++ b/tools/warnings.sh
@@ -28,6 +28,15 @@
 set -o errexit
 set -o nounset
 
+# Set some default values if the variables are not already set
+: ${CHUTNEY_WARNINGS_ONLY:=false}
+: ${CHUTNEY_WARNINGS_SKIP:=false}
+: ${CHUTNEY_DIAGNOSTICS_ONLY:=false}
+: ${NETWORK_DRY_RUN:=false}
+: ${USE_COVERAGE_BINARY:=false}
+: ${CHUTNEY_DIAGNOSTICS:=false}
+: ${CHUTNEY_DATA_DIR:=}
+
 if [ "$CHUTNEY_WARNINGS_SKIP" = true ]; then
     exit 0
 fi

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits