Marco Trevisan (Treviño) has proposed merging 
~3v1n0/ubuntu/+source/glib2.0:ubuntu/master into 
~ubuntu-desktop/ubuntu/+source/glib2.0:ubuntu/master.

Requested reviews:
  Ubuntu Desktop (ubuntu-desktop)
Related bugs:
  Bug #1764779 in nautilus (Ubuntu): "Nautilus crashed open Windows-partition"
  https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1764779

For more details, see:
https://code.launchpad.net/~3v1n0/ubuntu/+source/glib2.0/+git/glib2.0/+merge/353003
-- 
Your team Ubuntu Desktop is requested to review the proposed merge of 
~3v1n0/ubuntu/+source/glib2.0:ubuntu/master into 
~ubuntu-desktop/ubuntu/+source/glib2.0:ubuntu/master.
diff --git a/debian/changelog b/debian/changelog
index d4fed8d..18f7937 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+glib2.0 (2.56.1-2ubuntu2) UNRELEASED; urgency=medium
+
+  * debian/patches/gio-Update-mounts-after-g_volume_mount.patch,
+    debian/patches/gio-tool-Hold-GVolumeMonitor-reference-during-operations.patch:
+    - Ensure mounts are advertised only after mounting has been really completed
+      (LP: #1764779)
+
+ -- Marco Trevisan (Treviño) <ma...@ubuntu.com>  Mon, 13 Aug 2018 18:03:21 +0200
+
 glib2.0 (2.56.1-2ubuntu1) bionic; urgency=medium
 
   * Merge with debian, remaining changes:
diff --git a/debian/patches/gio-Update-mounts-after-g_volume_mount.patch b/debian/patches/gio-Update-mounts-after-g_volume_mount.patch
new file mode 100644
index 0000000..0d8be3e
--- /dev/null
+++ b/debian/patches/gio-Update-mounts-after-g_volume_mount.patch
@@ -0,0 +1,110 @@
+From: Ondrej Holy <oh...@redhat.com>
+Date: Mon, 30 Jul 2018 15:26:31 +0200
+Subject: gio: Update mounts after g_volume_mount
+
+The documentation claims that g_volume_get_mount should	succeed	after
+g_volume_mount. Let's update mounts before releasing g_volume_mount to
+be sure that the mount is added to the corresponding volume. The same
+is done in GVfsUDisks2VolumeMonitor.
+
+(Backported from commit 9b6b282e0a9d3f37865aa36e21ea57bd2a326e20 with no
+merge conflicts.)
+
+Bug-GNOME: https://gitlab.gnome.org/GNOME/glib/issues/1458
+Bug-Ubuntu: https://launchpad.net/bugs/1764779
+Applied-Upstream: 2.56.2, commit:f9ab3558
+---
+ gio/gunixvolume.c        |  9 +++++++--
+ gio/gunixvolumemonitor.c | 19 +++++++++++--------
+ gio/gunixvolumemonitor.h |  1 +
+ 3 files changed, 19 insertions(+), 10 deletions(-)
+
+diff --git a/gio/gunixvolume.c b/gio/gunixvolume.c
+index b54d1fd..a3768e1 100644
+--- a/gio/gunixvolume.c
++++ b/gio/gunixvolume.c
+@@ -274,6 +274,7 @@ eject_mount_done (GObject      *source,
+   GTask *task = user_data;
+   GError *error = NULL;
+   gchar *stderr_str;
++  GUnixVolume *unix_volume;
+ 
+   if (!g_subprocess_communicate_utf8_finish (subprocess, result, NULL, &stderr_str, &error))
+     {
+@@ -286,8 +287,12 @@ eject_mount_done (GObject      *source,
+         /* ...but bad exit code */
+         g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", stderr_str);
+       else
+-        /* ...and successful exit code */
+-        g_task_return_boolean (task, TRUE);
++        {
++          /* ...and successful exit code */
++          unix_volume = G_UNIX_VOLUME (g_task_get_source_object (task));
++          _g_unix_volume_monitor_update (G_UNIX_VOLUME_MONITOR (unix_volume->volume_monitor));
++          g_task_return_boolean (task, TRUE);
++        }
+ 
+       g_free (stderr_str);
+     }
+diff --git a/gio/gunixvolumemonitor.c b/gio/gunixvolumemonitor.c
+index b7711ff..4b99423 100644
+--- a/gio/gunixvolumemonitor.c
++++ b/gio/gunixvolumemonitor.c
+@@ -183,15 +183,21 @@ g_unix_volume_monitor_class_init (GUnixVolumeMonitorClass *klass)
+   native_class->get_mount_for_mount_path = get_mount_for_mount_path;
+ }
+ 
++void
++_g_unix_volume_monitor_update (GUnixVolumeMonitor *unix_monitor)
++{
++  /* Update both to make sure volumes are created before mounts */
++  update_volumes (unix_monitor);
++  update_mounts (unix_monitor);
++}
++
+ static void
+ mountpoints_changed (GUnixMountMonitor *mount_monitor,
+ 		     gpointer           user_data)
+ {
+   GUnixVolumeMonitor *unix_monitor = user_data;
+ 
+-  /* Update both to make sure volumes are created before mounts */
+-  update_volumes (unix_monitor);
+-  update_mounts (unix_monitor);
++  _g_unix_volume_monitor_update (unix_monitor);
+ }
+ 
+ static void
+@@ -200,9 +206,7 @@ mounts_changed (GUnixMountMonitor *mount_monitor,
+ {
+   GUnixVolumeMonitor *unix_monitor = user_data;
+ 
+-  /* Update both to make sure volumes are created before mounts */
+-  update_volumes (unix_monitor);
+-  update_mounts (unix_monitor);
++  _g_unix_volume_monitor_update (unix_monitor);
+ }
+ 
+ static void
+@@ -219,8 +223,7 @@ g_unix_volume_monitor_init (GUnixVolumeMonitor *unix_monitor)
+ 		    "mountpoints-changed", G_CALLBACK (mountpoints_changed),
+ 		    unix_monitor);
+ 		    
+-  update_volumes (unix_monitor);
+-  update_mounts (unix_monitor);
++  _g_unix_volume_monitor_update (unix_monitor);
+ }
+ 
+ GVolumeMonitor *
+diff --git a/gio/gunixvolumemonitor.h b/gio/gunixvolumemonitor.h
+index 4f54fc2..14e07fb 100644
+--- a/gio/gunixvolumemonitor.h
++++ b/gio/gunixvolumemonitor.h
+@@ -55,6 +55,7 @@ GType            _g_unix_volume_monitor_get_type                     (void) G_GN
+ GVolumeMonitor * _g_unix_volume_monitor_new                          (void);
+ GUnixVolume    * _g_unix_volume_monitor_lookup_volume_for_mount_path (GUnixVolumeMonitor *monitor,
+                                                                       const char         *mount_path);
++void             _g_unix_volume_monitor_update                       (GUnixVolumeMonitor *monitor);
+ 
+ G_END_DECLS
+ 
diff --git a/debian/patches/gio-tool-Hold-GVolumeMonitor-reference-during-operations.patch b/debian/patches/gio-tool-Hold-GVolumeMonitor-reference-during-operations.patch
new file mode 100644
index 0000000..ac25761
--- /dev/null
+++ b/debian/patches/gio-tool-Hold-GVolumeMonitor-reference-during-operations.patch
@@ -0,0 +1,120 @@
+From: Ondrej Holy <oh...@redhat.com>
+Date: Thu, 2 Aug 2018 11:35:48 +0200
+Subject: gio-tool: Hold GVolumeMonitor reference during operations
+
+Releasing GVolumeMonitor before g_volume_mount finish cause that
+g_volume_get_mount returns NULL, because the mount is not correctly
+propagated to the volume.
+
+(Backported from commit 88b8ebb5dde0512fd1e098efe4c217111876d252 with
+minor merge conflicts.)
+
+Bug-GNOME: https://gitlab.gnome.org/GNOME/glib/issues/1458
+Bug-Ubuntu: https://launchpad.net/bugs/1764779
+Applied-Upstream: 2.56.2, commit:2c1aee1
+---
+ gio/gio-tool-mount.c | 23 ++++-------------------
+ 1 file changed, 4 insertions(+), 19 deletions(-)
+
+diff --git a/gio/gio-tool-mount.c b/gio/gio-tool-mount.c
+index 9522713..1f51d7c 100644
+--- a/gio/gio-tool-mount.c
++++ b/gio/gio-tool-mount.c
+@@ -39,6 +39,7 @@ typedef enum {
+ 
+ static int outstanding_mounts = 0;
+ static GMainLoop *main_loop;
++static GVolumeMonitor *volume_monitor;
+ 
+ static gboolean mount_mountable = FALSE;
+ static gboolean mount_unmount = FALSE;
+@@ -813,11 +814,8 @@ list_drives (GList *drives,
+ static void
+ list_monitor_items (void)
+ {
+-  GVolumeMonitor *volume_monitor;
+   GList *drives, *volumes, *mounts;
+ 
+-  volume_monitor = g_volume_monitor_get();
+-
+   /* populate gvfs network mounts */
+   iterate_gmain();
+ 
+@@ -832,19 +830,14 @@ list_monitor_items (void)
+   mounts = g_volume_monitor_get_mounts (volume_monitor);
+   list_mounts (mounts, 0, TRUE);
+   g_list_free_full (mounts, g_object_unref);
+-
+-  g_object_unref (volume_monitor);
+ }
+ 
+ static void
+ unmount_all_with_scheme (const char *scheme)
+ {
+-  GVolumeMonitor *volume_monitor;
+   GList *mounts;
+   GList *l;
+ 
+-  volume_monitor = g_volume_monitor_get();
+-
+   /* populate gvfs network mounts */
+   iterate_gmain();
+ 
+@@ -860,8 +853,6 @@ unmount_all_with_scheme (const char *scheme)
+     g_object_unref (root);
+   }
+   g_list_free_full (mounts, g_object_unref);
+-
+-  g_object_unref (volume_monitor);
+ }
+ 
+ static void
+@@ -912,12 +903,9 @@ mount_with_device_file_cb (GObject *object,
+ static void
+ mount_with_device_file (const char *device_file)
+ {
+-  GVolumeMonitor *volume_monitor;
+   GList *volumes;
+   GList *l;
+ 
+-  volume_monitor = g_volume_monitor_get();
+-
+   volumes = g_volume_monitor_get_volumes (volume_monitor);
+   for (l = volumes; l != NULL; l = l->next)
+     {
+@@ -950,8 +938,6 @@ mount_with_device_file (const char *device_file)
+       print_error ("%s: %s", device_file, _("No volume for device file"));
+       success = FALSE;
+     }
+-
+-  g_object_unref (volume_monitor);
+ }
+ 
+ static void
+@@ -1105,10 +1091,6 @@ monitor_drive_eject_button (GVolumeMonitor *volume_monitor, GDrive *drive)
+ static void
+ monitor (void)
+ {
+-  GVolumeMonitor *volume_monitor;
+-
+-  volume_monitor = g_volume_monitor_get ();
+-
+   g_signal_connect (volume_monitor, "mount-added", (GCallback) monitor_mount_added, NULL);
+   g_signal_connect (volume_monitor, "mount-removed", (GCallback) monitor_mount_removed, NULL);
+   g_signal_connect (volume_monitor, "mount-changed", (GCallback) monitor_mount_changed, NULL);
+@@ -1163,6 +1145,7 @@ handle_mount (int argc, char *argv[], gboolean do_help)
+   g_option_context_free (context);
+ 
+   main_loop = g_main_loop_new (NULL, FALSE);
++  volume_monitor = g_volume_monitor_get ();
+ 
+   if (mount_list)
+     list_monitor_items ();
+@@ -1190,5 +1173,7 @@ handle_mount (int argc, char *argv[], gboolean do_help)
+   if (outstanding_mounts > 0)
+     g_main_loop_run (main_loop);
+ 
++  g_object_unref (volume_monitor);
++
+   return success ? 0 : 2;
+ }
diff --git a/debian/patches/series b/debian/patches/series
index f116fe6..404e797 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -18,3 +18,5 @@ exp_git_default_per_desktop1.patch
 exp_git_default_per_desktop2.patch
 exp_git_default_per_desktop3.patch
 exp_git_default_per_desktop4.patch
+gio-Update-mounts-after-g_volume_mount.patch
+gio-tool-Hold-GVolumeMonitor-reference-during-operations.patch
-- 
ubuntu-desktop mailing list
ubuntu-desktop@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop

Reply via email to