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...
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
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
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.
# 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
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
# 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