summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-04-19 11:54:26 +1000
committerAmitay Isaacs <amitay@samba.org>2018-04-27 06:53:16 +0200
commitd8741feec533934e02bd54b7bcc4fb71dbe1a1e1 (patch)
tree9f524280db9e360f2d969c478ea8d74e691e578d /ctdb
parent7dbf83369705bf2fe7c4d6b79ddf794ea8adb5db (diff)
downloadsamba-d8741feec533934e02bd54b7bcc4fb71dbe1a1e1.tar.gz
ctdb-scripts: Avoid shellcheck SC1117: Backslash is literal in "..."
This warning (apparently new in shellcheck 0.4.7) only applies to double-quoted strings. Change affected constant strings to use single-quotes. In the one example that contains a variable expansion escape the backslash as recommended. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rwxr-xr-xctdb/config/debug-hung-script.sh2
-rwxr-xr-xctdb/config/debug_locks.sh4
-rwxr-xr-xctdb/config/events.d/10.interface6
-rwxr-xr-xctdb/config/events.d/13.per_ip_routing4
-rwxr-xr-xctdb/tools/ctdb_natgw2
5 files changed, 9 insertions, 9 deletions
diff --git a/ctdb/config/debug-hung-script.sh b/ctdb/config/debug-hung-script.sh
index dc9c6e1ac7f..d6ff833a43e 100755
--- a/ctdb/config/debug-hung-script.sh
+++ b/ctdb/config/debug-hung-script.sh
@@ -36,7 +36,7 @@ fi
default_pat='exportfs|rpcinfo'
pat="${CTDB_DEBUG_HUNG_SCRIPT_STACKPAT:-${default_pat}}"
echo "$out" |
- sed -r -n "s@.*-(.*(${pat}).*),([0-9]*).*@\3 \1@p" |
+ sed -r -n "s@.*-(.*(${pat}).*),([0-9]*).*@\\3 \\1@p" |
while read pid name ; do
trace=$(cat "/proc/${pid}/stack" 2>/dev/null)
# No! Checking the exit code afterwards is actually clearer...
diff --git a/ctdb/config/debug_locks.sh b/ctdb/config/debug_locks.sh
index 0f8aaad67d2..3feb121e2ba 100755
--- a/ctdb/config/debug_locks.sh
+++ b/ctdb/config/debug_locks.sh
@@ -39,7 +39,7 @@ loadconfig
while read pid rest ; do
pname=$(readlink "/proc/${pid}/exe")
echo "$pid $pname $rest"
- done | sed -e "$sed_cmd" | grep "\.tdb" )
+ done | sed -e "$sed_cmd" | grep '\.tdb' )
if [ -n "$out" ]; then
# Log information about locks
@@ -54,7 +54,7 @@ loadconfig
done
# Use word splitting to squash whitespace
# shellcheck disable=SC2086
- pids=$(echo $all_pids | tr " " "\n" | sort -u)
+ pids=$(echo $all_pids | tr ' ' '\n' | sort -u)
# For each process waiting, log stack trace
for pid in $pids ; do
diff --git a/ctdb/config/events.d/10.interface b/ctdb/config/events.d/10.interface
index 28a7e5b11a3..72e0c101d47 100755
--- a/ctdb/config/events.d/10.interface
+++ b/ctdb/config/events.d/10.interface
@@ -25,9 +25,9 @@ fi
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")
# Get the interfaces for which CTDB has public IPs configured.
# That is, for all but the 1st line, get the 1st field.
diff --git a/ctdb/config/events.d/13.per_ip_routing b/ctdb/config/events.d/13.per_ip_routing
index ae5a0b9186a..269829483ab 100755
--- a/ctdb/config/events.d/13.per_ip_routing
+++ b/ctdb/config/events.d/13.per_ip_routing
@@ -158,7 +158,7 @@ ensure_table_id_for_ip ()
# If the new table id is legal then add it to the file and
# print it.
if [ "$_new" -le "$CTDB_PER_IP_ROUTING_TABLE_ID_HIGH" ] ; then
- printf "%d\t%s\n" "$_new" "$_label" >>"$rt_tables"
+ printf '%d\t%s\n' "$_new" "$_label" >>"$rt_tables"
return 0
else
return 1
@@ -211,7 +211,7 @@ get_config_for_ip ()
else
while read _i _rest ; do
if [ "$_ip" = "$_i" ] ; then
- printf "%s\t%s\n" "$_ip" "$_rest"
+ printf '%s\t%s\n' "$_ip" "$_rest"
fi
done <"$CTDB_PER_IP_ROUTING_CONF"
fi
diff --git a/ctdb/tools/ctdb_natgw b/ctdb/tools/ctdb_natgw
index b17624155bf..21744ddfd0f 100755
--- a/ctdb/tools/ctdb_natgw
+++ b/ctdb/tools/ctdb_natgw
@@ -152,7 +152,7 @@ nodes_list ()
# format string must contain no variables. Some shells will
# expand a tab if it is in an argument but others won't.
if [ -n "$_options" ] ; then
- printf "%s\t%s\n" "$_ip" "$_options"
+ printf '%s\t%s\n' "$_ip" "$_options"
else
echo "$_ip"
fi