summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hansen <rhansen@rhansen.org>2023-04-21 17:41:49 -0400
committerRobert Ancell <robert.ancell@gmail.com>2023-04-26 09:33:47 +1200
commitfa1ea6730fe7011d6f20e0589e9beb72af33eedd (patch)
tree9fdb652680ca51cc97e44ba8ceccc97f44474f3c
parentad2cfccff88ff7ebf79ba77bbdc043cda34e20a1 (diff)
downloadlightdm-git-fa1ea6730fe7011d6f20e0589e9beb72af33eedd.tar.gz
tests: Don't redirect /tmp/dbus-* to $LIGHTDM_TEST_ROOT/tmp/dbus-*
-rw-r--r--tests/src/libsystem.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/src/libsystem.c b/tests/src/libsystem.c
index 1c68dc10..a02cfa12 100644
--- a/tests/src/libsystem.c
+++ b/tests/src/libsystem.c
@@ -207,6 +207,27 @@ redirect_path (const gchar *path)
if (g_str_has_prefix (path, BUILDDIR))
return g_strdup (path);
+ /*
+ * Don't redirect /tmp/dbus-* so that the test runner and its invoked
+ * LightDM can interact with the D-Bus daemon launched by dbus-env.c. The
+ * D-Bus config has <listen>unix:tmpdir=/tmp</listen>, and with that config
+ * the D-Bus specification [1] says that the daemon will create a socket
+ * whose name matches /tmp/dbus-*.
+ *
+ * (With unix:tmpdir, dbus-daemon is allowed, but not required, to create
+ * abstract sockets instead of file-based sockets. Abstract sockets are
+ * unaffected by the redirection of /tmp to $LIGHTDM_TEST_ROOT because they
+ * don't actually exist in the filesystem. An exception is required here
+ * anyway because not all systems support abstract sockets, and starting
+ * with v1.15.2 dbus-daemon doesn't use abstract sockets even on systems
+ * that support them [2].)
+ *
+ * [1] https://dbus.freedesktop.org/doc/dbus-specification.html#transports-unix-domain-sockets-addresses
+ * [2] https://gitlab.freedesktop.org/dbus/dbus/-/blob/35ade3c8f7aca16d1c6289828a2597859d1c503b/NEWS#L129-L147
+ */
+ if (g_str_has_prefix (path, "/tmp/dbus-"))
+ return g_strdup (path);
+
if (g_str_has_prefix (path, "/tmp"))
return g_build_filename (g_getenv ("LIGHTDM_TEST_ROOT"), "tmp", path + strlen ("/tmp"), NULL);