ctdb-scripts: Fix a regression in statd-callout
authorMartin Schwenke <martin@meltin.net>
Thu, 26 Feb 2015 04:34:51 +0000 (15:34 +1100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 27 Apr 2015 21:54:48 +0000 (23:54 +0200)
Commit 4638010abb116aed0c180207aaa11475277aecb7 changed from using
gensub() to gsub() in awk.  However, it didn't halve the number of
backslashes in the target strings.  This is necessary because
backslash is used in gensub() target strings to allow substitution of
text matching parenthesised subexpressions.  This is not the case with
gsub().

So, halve the number of backslashes in the target string where gsub()
is used in statd-callout.  This is the only target string broken by
changes made by the above commit

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 032441d9a2974584cde455e4dbd5cc33fe6a23c2)

ctdb/config/statd-callout

index e2a955eab5fa7dafc646776cb2a80e6c3aaf44ee..b92942557f3e7fde985b0980bc038ad85d2f7f7f 100755 (executable)
@@ -146,7 +146,7 @@ case "$1" in
        # but only for the server-IPs that are hosted on this node.
        sed_expr=$(ctdb ip | tail -n +2 |
            awk -v pnn=$pnn 'pnn == $2 { \
-                ip = $1; gsub(/\./, "\\\\.", ip); \
+                ip = $1; gsub(/\./, "\\.", ip); \
                 printf "s/^key.*=.*statd-state@\\(%s\\)@\\([^\"]*\\).*/\\1 \\2/p\n", ip }')
 
        statd_state=$(ctdb catdb ctdb.tdb | sed -n "$sed_expr" | sort)