ctdb-scripts: Quote some variable expansions
authorMartin Schwenke <martin@meltin.net>
Wed, 29 Jun 2016 08:11:44 +0000 (18:11 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 6 Jul 2016 06:15:49 +0000 (08:15 +0200)
This avoids relevant shellcheck warnings.  This is most of the
shellcheck low hanging fruit in the non-test code.  Many of the other
warnings produced by shellcheck are either false positives, are
non-trivial to fix or a fix may result in worse code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Jul  6 08:15:49 CEST 2016 on sn-devel-144

17 files changed:
ctdb/config/ctdbd_wrapper
ctdb/config/debug-hung-script.sh
ctdb/config/debug_locks.sh
ctdb/config/events.d/00.ctdb
ctdb/config/events.d/01.reclock
ctdb/config/events.d/10.interface
ctdb/config/events.d/11.natgw
ctdb/config/events.d/11.routing
ctdb/config/events.d/13.per_ip_routing
ctdb/config/events.d/50.samba
ctdb/config/events.d/60.nfs
ctdb/config/events.d/70.iscsi
ctdb/config/events.d/91.lvs
ctdb/config/functions
ctdb/config/nfs-linux-kernel-callout
ctdb/config/notify.sh
ctdb/config/statd-callout

index c007409cd4afe3cb798d490d791bd386c82c6312..caeb81a9e748e5c2076eed43e75a2082f51e00b1 100755 (executable)
@@ -214,7 +214,8 @@ start()
        ulimit -n $CTDB_MAX_OPEN_FILES
     fi
 
-    mkdir -p $(dirname "$pidfile")
+    _d=$(dirname "$pidfile")
+    mkdir -p "$_d"
 
     if [ -n "$CTDB_VALGRIND" -a "$CTDB_VALGRIND" != "no" ] ; then
        if [ "$CTDB_VALGRIND" = "yes" ] ; then
index 921683c4669e1a689278c6161db1eda67d0bbbc0..cdf165763d736bf90f3f53907b9a032675c292c9 100755 (executable)
@@ -25,7 +25,7 @@ fi
     echo "===== Start of hung script debug for PID=\"$1\", event=\"$2\" ====="
 
     echo "pstree -p -a ${1}:"
-    out=$(pstree -p -a $1)
+    out=$(pstree -p -a "$1")
     echo "$out"
 
     # Check for processes matching a regular expression and print
index c0bbfcc2e57f1bba6a0177ec0d7b6206ee84a2c9..62b679923409a8b6910d51f4180def53768177a1 100755 (executable)
@@ -36,7 +36,7 @@ loadconfig ctdb
     grep -F "POSIX  ADVISORY  WRITE" |
     awk '{ if($2 == "->") { print $6, $7, $8, $9, "W" } else { print $5, $6, $7, $8 } }' |
     while read pid rest ; do
-       pname=$(readlink /proc/$pid/exe)
+       pname=$(readlink "/proc/${pid}/exe")
        echo $pid $pname $rest
     done | sed -e "$sed_cmd" | grep "\.tdb" )
 
@@ -56,7 +56,7 @@ loadconfig ctdb
        # For each process waiting, log stack trace
        for pid in $pids ; do
            echo "----- Stack trace for PID=$pid -----"
-           read x x state x </proc/$pid/stat
+           read x x state x <"/proc/${pid}/stat"
            if [ "$state" = "D" ] ; then
                # Don't run gstack on a process in D state since
                # gstack will hang until the process exits D state.
@@ -68,9 +68,9 @@ loadconfig ctdb
                # deadlock... but it will probably give us someone to
                # blame!
                echo "----- Process in D state, printing kernel stack only"
-               cat /proc/$pid/stack
+               cat "/proc/${pid}/stack"
            else
-               gstack $pid
+               gstack "$pid"
                # gcore -o /var/log/core-deadlock-ctdb $pid
            fi
        done
index 92f163393697169b1b110ccf9869f4575b7b7114..d7b238f87a3c9f926703ed950d0807ceed7aea6a 100755 (executable)
@@ -107,7 +107,7 @@ set_ctdb_variables ()
     while read v; do
        varname="${v#CTDB_SET_}"
        value=$(eval echo "\$$v")
-       if $CTDB setvar $varname $value ; then
+       if $CTDB setvar "$varname" "$value" ; then
            echo "Set $varname to $value"
        else
            echo "Invalid configuration: CTDB_SET_${varname}=${value}"
index f2bf2d743341a12c72bf741c4710f8a4e52830d5..52e65b98466f5337a66acd3e990e8fa55fdd9f4e 100755 (executable)
@@ -31,7 +31,7 @@ case "$1" in
        # Try to stat the reclock file as a background process so that
        # we don't block in case the cluster filesystem is unavailable
        (
-           if stat $CTDB_RECOVERY_LOCK ; then
+           if stat "$CTDB_RECOVERY_LOCK" ; then
                # We could stat the file, reset the counter
                ctdb_counter_init
            fi
index 1d5aaa4d3aad52780a83b22c570c332cc08dd22a..9b9a8cdb6b927f9f38c3fb36c5ffdc6e490bc6d8 100755 (executable)
@@ -13,7 +13,7 @@
 loadconfig
 
 [ -z "$CTDB_PUBLIC_ADDRESSES" ] && {
-       CTDB_PUBLIC_ADDRESSES=$CTDB_BASE/public_addresses
+       CTDB_PUBLIC_ADDRESSES="${CTDB_BASE}/public_addresses"
 }
 
 [ ! -f "$CTDB_PUBLIC_ADDRESSES" ] && {
@@ -27,7 +27,9 @@ loadconfig
 get_all_interfaces ()
 {
     # Get all the interfaces listed in the public_addresses file
-    all_interfaces=$(sed -e "s/^[^\t ]*[\t ]*//" -e "s/,/ /g" -e "s/[\t ]*$//" $CTDB_PUBLIC_ADDRESSES)
+    all_interfaces=$(sed -e "s/^[^\t ]*[\t ]*//" \
+                        -e "s/,/ /g" \
+                        -e "s/[\t ]*$//" "$CTDB_PUBLIC_ADDRESSES")
 
     # Add some special interfaces if they're defined
     [ "$CTDB_PUBLIC_INTERFACE" ] && all_interfaces="$CTDB_PUBLIC_INTERFACE $all_interfaces"
@@ -161,7 +163,7 @@ case "$1" in
        ip=$3
        maskbits=$4
 
-       add_ip_to_iface $iface $ip $maskbits || {
+       add_ip_to_iface "$iface" "$ip" "$maskbits" || {
                exit 1;
        }
 
@@ -189,7 +191,7 @@ case "$1" in
 
        kill_tcp_connections "$iface" "$ip"
 
-       delete_ip_from_iface $iface $ip $maskbits || {
+       delete_ip_from_iface "$iface" "$ip" "$maskbits" || {
                ip_unblock "$ip" "$iface"
                exit 1
        }
@@ -221,10 +223,10 @@ case "$1" in
 
        ip_block "$ip" "$oiface"
 
-       delete_ip_from_iface $oiface $ip $maskbits 2>/dev/null
-       delete_ip_from_iface $niface $ip $maskbits 2>/dev/null
+       delete_ip_from_iface "$oiface" "$ip" "$maskbits" 2>/dev/null
+       delete_ip_from_iface "$niface" "$ip" "$maskbits" 2>/dev/null
 
-       add_ip_to_iface $niface $ip $maskbits || {
+       add_ip_to_iface "$niface" "$ip" "$maskbits" || {
                ip_unblock "$ip" "$oiface"
                exit 1
        }
@@ -234,11 +236,11 @@ case "$1" in
        flush_route_cache
 
        # propagate the new mac address
-       $CTDB gratiousarp $ip $niface
+       $CTDB gratiousarp "$ip" "$niface"
 
        # tickle all existing connections, so that dropped packets
        # are retransmited and the tcp streams work
-       tickle_tcp_connections $ip
+       tickle_tcp_connections "$ip"
        ;;
 
     monitor)
index 980c4c43deb21d4d69b6c33910611f29eb0b32f4..04eea81b43da4f41e4668358000eafcf57b9fe92 100755 (executable)
@@ -91,7 +91,7 @@ _natgw_clear ()
     _maskbits="${CTDB_NATGW_PUBLIC_IP#*/}"
 
     delete_ip_from_iface \
-       $CTDB_NATGW_PUBLIC_IFACE $_ip $_maskbits >/dev/null 2>&1
+       "$CTDB_NATGW_PUBLIC_IFACE" "$_ip" "$_maskbits" >/dev/null 2>&1
     for _net_gw in $CTDB_NATGW_STATIC_ROUTES ; do
        _net="${_net_gw%@*}"
        ip route del "$_net" metric 10 >/dev/null 2>/dev/null
@@ -100,16 +100,16 @@ _natgw_clear ()
     # Delete the masquerading setup from a previous iteration where we
     # were the NAT-GW
     iptables -D POSTROUTING -t nat \
-       -s $CTDB_NATGW_PRIVATE_NETWORK ! -d $CTDB_NATGW_PRIVATE_NETWORK \
+       -s "$CTDB_NATGW_PRIVATE_NETWORK" ! -d "$CTDB_NATGW_PRIVATE_NETWORK" \
        -j MASQUERADE >/dev/null 2>/dev/null
 
-    iptables -D INPUT -p tcp --syn -d $_ip/32 -j REJECT 2>/dev/null
+    iptables -D INPUT -p tcp --syn -d "${_ip}/32" -j REJECT 2>/dev/null
 }
 
 natgw_clear ()
 {
     if [ -r "$natgw_cfg_old" ] ; then
-       (. $natgw_cfg_old ; _natgw_clear)
+       (. "$natgw_cfg_old" ; _natgw_clear)
     else
        _natgw_clear
     fi
@@ -119,17 +119,17 @@ natgw_set_master ()
 {
     set_proc sys/net/ipv4/ip_forward 1
     iptables -A POSTROUTING -t nat \
-       -s $CTDB_NATGW_PRIVATE_NETWORK ! -d $CTDB_NATGW_PRIVATE_NETWORK \
+       -s "$CTDB_NATGW_PRIVATE_NETWORK" ! -d "$CTDB_NATGW_PRIVATE_NETWORK" \
        -j MASQUERADE
 
     # block all incoming connections to the NATGW IP address
     ctdb_natgw_public_ip_host="${CTDB_NATGW_PUBLIC_IP%/*}/32"
     iptables -D INPUT -p tcp --syn \
-       -d $ctdb_natgw_public_ip_host -j REJECT 2>/dev/null
+       -d "$ctdb_natgw_public_ip_host" -j REJECT 2>/dev/null
     iptables -I INPUT -p tcp --syn \
-       -d $ctdb_natgw_public_ip_host -j REJECT 2>/dev/null
+       -d "$ctdb_natgw_public_ip_host" -j REJECT 2>/dev/null
 
-    ip addr add $CTDB_NATGW_PUBLIC_IP dev $CTDB_NATGW_PUBLIC_IFACE
+    ip addr add "$CTDB_NATGW_PUBLIC_IP" dev "$CTDB_NATGW_PUBLIC_IFACE"
     for _net_gw in $CTDB_NATGW_STATIC_ROUTES ; do
        _net="${_net_gw%@*}"
        if [ "$_net" != "$_net_gw" ] ; then
index 20b99730b0ce8b3cdd7c3f62b1b5c60ab3dbd749..87c0027124bdd4bd56c968c84f33667134f966f5 100755 (executable)
@@ -24,7 +24,7 @@
 
 loadconfig
 
-[ -f $CTDB_BASE/static-routes ] || {
+[ -f "${CTDB_BASE}/static-routes" ] || {
     exit 0
 }
 
index 5085f37c88ad1bc9bf60c7a4ac64b23603bcc58c..20f9085383e74c13231b983cbac3c4ca25c09d6e 100755 (executable)
@@ -267,7 +267,7 @@ EOF
     # is invalid.  Therefore, go to a little bit of trouble to indent
     # the failure message so that it is associated with the above
     # warning message and doesn't look too nasty.
-    ip route flush table $_table_id 2>&1 | sed -e 's@^.@  &@'
+    ip route flush table "$_table_id" 2>&1 | sed -e 's@^.@  &@'
 }
 
 ######################################################################
index 3fae7f81613458574deca647e14bd01c16fce233..7c3a804475fe0819a9279f7837af8952ae36d7d2 100755 (executable)
@@ -83,7 +83,7 @@ testparm_foreground_update ()
     _out="${smbconf_cache}.out"
     _err="${smbconf_cache}.err"
 
-    timeout $_timeout testparm -v -s >"$_out" 2>"$_err"
+    timeout "$_timeout" testparm -v -s >"$_out" 2>"$_err"
     case $? in
        0) : ;;
        124)
@@ -123,7 +123,7 @@ testparm_background_update ()
 {
     _timeout="$1"
 
-    testparm_foreground_update $_timeout >/dev/null 2>&1 </dev/null &
+    testparm_foreground_update "$_timeout" >/dev/null 2>&1 </dev/null &
 }
 
 testparm_cat ()
index 36ef980971c21365b01c4e98a37b27256e1fd773..249b22621794e47d83b9de5bf72e2a75c79aa1fa 100755 (executable)
@@ -199,8 +199,8 @@ ctdb_check_rpc ()
            _localhost="${CTDB_RPCINFO_LOCALHOST:-127.0.0.1}"
     esac
 
-    if ! ctdb_check_rpc_out=$(rpcinfo -T $_family $_localhost \
-                                     $_progname $_version 2>&1) ; then
+    if ! ctdb_check_rpc_out=$(rpcinfo -T "$_family" "$_localhost" \
+                                     "$_progname" $_version 2>&1) ; then
        ctdb_check_rpc_out="$_progname failed RPC check:
 $ctdb_check_rpc_out"
        echo "$ctdb_check_rpc_out"
@@ -217,10 +217,10 @@ nfs_check_rpcinfo ()
     for _family in $_families ; do
        if [ -n "$_versions" ] ; then
            for _version in $_versions ; do
-               ctdb_check_rpc $_progname $_version $_family || return $?
+               ctdb_check_rpc "$_progname" "$_version" "$_family" || return $?
            done
        else
-           ctdb_check_rpc $_progname "" $_family || return $?
+           ctdb_check_rpc "$_progname" "" "$_family" || return $?
        fi
     done
 }
index 7e27a53956461e45b53b40a711e45a26470e8e3c..2d9e4a64fa18c053c9acdcc9077f65a52306de2f 100755 (executable)
@@ -54,7 +54,7 @@ EOF
        tgtd >/dev/null 2>&1
 
        # Run a script for each currently hosted public IP address
-       ips=$(echo "$all_ips" | awk -F'|' -v pnn=$pnn '$3 == pnn {print $2}')
+       ips=$(echo "$all_ips" | awk -F'|' -v pnn="$pnn" '$3 == pnn {print $2}')
        for ip in $ips ; do
            script="${CTDB_START_ISCSI_SCRIPTS}/${ip}.sh"
            if [ -x "$script" ] ; then
index 1d3f7331fd685d17cff21931ee14dd2809a6b78d..c758b732685d526f467c859caad7e3432f9a46f6 100755 (executable)
@@ -101,8 +101,8 @@ ipreallocated)
        "${CTDB_HELPER_BINDIR}/ctdb_lvs" list |
        awk -v pnn="$pnn" '$1 != pnn { print $2 }' |
        while read ip ; do
-               ipvsadm -a -t "$CTDB_LVS_PUBLIC_IP" -r $ip -g
-               ipvsadm -a -u "$CTDB_LVS_PUBLIC_IP" -r $ip -g
+               ipvsadm -a -t "$CTDB_LVS_PUBLIC_IP" -r "$ip" -g
+               ipvsadm -a -u "$CTDB_LVS_PUBLIC_IP" -r "$ip" -g
        done
 
        # Add localhost too...
index d3e422ca6eff09b30c2d316df617a794453f673a..64b7c012d90adca8b7a4371f1518a48501e125bc 100755 (executable)
@@ -70,12 +70,12 @@ _loadconfig() {
        return
     fi
 
-    if [ -f $CTDB_SYS_ETCDIR/sysconfig/$1 ]; then
-       . $CTDB_SYS_ETCDIR/sysconfig/$1
-    elif [ -f $CTDB_SYS_ETCDIR/default/$1 ]; then
-       . $CTDB_SYS_ETCDIR/default/$1
-    elif [ -f $CTDB_BASE/sysconfig/$1 ]; then
-       . $CTDB_BASE/sysconfig/$1
+    if [ -f "${CTDB_SYS_ETCDIR}/sysconfig/$1" ]; then
+       . "${CTDB_SYS_ETCDIR}/sysconfig/$1"
+    elif [ -f "${CTDB_SYS_ETCDIR}/default/$1" ]; then
+       . "${CTDB_SYS_ETCDIR}/default/$1"
+    elif [ -f "${CTDB_BASE}/sysconfig/$1" ]; then
+       . "${CTDB_BASE}/sysconfig/$1"
     fi
 
     if [ "$1" = "ctdb" ] ; then
@@ -97,7 +97,7 @@ loadconfig () {
 # configuration file.
 debug ()
 {
-    if [ ${CTDB_SCRIPT_DEBUGLEVEL:-2} -ge 4 ] ; then
+    if [ "${CTDB_SCRIPT_DEBUGLEVEL:-2}" -ge 4 ] ; then
        # If there are arguments then echo them.  Otherwise expect to
        # use stdin, which allows us to pass lots of debug using a
        # here document.
@@ -146,7 +146,7 @@ script_log ()
        *)
            # Handle all syslog:* variants here too.  There's no tool to do
            # the lossy things, so just use logger.
-           logger -t "ctdbd: ${_tag}" $*
+           logger -t "ctdbd: ${_tag}" "$*"
            ;;
     esac
 }
@@ -217,10 +217,10 @@ _service ()
       $_nice /usr/sbin/service "$_service_name" "$_op"
   elif [ -x /bin/systemctl ]; then
       $_nice /bin/systemctl "$_op" "$_service_name"
-  elif [ -x $CTDB_SYS_ETCDIR/init.d/$_service_name ]; then
-      $_nice $CTDB_SYS_ETCDIR/init.d/$_service_name "$_op"
-  elif [ -x $CTDB_SYS_ETCDIR/rc.d/init.d/$_service_name ]; then
-      $_nice $CTDB_SYS_ETCDIR/rc.d/init.d/$_service_name "$_op"
+  elif [ -x "${CTDB_SYS_ETCDIR}/init.d/${_service_name}" ]; then
+      $_nice "${CTDB_SYS_ETCDIR}/init.d/${_service_name}" "$_op"
+  elif [ -x "${CTDB_SYS_ETCDIR}/rc.d/init.d/${_service_name}" ]; then
+      $_nice "${CTDB_SYS_ETCDIR}/rc.d/init.d/${_service_name}" "$_op"
   fi
 }
 
@@ -488,7 +488,7 @@ kill_tcp_connections ()
                return
        }
 
-       _remaining=$(get_tcp_connections_for_ip $_ip | wc -l)
+       _remaining=$(get_tcp_connections_for_ip "$_ip" | wc -l)
 
        if [ $_remaining -eq 0 ] ; then
                echo "Killed $_killcount TCP connections to released IP $_ip"
@@ -521,9 +521,9 @@ tickle_tcp_connections ()
 
        while read dest src; do
            echo "Tickle TCP connection $src $dest"
-           $CTDB tickle $src $dest >/dev/null 2>&1 || _failed=true
+           $CTDB tickle "$src" "$dest" >/dev/null 2>&1 || _failed=true
            echo "Tickle TCP connection $dest $src"
-           $CTDB tickle $dest $src >/dev/null 2>&1 || _failed=true
+           $CTDB tickle "$dest" "$src" >/dev/null 2>&1 || _failed=true
        done
 
        if $_failed ; then
@@ -626,12 +626,12 @@ drop_ip ()
 {
     _addr="${1%/*}"  # Remove optional maskbits
 
-    set -- $(ip_maskbits_iface $_addr)
+    set -- $(ip_maskbits_iface "$_addr")
     if [ -n "$1" ] ; then
        _maskbits="$1"
        _iface="$2"
        echo "Removing public address $_addr/$_maskbits from device $_iface"
-       delete_ip_from_iface $_iface $_addr $_maskbits >/dev/null 2>&1
+       delete_ip_from_iface "$_iface" "$_addr" "$_maskbits" >/dev/null 2>&1
     fi
 }
 
@@ -1244,7 +1244,7 @@ update_tickles ()
        ctdb_get_pnn
 
        # What public IPs do I hold?
-       _ips=$($CTDB -X ip | awk -F'|' -v pnn=$pnn '$3 == pnn {print $2}')
+       _ips=$($CTDB -X ip | awk -F'|' -v pnn="$pnn" '$3 == pnn {print $2}')
 
        # IPs and port as ss filters
        _ip_filter=""
@@ -1269,7 +1269,7 @@ update_tickles ()
        # Record our current tickles in a temporary file
        _my_tickles="${tickledir}/${_port}.tickles.$$"
        for _i in $_ips ; do
-               $CTDB -X gettickles $_i $_port |
+               $CTDB -X gettickles "$_i" "$_port" |
                awk -F'|' 'NR > 1 { printf "%s:%s %s:%s\n", $2, $3, $4, $5 }'
        done |
        sort >"$_my_tickles"
@@ -1277,13 +1277,13 @@ update_tickles ()
        # Add tickles for connections that we haven't already got tickles for
        comm -23 "$_my_connections" "$_my_tickles" |
        while read _src _dst ; do
-               $CTDB addtickle $_src $_dst
+               $CTDB addtickle "$_src" "$_dst"
        done
 
        # Remove tickles for connections that are no longer there
        comm -13 "$_my_connections" "$_my_tickles" |
        while read _src _dst ; do
-               $CTDB deltickle $_src $_dst
+               $CTDB deltickle "$_src" "$_dst"
        done
 
        rm -f "$_my_connections" "$_my_tickles"
@@ -1300,12 +1300,12 @@ update_tickles ()
        . "$CTDB_RC_LOCAL"
 }
 
-[ -x $CTDB_BASE/rc.local ] && {
-       . $CTDB_BASE/rc.local
+[ -x "${CTDB_BASE}/rc.local" ] && {
+       . "${CTDB_BASE}/rc.local"
 }
 
-[ -d $CTDB_BASE/rc.local.d ] && {
-       for i in $CTDB_BASE/rc.local.d/* ; do
+[ -d "${CTDB_BASE}/rc.local.d" ] && {
+       for i in "${CTDB_BASE}/rc.local.d"/* ; do
                [ -x "$i" ] && . "$i"
        done
 }
index 3b457be0ba61864297fc84dea4851bb853342fc5..9424d9a96cf9249c228b73d238fd570bd35b68d7 100755 (executable)
@@ -36,7 +36,7 @@ fi
 
 usage ()
 {
-    _c=$(basename $0)
+    _c=$(basename "$0")
     cat <<EOF
 usage: $_c { shutdown | startup }
        $_c { stop | start } { nfs | nlockmgr }
index dfcb81a5516132bb54fed832945f2f88cc620a68..d98f04660a147b8e9e6de7562fc6dfe20e7150f7 100755 (executable)
@@ -6,7 +6,7 @@
 # This is script is invoked from ctdb when certain events happen.  See
 # /etc/ctdb/notify.d/README for more details.
 
-d=$(dirname $0)
+d=$(dirname "$0")
 nd="${d}/notify.d"
 
 ok=true
index 4e8ae9a1e88d0632f9a2ac78a853187ef2801690..509ed182c06bc452b7eadb2f3cf53f32b9ca62fb 100755 (executable)
@@ -83,7 +83,7 @@ case "$1" in
        ctdb_get_pnn
        ctdb_ips=$($CTDB ip | tail -n +2)
        sed_expr=$(echo "$ctdb_ips" |
-           awk -v pnn=$pnn 'pnn == $2 { \
+           awk -v pnn="$pnn" 'pnn == $2 { \
                 ip = $1; gsub(/\./, "\\.", ip); \
                 printf "/statd-state@%s@/p\n", ip }')
         if cat $files | sed -n "$sed_expr" | $CTDB ptrans "ctdb.tdb" ; then
@@ -161,7 +161,7 @@ case "$1" in
        # but only for the server-IPs that are hosted on this node.
        ctdb_all_ips=$($CTDB ip all | tail -n +2)
        sed_expr=$(echo "$ctdb_all_ips" |
-           awk -v pnn=$pnn 'pnn == $2 { \
+           awk -v pnn="$pnn" 'pnn == $2 { \
                 ip = $1; gsub(/\./, "\\.", ip); \
                 printf "s/^key.*=.*statd-state@\\(%s\\)@\\([^\"]*\\).*/\\1 \\2/p\n", ip }')
 
@@ -187,12 +187,16 @@ case "$1" in
                # Reset stateval for each serverip
                [ "$sip" = "$prev" ] || stateval="$state_even"
                # Send notifies for server shutdown
-               "$smnotify" --client=$cip --ip=$sip --server=$sip --stateval=$stateval
-               "$smnotify" --client=$cip --ip=$sip --server=$NFS_HOSTNAME --stateval=$stateval
+               "$smnotify" --client="$cip" --ip="$sip" \
+                           --server="$sip" --stateval="$stateval"
+               "$smnotify" --client="$cip" --ip="$sip" \
+                           --server="$NFS_HOSTNAME" --stateval="$stateval"
                # Send notifies for server startup
                stateval=$(($stateval + 1))
-               "$smnotify" --client=$cip --ip=$sip --server=$sip --stateval=$stateval
-               "$smnotify" --client=$cip --ip=$sip --server=$NFS_HOSTNAME --stateval=$stateval
+               "$smnotify" --client="$cip" --ip="$sip" \
+                           --server="$sip" --stateval="$stateval"
+               "$smnotify" --client="$cip" --ip="$sip" \
+                           --server="$NFS_HOSTNAME" --stateval="$stateval"
            done
 
            echo "$items" | $CTDB ptrans "ctdb.tdb"
@@ -202,7 +206,7 @@ case "$1" in
        # hosted on this node and created since the last "update").
        # There's nothing else we can do with them at this stage.
        echo "$ctdb_all_ips" |
-           awk -v pnn=$pnn 'pnn != $2 { print $1 }' |
+           awk -v pnn="$pnn" 'pnn != $2 { print $1 }' |
            while read sip ; do
                rm -f "statd-state@${sip}@"*
            done