ctdb-tests: Avoid ShellCheck warning SC2086
authorMartin Schwenke <mschwenke@ddn.com>
Mon, 3 Jul 2023 02:10:28 +0000 (12:10 +1000)
committerMartin Schwenke <martins@samba.org>
Wed, 5 Jul 2023 11:18:37 +0000 (11:18 +0000)
  SC2086 Double quote to prevent globbing and word splitting.

Apparently ShellCheck is more picky about some of these than it used
to be.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
ctdb/tests/local_daemons.sh
ctdb/tests/run_tests.sh

index 71cf493fed37ccf3ff15adf48b48fa4dddf51707..b4746681c1fbb0633e17fdaedf588fdeb20ca05a 100755 (executable)
@@ -193,7 +193,7 @@ local_daemons_setup ()
        else
                setup_public_addresses "$_num_nodes" \
                                       $_node_no_ips \
-                                      $_use_ipv6 >"$_public_addresses_all"
+                                      "$_use_ipv6" >"$_public_addresses_all"
        fi
 
        _cluster_lock_dir="${directory}/shared/.ctdb"
@@ -226,7 +226,7 @@ local_daemons_setup ()
                _public_addresses="${CTDB_BASE}/public_addresses"
 
                if  [ -z "$_public_addresses_file" ] && \
-                           [ $_node_no_ips -eq "$_n" ] ; then
+                           [ "$_node_no_ips" -eq "$_n" ] ; then
                        echo "Node ${_n} will have no public IPs."
                        : >"$_public_addresses"
                else
index ff431f8831f16c90c0a463af5606936cc087105c..dfe2a9ab36437f43247e07b2e5c545644437e92c 100755 (executable)
@@ -300,8 +300,8 @@ run_tests ()
                        die "test \"$f\" is not recognised"
                fi
 
-               if $exit_on_fail && [ $status -ne 0 ] ; then
-                       return $status
+               if $exit_on_fail && [ "$status" -ne 0 ] ; then
+                       return "$status"
                fi
        done
 }
@@ -371,7 +371,7 @@ while [ "$max_iterations" -eq 0 ] || [ $iterations -lt "$max_iterations" ] ; do
 done
 
 if $with_summary ; then
-       if [ $status -eq 0 ] || ! $exit_on_fail ; then
+       if [ "$status" -eq 0 ] || ! $exit_on_fail ; then
                echo
                cat "$summary_file"
 
@@ -391,7 +391,7 @@ echo
 do_cleanup
 
 if $no_header || $exit_on_fail ; then
-    exit $status
+    exit "$status"
 elif [ $tests_failed -gt 0 ] ; then
     exit 1
 else