The Samba-Bugzilla – Attachment 10938 Details for
Bug 11202
CTDB has portability issues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patches for 4.2
v4-2-test-bz11202.patch (text/plain), 6.64 KB, created by
Martin Schwenke
on 2015-04-09 05:12:55 UTC
(
hide
)
Description:
Patches for 4.2
Filename:
MIME Type:
Creator:
Martin Schwenke
Created:
2015-04-09 05:12:55 UTC
Size:
6.64 KB
patch
obsolete
>From 18740ab6cc8a3914e3313e0578546366225a9269 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 1 Dec 2014 12:21:16 +1100 >Subject: [PATCH 1/3] ctdb-scripts: Try to deal with Ubuntu having > /usr/sbin/service > >Falling back to running the initscript doesn't work because it detects >that upstart is being used and fails. This was observed when trying >to start winbind on Ubuntu 11.04. > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Michael Adam <obnox@samba.org> >(cherry picked from commit a5c5eee7d186d938c5b458cb6dbf0c78cb548b63) >--- > ctdb/config/functions | 2 ++ > 1 file changed, 2 insertions(+) > >diff --git a/ctdb/config/functions b/ctdb/config/functions >index 1583bfc..e900f7f 100755 >--- a/ctdb/config/functions >+++ b/ctdb/config/functions >@@ -161,6 +161,8 @@ _service () > > if [ -x /sbin/service ]; then > $_nice /sbin/service "$_service_name" "$_op" >+ elif [ -x /usr/sbin/service ]; then >+ $_nice /usr/sbin/service "$_service_name" "$_op" > elif [ -x $CTDB_ETCDIR/init.d/$_service_name ]; then > $_nice $CTDB_ETCDIR/init.d/$_service_name "$_op" > elif [ -x $CTDB_ETCDIR/rc.d/init.d/$_service_name ]; then >-- >2.1.4 > > >From 44ea993dbd948d2866b4251c09a3ede35911dd4a Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Fri, 19 Dec 2014 14:19:32 +1100 >Subject: [PATCH 2/3] ctdb-scripts: Don't use the GNU awk gensub() function > >This is a gawk extension and can't be used reliably if just running >"awk". It is simple enough to switch to using the standard sub() and >gsub() functions. > >The alternative is to switch to explicitly running "gawk". However, >although the eventscripts aren't exactly portable, it is probably >better to move closer to portability than further away. > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Michael Adam <obnox@samba.org> >(cherry picked from commit 4638010abb116aed0c180207aaa11475277aecb7) >--- > ctdb/config/functions | 7 ++++--- > ctdb/config/statd-callout | 4 +++- > ctdb/tests/complex/18_ctdb_reloadips.sh | 2 +- > ctdb/tests/scripts/integration.bash | 5 +++-- > 4 files changed, 11 insertions(+), 7 deletions(-) > >diff --git a/ctdb/config/functions b/ctdb/config/functions >index e900f7f..8707413 100755 >--- a/ctdb/config/functions >+++ b/ctdb/config/functions >@@ -890,7 +890,7 @@ delete_ip_from_iface() > } > } > >-# If the given IP is hosted then print 2 items: maskbits and iface >+# If the given IP is hosted then print 2 items: maskbits and iface > ip_maskbits_iface () > { > _addr="$1" >@@ -902,8 +902,9 @@ ip_maskbits_iface () > > ip addr show to "${_addr}/${_bits}" 2>/dev/null | \ > awk -v family="${_family}" \ >- 'NR == 1 { iface = gensub(":$", "", 1, $2) } \ >- $1 ~ /inet/ { print gensub(".*/", "", 1, $2), iface, family }' >+ 'NR == 1 { iface = $2; sub(":$", "", iface) } \ >+ $1 ~ /inet/ { mask = $2; sub(".*/", "", mask); \ >+ print mask, iface, family }' > } > > drop_ip () >diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout >index 5e8eb0e..e2a955e 100755 >--- a/ctdb/config/statd-callout >+++ b/ctdb/config/statd-callout >@@ -145,7 +145,9 @@ case "$1" in > # server-IP client-IP > # 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 { printf "s/^key.*=.*statd-state@\\(%s\\)@\\([^\"]*\\).*/\\1 \\2/p\n", gensub(/\./, "\\\\.", "g", $1) }') >+ awk -v pnn=$pnn 'pnn == $2 { \ >+ 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) > [ -n "$statd_state" ] || exit 0 >diff --git a/ctdb/tests/complex/18_ctdb_reloadips.sh b/ctdb/tests/complex/18_ctdb_reloadips.sh >index 13f7c21..71f997c 100755 >--- a/ctdb/tests/complex/18_ctdb_reloadips.sh >+++ b/ctdb/tests/complex/18_ctdb_reloadips.sh >@@ -56,7 +56,7 @@ ctdb_ip_info=$(echo "$out" | awk -F'|' 'NR > 1 { print $2, $3, $5 }') > echo "Getting IP information from interfaces..." > try_command_on_node all "ip addr show" > ip_addr_info=$(echo "$out" | \ >- awk '$1 == "inet" { print gensub(/\/.*/, "", "", $2)}') >+ awk '$1 == "inet" { ip = $2; sub(/\/.*/, "", ip); print ip }') > > prefix="" > for b in $(seq 0 255) ; do >diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash >index 0d27c93..139a9a2 100644 >--- a/ctdb/tests/scripts/integration.bash >+++ b/ctdb/tests/scripts/integration.bash >@@ -699,8 +699,9 @@ ip_maskbits_iface () > > ip addr show to "${_addr}/${_bits}" 2>/dev/null | \ > awk -v family="${_family}" \ >- 'NR == 1 { iface = gensub(":$", "", 1, $2) } \ >- $1 ~ /inet/ { print gensub(".*/", "", 1, $2), iface, family }' >+ 'NR == 1 { iface = $2; sub(":$", "", iface) } \ >+ $1 ~ /inet/ { mask = $2; sub(".*/", "", mask); \ >+ print mask, iface, family }' > } > > drop_ip () >-- >2.1.4 > > >From ba80e188fcd47b761839e58754c595437742dc7b Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 16 Feb 2015 14:04:09 +1100 >Subject: [PATCH 3/3] ctdb-scripts: Fix tunable setup code by making it > shell-agnostic > >All tunables set in configuration are currently set to 0 on system >where /bin/sh is dash (and perhaps other non-bash shells). dash puts >single quotes around all values in the output of the "set" builtin >command, whereas bash only puts them around values when something >needs to be quoted. Tunables always have a simple integer value so >dash will quote them and bash won't. The setup code currently passes >the raw value, including any quotes to "ctdb setvar ...". This >command does no error checking on the input, so "'1'" is converted to >0. > >Change the code so that the value is determined from the shell >variable and is independent of the "set" output. > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 39686f45056d942de5ebe3263a533a99ca17c79e) >--- > ctdb/config/events.d/00.ctdb | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/ctdb/config/events.d/00.ctdb b/ctdb/config/events.d/00.ctdb >index a0f4102..c3754ae 100755 >--- a/ctdb/config/events.d/00.ctdb >+++ b/ctdb/config/events.d/00.ctdb >@@ -121,10 +121,10 @@ update_config_from_tdb() { > > set_ctdb_variables () { > # set any tunables from the config file >- set | grep ^CTDB_SET_ | cut -d_ -f3- | >+ set | sed -n '/^CTDB_SET_/s/=.*//p' | > while read v; do >- varname=`echo $v | cut -d= -f1` >- value=`echo $v | cut -d= -f2` >+ varname="${v#CTDB_SET_}" >+ value=$(eval echo "\$$v") > ctdb setvar $varname $value || return 1 > echo "Set $varname to $value" > done >-- >2.1.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
amitay
:
review+
Actions:
View
Attachments on
bug 11202
: 10938