From: William Earley Date: Sun, 27 Sep 2020 11:39:04 +0000 (+0100) Subject: dbus-launch: Replace slashes in DISPLAY if present X-Git-Tag: dbus-1.13.20~49^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3545d0f4de0194ced1fde6935fd7d1326dd9e832;p=thirdparty%2Fdbus.git dbus-launch: Replace slashes in DISPLAY if present dbus-daemon fails to autolaunch with X11 on macOS 10.8+ because XQuartz (the X11 package for macOS) provides a value for `$DISPLAY` that is not expected by dbus, in that it contains `/` characters. This is addressed by replacing the invalid path character `/` with `_`. Resolves: #8 Resolves: #311 --- diff --git a/tools/dbus-launch-x11.c b/tools/dbus-launch-x11.c index c4b97904d..0b5d2928b 100644 --- a/tools/dbus-launch-x11.c +++ b/tools/dbus-launch-x11.c @@ -142,10 +142,15 @@ get_session_file (void) /* replace the : in the display with _ if the : is still there. * use _ instead of - since it can't be in hostnames. + * + * similarly, on recent versions of macOS, X11 is provided by the XQuartz + * package which uses a path for the hostname, such as + * /private/tmp/com.apple.launchd.mBSMLJ3yQU/org.macosforge.xquartz + * we therefore also replace any / with _ */ for (p = display; *p; ++p) { - if (*p == ':') + if (*p == ':' || *p == '/') *p = '_'; }