ctdb-tests: Make sure empty override values are properly quoted
authorMartin Schwenke <martin@meltin.net>
Fri, 13 May 2016 21:13:41 +0000 (07:13 +1000)
committerMartin Schwenke <martins@samba.org>
Thu, 26 May 2016 06:04:29 +0000 (08:04 +0200)
With an empty value the first expression adds a trailing opening
quote, so the second expression doesn't add the closing quote.  Handle
this with a special case.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/simple/scripts/local_daemons.bash

index 92e6fa4315b609abc2f48f3f60bb53111ade63e1..fc0e47d57620eff5123cb08c5616cec8de5dfb8a 100644 (file)
@@ -133,7 +133,9 @@ EOF
 
     # Override from the environment.  This would be easier if env was
     # guaranteed to quote its output so it could be reused.
-    env | grep '^CTDB_' | sed -e 's@=\([^"]\)@="\1@' -e 's@[^"]$@&"@' >>"$conf"
+    env |
+    grep '^CTDB_' |
+    sed -e 's@=\([^"]\)@="\1@' -e 's@[^"]$@&"@' -e 's@="$@&"@' >>"$conf"
 
     # We'll use "pkill -f" to kill the daemons with
     # "ctdbd --sloppy-start --nopublicipcheck --nosetsched" as context.