mirror of
https://github.com/samba-team/samba.git
synced 2025-01-07 17:18:11 +03:00
ctdb-scripts: Avoid ShellCheck warning SC2295
For example: In /home/martins/samba/samba/ctdb/tools/onnode line 304: [ "$nodes" != "${nodes%[ ${nl}]*}" ] && verbose=true ^---^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: [ "$nodes" != "${nodes%[ "${nl}"]*}" ] && verbose=true For more information: https://www.shellcheck.net/wiki/SC2295 -- Expansions inside ${..} need to b... Who knew? Thanks ShellCheck! Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
00f1d6d947
commit
db37043bc5
ctdb
@ -346,7 +346,7 @@ remove_bogus_routes ()
|
|||||||
# be done with grep, but let's do it with shell prefix removal
|
# be done with grep, but let's do it with shell prefix removal
|
||||||
# to avoid unnecessary processes. This falls through if
|
# to avoid unnecessary processes. This falls through if
|
||||||
# "@${_i}@" isn't present in $_ips.
|
# "@${_i}@" isn't present in $_ips.
|
||||||
[ "$_ips" = "${_ips#*@${_i}@}" ] || continue
|
[ "$_ips" = "${_ips#*@"${_i}"@}" ] || continue
|
||||||
|
|
||||||
echo "Removing ip rule/routes for unhosted public address $_i"
|
echo "Removing ip rule/routes for unhosted public address $_i"
|
||||||
del_routing_for_ip "$_i"
|
del_routing_for_ip "$_i"
|
||||||
|
@ -235,7 +235,7 @@ run_one_test ()
|
|||||||
local test_dir test_suite_dir reldir
|
local test_dir test_suite_dir reldir
|
||||||
test_dir=$(cd "$CTDB_TEST_DIR" && pwd)
|
test_dir=$(cd "$CTDB_TEST_DIR" && pwd)
|
||||||
test_suite_dir=$(cd "$CTDB_TEST_SUITE_DIR" && pwd)
|
test_suite_dir=$(cd "$CTDB_TEST_SUITE_DIR" && pwd)
|
||||||
reldir="${test_suite_dir#${test_dir}/}"
|
reldir="${test_suite_dir#"${test_dir}"/}"
|
||||||
|
|
||||||
export CTDB_TEST_TMP_DIR="${test_state_dir}/${reldir}"
|
export CTDB_TEST_TMP_DIR="${test_state_dir}/${reldir}"
|
||||||
rm -rf "$CTDB_TEST_TMP_DIR"
|
rm -rf "$CTDB_TEST_TMP_DIR"
|
||||||
@ -260,7 +260,7 @@ run_tests ()
|
|||||||
# Can't find it? Check relative to CTDB_TEST_DIR.
|
# Can't find it? Check relative to CTDB_TEST_DIR.
|
||||||
# Strip off current directory from beginning,
|
# Strip off current directory from beginning,
|
||||||
# if there, just to make paths more friendly.
|
# if there, just to make paths more friendly.
|
||||||
f="${CTDB_TEST_DIR#${PWD}/}/${f}"
|
f="${CTDB_TEST_DIR#"${PWD}"/}/${f}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$f" ] ; then
|
if [ -d "$f" ] ; then
|
||||||
@ -268,7 +268,7 @@ run_tests ()
|
|||||||
|
|
||||||
test_dir=$(cd "$CTDB_TEST_DIR" && pwd)
|
test_dir=$(cd "$CTDB_TEST_DIR" && pwd)
|
||||||
dir=$(cd "$f" && pwd)
|
dir=$(cd "$f" && pwd)
|
||||||
reldir="${dir#${test_dir}/}"
|
reldir="${dir#"${test_dir}"/}"
|
||||||
|
|
||||||
case "$reldir" in
|
case "$reldir" in
|
||||||
*/*/*)
|
*/*/*)
|
||||||
|
@ -469,8 +469,10 @@ node_has_status ()
|
|||||||
while read -r line ; do
|
while read -r line ; do
|
||||||
# This needs to be done in 2 steps to
|
# This needs to be done in 2 steps to
|
||||||
# avoid false matches.
|
# avoid false matches.
|
||||||
local line_bits="${line#|${pnn}|*|}"
|
local line_bits="${line#|"${pnn}"|*|}"
|
||||||
[ "$line_bits" = "$line" ] && continue
|
[ "$line_bits" = "$line" ] && continue
|
||||||
|
# shellcheck disable=SC2295
|
||||||
|
# This depends on $bits being a pattern
|
||||||
[ "${line_bits#${bits}}" != "$line_bits" ] && \
|
[ "${line_bits#${bits}}" != "$line_bits" ] && \
|
||||||
return 0
|
return 0
|
||||||
done
|
done
|
||||||
|
@ -148,7 +148,7 @@ get_nodes_with_status ()
|
|||||||
fi
|
fi
|
||||||
local nl="
|
local nl="
|
||||||
"
|
"
|
||||||
ctdb_status_output="${ctdb_status_output#*${nl}}"
|
ctdb_status_output="${ctdb_status_output#*"${nl}"}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
@ -301,7 +301,7 @@ else
|
|||||||
# If $nodes contains a space or a newline then assume multiple nodes.
|
# If $nodes contains a space or a newline then assume multiple nodes.
|
||||||
nl="
|
nl="
|
||||||
"
|
"
|
||||||
[ "$nodes" != "${nodes%[ ${nl}]*}" ] && verbose=true
|
[ "$nodes" != "${nodes%[ "${nl}"]*}" ] && verbose=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pids=""
|
pids=""
|
||||||
|
Loading…
Reference in New Issue
Block a user