File gdm-quit-plymouth-when-xdmcp-is-the-only-allowed-connection.patch of Package gdm.16051

From ef9977bf2118b2b7810a7669e128249d5ee91eab Mon Sep 17 00:00:00 2001
From: Yifan J <yfjiang@suse.com>
Date: Tue, 10 Apr 2018 14:17:30 +0800
Subject: [PATCH] daemon/gdm-manager.c: quit plymouth when xdmcp is the only
 allowed connection.

gdm is responsible to kill plymouth by spawning the "plymouth quit"
subprocesses in gdm-manager.c. The current code pathes of quiting
plymouth can never be reached when xdmcp is the only connection
allowed. Consequently in the case of

    !show_local_greeter && xdmcp_enabled

the plymouth-quit-wait.service will never quit and the login prompt
will not popup without manual interference. This issue could be
more obviously observed when a downstream like openSUSE which
allows a customized sysconfig to switch the corresponding two
options on a headless server (s390), where the setup is usually:

    DISPLAYMANAGER_REMOTE_ACCESS="yes"
    DISPLAYMANAGER_STARTS_XSERVER="no"

The proposed patch handles this edge case by quit plymouth immediately
when the condition is detected.

https://bugzilla.gnome.org/show_bug.cgi?id=795120

---
The backported patch has its context adjusted for gdm-3.10.0.1 and adds
a merged implementation of plymouth_is_running() +
plymouth_quit_without_transition() from daemon/gdm-simple-slave.c to
quit plymouth if it is running.

---
 daemon/gdm-manager.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -28,6 +28,7 @@
 #include <signal.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 
 #include <glib.h>
 #include <glib/gi18n.h>
@@ -1072,6 +1073,37 @@ gdm_manager_get_displays (GdmManager *ma
         return TRUE;
 }
 
+#ifdef  WITH_PLYMOUTH
+static void
+plymouth_quit ()
+{
+        int      status;
+        gboolean res;
+        GError  *error;
+
+        error = NULL;
+        res = g_spawn_command_line_sync ("/bin/plymouth --ping",
+                                         NULL, NULL, &status, &error);
+        if (! res) {
+                g_debug ("Could not ping plymouth: %s", error->message);
+                g_error_free (error);
+                return;
+        }
+
+        if (! WIFEXITED (status) || WEXITSTATUS (status) != 0) {
+                return;
+        }
+
+        error = NULL;
+        res = g_spawn_command_line_sync ("/bin/plymouth quit",
+                                         NULL, NULL, NULL, &error);
+        if (! res) {
+                g_warning ("Could not quit plymouth: %s", error->message);
+                g_error_free (error);
+        }
+}
+#endif
+
 void
 gdm_manager_stop (GdmManager *manager)
 {
@@ -1102,6 +1134,12 @@ gdm_manager_start (GdmManager *manager)
 #ifdef HAVE_LIBXDMCP
         /* Accept remote connections */
         if (manager->priv->xdmcp_enabled && ! manager->priv->wait_for_go) {
+#ifdef WITH_PLYMOUTH
+                /* Quit plymouth if xdmcp is the only display */
+                if (!manager->priv->show_local_greeter) {
+                        plymouth_quit ();
+                }
+#endif
                 if (manager->priv->xdmcp_factory != NULL) {
                         g_debug ("GdmManager: Accepting XDMCP connections...");
                         gdm_display_factory_start (GDM_DISPLAY_FACTORY (manager->priv->xdmcp_factory));