diff --git a/mutter-xwayland-use-gdm-auth-file.patch b/mutter-xwayland-use-gdm-auth-file.patch new file mode 100644 index 0000000..b795bb9 --- /dev/null +++ b/mutter-xwayland-use-gdm-auth-file.patch @@ -0,0 +1,123 @@ +Index: mutter-3.28.0/src/wayland/meta-xwayland.c +=================================================================== +--- mutter-3.28.0.orig/src/wayland/meta-xwayland.c ++++ mutter-3.28.0/src/wayland/meta-xwayland.c +@@ -32,6 +32,12 @@ + #include + #include + ++/* For g_open() */ ++#include ++#include ++#include ++#include ++ + #include "compositor/meta-surface-actor-wayland.h" + #include "wayland/meta-wayland-actor-surface.h" + +@@ -508,6 +514,37 @@ on_displayfd_ready (int fd, + return G_SOURCE_REMOVE; + } + ++/* Look for an Xauthority file that may have been created by gdm */ ++static char * ++find_auth_file (void) ++{ ++ char *auth_dir = NULL; ++ char *auth_file = NULL; ++ int fd; ++ ++ auth_dir = g_build_filename (g_get_user_runtime_dir (), ++ "gdm", ++ NULL); ++ ++ auth_file = g_build_filename (auth_dir, "Xauthority", NULL); ++ g_clear_pointer (&auth_dir, g_free); ++ ++ /* Check that we can open the file. In theory it could still go away before ++ * Xwayland gets a chance to run, but at least we can be fairly sure. */ ++ ++ fd = g_open (auth_file, O_RDWR, 0700); ++ ++ if (fd < 0) { ++ g_clear_pointer (&auth_file, g_free); ++ goto out; ++ } ++ ++ g_close (fd, NULL); ++ ++out: ++ return auth_file; ++} ++ + gboolean + meta_xwayland_start (MetaXWaylandManager *manager, + struct wl_display *wl_display) +@@ -517,11 +554,14 @@ meta_xwayland_start (MetaXWaylandManager + gboolean started = FALSE; + g_autoptr(GSubprocessLauncher) launcher = NULL; + GSubprocessFlags flags; ++ gchar *auth_file = NULL; + GError *error = NULL; + + if (!choose_xdisplay (manager)) + goto out; + ++ auth_file = find_auth_file (); ++ + /* We want xwayland to be a wayland client so we make a socketpair to setup a + * wayland protocol connection. */ + if (socketpair (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, xwayland_client_fd) < 0) +@@ -560,16 +600,34 @@ meta_xwayland_start (MetaXWaylandManager + * won't try to reconnect and crash, leaving uninteresting core dumps. We do + * want core dumps from Xwayland but only if a real bug occurs... + */ +- manager->proc = g_subprocess_launcher_spawn (launcher, &error, +- XWAYLAND_PATH, manager->display_name, +- "-rootless", +- "-terminate", +- "-accessx", +- "-core", +- "-listen", "4", +- "-listen", "5", +- "-displayfd", "6", +- NULL); ++ if (auth_file) ++ { ++ manager->proc = g_subprocess_launcher_spawn (launcher, &error, ++ XWAYLAND_PATH, manager->display_name, ++ "-rootless", ++ "-terminate", ++ "-accessx", ++ "-core", ++ "-auth", auth_file, ++ "-listen", "4", ++ "-listen", "5", ++ "-displayfd", "6", ++ NULL); ++ } ++ else ++ { ++ manager->proc = g_subprocess_launcher_spawn (launcher, &error, ++ XWAYLAND_PATH, manager->display_name, ++ "-rootless", ++ "-terminate", ++ "-accessx", ++ "-core", ++ "-listen", "4", ++ "-listen", "5", ++ "-displayfd", "6", ++ NULL); ++ } ++ + if (!manager->proc) + { + g_error ("Failed to spawn Xwayland: %s", error->message); +@@ -591,6 +649,7 @@ meta_xwayland_start (MetaXWaylandManager + started = TRUE; + + out: ++ g_free (auth_file); + if (!started) + { + unlink (manager->lock_file); diff --git a/mutter.changes b/mutter.changes index d3620a3..a6d27f7 100644 --- a/mutter.changes +++ b/mutter.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Mar 14 01:58:11 CET 2018 - hpj@suse.com + +- Add mutter-xwayland-use-gdm-auth-file.patch (bsc#1084737): If + an Xauthority file was created for us by the display manager, + pass it to Xwayland -auth. + ------------------------------------------------------------------- Mon Mar 12 22:55:24 UTC 2018 - bjorn.lie@gmail.com diff --git a/mutter.spec b/mutter.spec index 60c582c..9f07d27 100644 --- a/mutter.spec +++ b/mutter.spec @@ -30,6 +30,8 @@ Source0: http://download.gnome.org/sources/mutter/3.28/%{name}-%{version} Patch0: mutter-fix-startup.patch # PATCH-FEATURE-UPSTREAM mutter-iconcache-Support-RGB16_565-format-for-16-bit-color-.patch FATE#323412 bgo#781704 bsc#1024748 vliaskovitis@suse.com -- iconcache: Support RGB16_565 format for 16-bit sessions Patch1: mutter-iconcache-Support-RGB16_565-format-for-16-bit-color-.patch +# PATCH-FIX-OPENSUSE mutter-xwayland-use-gdm-auth-file.patch bsc#1084737 hpj@suse.com -- Pass an Xauthority file to Xwayland -auth if found +Patch2: mutter-xwayland-use-gdm-auth-file.patch # SLE-only patches start at 1000 # PATCH-FEATURE-SLE mutter-SLE-bell.patch FATE#316042 bnc#889218 idonmez@suse.com -- make audible bell work out of the box. Patch1000: mutter-SLE-bell.patch @@ -142,6 +144,7 @@ applications that want to make use of the mutter library. %setup -q %patch0 -p1 %patch1 -p1 +%patch2 -p1 # SLE-only patches and translations. %if !0%{?is_opensuse}