=== modified file 'debian/changelog'
--- debian/changelog	2017-07-12 14:08:20 +0000
+++ debian/changelog	2017-07-13 08:40:36 +0000
@@ -1,3 +1,10 @@
+gdm3 (3.24.2-1ubuntu8) artful; urgency=medium
+
+  * Avoid double-NULL terminated array that breaks append operations
+    and so prevents Wayland sessions from working (LP: #1704050)
+
+ -- Daniel van Vugt <daniel.van.vugt@canonical.com>  Thu, 13 Jul 2017 16:29:46 +0800
+
 gdm3 (3.24.2-1ubuntu7) artful; urgency=medium
 
   * debian/gdm3.config: Check the version of gdm3 instead of ubuntu-session.

=== added file 'debian/patches/Avoid-double-NULL-terminated-array-LP-1704050.patch'
--- debian/patches/Avoid-double-NULL-terminated-array-LP-1704050.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/Avoid-double-NULL-terminated-array-LP-1704050.patch	2017-07-13 08:40:36 +0000
@@ -0,0 +1,31 @@
+From cb8042fc87937abf80928b489d847128a38cd8a9 Mon Sep 17 00:00:00 2001
+From: Daniel van Vugt <daniel.van.vugt@canonical.com>
+Date: Thu, 13 Jul 2017 16:13:05 +0800
+Subject: [PATCH] Avoid double-NULL terminated array (LP: #1704050)
+
+If you then g_array_append_val wayland_search_dir you get:
+   {..., NULL, wayland_search_dir, NULL}
+and so the call to g_strdupv never finds wayland_search_dir. And then
+Wayland logins don't work.
+
+Neither G_N_ELEMENTS nor g_array_append_vals treat NULL as a special value.
+Only g_strdupv does.
+---
+ daemon/gdm-session.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
+index ff3a1acb..0b832231 100644
+--- a/daemon/gdm-session.c
++++ b/daemon/gdm-session.c
+@@ -348,7 +348,6 @@ get_system_session_dirs (GdmSession *self)
+                 DMCONFDIR "/Sessions/",
+                 DATADIR "/gdm/BuiltInSessions/",
+                 DATADIR "/xsessions/",
+-                NULL
+         };
+ 
+         static const char *wayland_search_dir = DATADIR "/wayland-sessions/";
+-- 
+2.11.0
+

=== modified file 'debian/patches/series'
--- debian/patches/series	2017-07-12 08:34:37 +0000
+++ debian/patches/series	2017-07-13 08:40:36 +0000
@@ -12,3 +12,4 @@
 ubuntu_config_error_dialog.patch
 revert_drop_gdm_shell_session.patch
 ubuntu_prefer_x11_session.patch
+Avoid-double-NULL-terminated-array-LP-1704050.patch

