ctdb-event: Force EVENTSCRIPTS_TESTS_VAR_DIR to be absolute
authorMartin Schwenke <martin@meltin.net>
Fri, 7 Sep 2018 06:02:25 +0000 (16:02 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 18 Dec 2018 01:02:04 +0000 (02:02 +0100)
Event scripts (well, statd_callout) can change directory, causing
stubs to be unable to locate EVENTSCRIPTS_TESTS_VAR_DIR if it is
relative.

Don't force TEST_VAR_DIR to be absolute because this can result in
Unix domain socket names that are too long.

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

index ad683cf9934e600873a69653c6d107aaaf6906bd..c0eb72badd1d10f5cd99987ee61844cfcb18ce4d 100644 (file)
@@ -28,6 +28,9 @@ if [ -d "$EVENTSCRIPTS_TESTS_VAR_DIR" ] ; then
 fi
 mkdir -p "$EVENTSCRIPTS_TESTS_VAR_DIR"
 
+# Force this to be absolute - event scripts can change directory
+EVENTSCRIPTS_TESTS_VAR_DIR=$(cd "$EVENTSCRIPTS_TESTS_VAR_DIR" && echo "$PWD")
+
 export CTDB_LOGGING="file:${EVENTSCRIPTS_TESTS_VAR_DIR}/log.ctdb"
 touch "${CTDB_LOGGING#file:}" || \
     die "Unable to setup logging for \"$CTDB_LOGGING\""