rpms/gvfs/F-12 0001-gdu-Stop-assuming-that-drives-have-no-enclosing-pres.patch, NONE, 1.1 0002-gdu-Prefer-using-dev_t-to-device-file-when-comparing.patch, NONE, 1.1 0003-gdu-Be-more-careful-with-automounting-use-a-whitelis.patch, NONE, 1.1 gvfs.spec, 1.174, 1.175

David Zeuthen davidz at fedoraproject.org
Tue Dec 8 19:51:28 UTC 2009


Author: davidz

Update of /cvs/pkgs/rpms/gvfs/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv4540

Modified Files:
	gvfs.spec 
Added Files:
	0001-gdu-Stop-assuming-that-drives-have-no-enclosing-pres.patch 
	0002-gdu-Prefer-using-dev_t-to-device-file-when-comparing.patch 
	0003-gdu-Be-more-careful-with-automounting-use-a-whitelis.patch 
Log Message:
* Tue Dec  8 2009 David Zeuthen <davidz at redhat.com> - 1.4.2-3
- Backport fixes from git
- Correct wrong assumptions about how libgdu.so works
- Make LUKS volumes work with new mount(8) behavior
- Be more careful deciding what volumes to automatically mount



0001-gdu-Stop-assuming-that-drives-have-no-enclosing-pres.patch:
 ggduvolume.c        |   16 +++++++++-
 ggduvolumemonitor.c |   79 +++++++++++++++++++++++++++++++++-------------------
 2 files changed, 66 insertions(+), 29 deletions(-)

--- NEW FILE 0001-gdu-Stop-assuming-that-drives-have-no-enclosing-pres.patch ---
>From 2714a72902d35cd55668484eb5bfdfc23eb16f09 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz at redhat.com>
Date: Tue, 8 Dec 2009 13:15:52 -0500
Subject: [PATCH 1/3] [gdu] Stop assuming that drives have no enclosing presentable

This makes the gdu volume monitor works with recent gnome-disk-utility
versions with things like GduHub presentables that represents HBAs and
Expanders. This will not affect previous gnome-disk-utility versions.

Signed-off-by: David Zeuthen <davidz at redhat.com>
---
 monitor/gdu/ggduvolume.c        |   16 +++++++-
 monitor/gdu/ggduvolumemonitor.c |   78 +++++++++++++++++++++++++-------------
 2 files changed, 66 insertions(+), 28 deletions(-)

diff --git a/monitor/gdu/ggduvolume.c b/monitor/gdu/ggduvolume.c
index 28839fd..be324c9 100644
--- a/monitor/gdu/ggduvolume.c
+++ b/monitor/gdu/ggduvolume.c
@@ -988,7 +988,21 @@ mount_with_mount_operation (MountOpData *data)
 
   device = gdu_presentable_get_device (GDU_PRESENTABLE (data->volume->gdu_volume));
 
-  toplevel = gdu_presentable_get_toplevel (GDU_PRESENTABLE (data->volume->gdu_volume));
+  toplevel = gdu_presentable_get_enclosing_presentable (GDU_PRESENTABLE (data->volume->gdu_volume));
+  /* handle logical partitions enclosed by an extented partition */
+  if (GDU_IS_VOLUME (toplevel))
+    {
+      GduPresentable *temp;
+      temp = toplevel;
+      toplevel = gdu_presentable_get_enclosing_presentable (toplevel);
+      g_object_unref (temp);
+      if (!GDU_IS_DRIVE (toplevel))
+        {
+          g_object_unref (toplevel);
+          toplevel = NULL;
+        }
+    }
+
   if (toplevel != NULL)
     drive_name = gdu_presentable_get_name (toplevel);
 
diff --git a/monitor/gdu/ggduvolumemonitor.c b/monitor/gdu/ggduvolumemonitor.c
index 398fed4..c5b58a0 100644
--- a/monitor/gdu/ggduvolumemonitor.c
+++ b/monitor/gdu/ggduvolumemonitor.c
@@ -1298,24 +1298,36 @@ update_volumes (GGduVolumeMonitor *monitor,
 
       if (volume == NULL)
         {
-          GduPresentable *toplevel_presentable;
+          GduPresentable *toplevel_drive;
 
-          toplevel_presentable = gdu_presentable_get_toplevel (p);
-          if (toplevel_presentable != NULL)
+          toplevel_drive = gdu_presentable_get_enclosing_presentable (p);
+          /* handle logical partitions enclosed by an extented partition */
+          if (GDU_IS_VOLUME (toplevel_drive))
             {
-              GduDevice *toplevel_device;
+              GduPresentable *temp;
+              temp = toplevel_drive;
+              toplevel_drive = gdu_presentable_get_enclosing_presentable (toplevel_drive);
+              g_object_unref (temp);
+            }
 
-              drive = NULL;
-              toplevel_device = gdu_presentable_get_device (toplevel_presentable);
-              if (toplevel_device != NULL)
+          if (toplevel_drive != NULL)
+            {
+              if (GDU_IS_DRIVE (toplevel_drive))
                 {
-                  drive = find_drive_by_device_file (monitor, gdu_device_get_device_file (toplevel_device));
-                  /*g_debug ("adding volume %s (drive %s)",
-                           gdu_device_get_device_file (d),
-                           gdu_device_get_device_file (toplevel_device));*/
-                  g_object_unref (toplevel_device);
+                  GduDevice *toplevel_drive_device;
+
+                  drive = NULL;
+                  toplevel_drive_device = gdu_presentable_get_device (toplevel_drive);
+                  if (toplevel_drive_device != NULL)
+                    {
+                      drive = find_drive_by_device_file (monitor, gdu_device_get_device_file (toplevel_drive_device));
+                      /*g_debug ("adding volume %s (drive %s)",
+                        gdu_device_get_device_file (d),
+                        gdu_device_get_device_file (toplevel_device));*/
+                      g_object_unref (toplevel_drive_device);
+                    }
                 }
-              g_object_unref (toplevel_presentable);
+              g_object_unref (toplevel_drive);
             }
           else
             {
@@ -1512,7 +1524,7 @@ update_mounts (GGduVolumeMonitor *monitor,
       if (volume == NULL)
         volume = find_volume_for_mount_path (monitor, mount_path);
 
-      /*g_debug ("adding mount %s (vol %p)", g_unix_mount_get_device_path (mount_entry), volume);*/
+      /*g_debug ("adding mount %s (vol %p) (device %s, mount_path %s)", g_unix_mount_get_device_path (mount_entry), volume, device_file, mount_path);*/
       mount = g_gdu_mount_new (G_VOLUME_MONITOR (monitor), mount_entry, volume);
       if (mount)
         {
@@ -1640,24 +1652,36 @@ update_discs (GGduVolumeMonitor *monitor,
 
       if (volume == NULL)
         {
-          GduPresentable *toplevel_presentable;
+          GduPresentable *toplevel_drive;
 
-          toplevel_presentable = gdu_presentable_get_toplevel (p);
-          if (toplevel_presentable != NULL)
+          toplevel_drive = gdu_presentable_get_enclosing_presentable (p);
+          /* handle logical partitions enclosed by an extented partition */
+          if (GDU_IS_VOLUME (toplevel_drive))
             {
-              GduDevice *toplevel_device;
+              GduPresentable *temp;
+              temp = toplevel_drive;
+              toplevel_drive = gdu_presentable_get_enclosing_presentable (toplevel_drive);
+              g_object_unref (temp);
+            }
 
-              drive = NULL;
-              toplevel_device = gdu_presentable_get_device (toplevel_presentable);
-              if (toplevel_device != NULL)
+          if (toplevel_drive != NULL)
+            {
+              if (GDU_IS_DRIVE (toplevel_drive))
                 {
-                  drive = find_drive_by_device_file (monitor, gdu_device_get_device_file (toplevel_device));
-                  /*g_debug ("adding volume %s (drive %s)",
-                           gdu_device_get_device_file (d),
-                           gdu_device_get_device_file (toplevel_device));*/
-                  g_object_unref (toplevel_device);
+                  GduDevice *toplevel_drive_device;
+
+                  drive = NULL;
+                  toplevel_drive_device = gdu_presentable_get_device (toplevel_drive);
+                  if (toplevel_drive_device != NULL)
+                    {
+                      drive = find_drive_by_device_file (monitor, gdu_device_get_device_file (toplevel_drive_device));
+                      /*g_debug ("adding volume %s (drive %s)",
+                        gdu_device_get_device_file (d),
+                        gdu_device_get_device_file (toplevel_device));*/
+                      g_object_unref (toplevel_drive_device);
+                    }
                 }
-              g_object_unref (toplevel_presentable);
+              g_object_unref (toplevel_drive);
             }
           else
             {
-- 
1.6.5.5


0002-gdu-Prefer-using-dev_t-to-device-file-when-comparing.patch:
 ggdudrive.c         |   12 +++++++++---
 ggdudrive.h         |    4 ++--
 ggduvolume.c        |   49 +++++++++++++++++++++++++++++++++++++++++++++----
 ggduvolume.h        |    2 ++
 ggduvolumemonitor.c |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
 ggduvolumemonitor.h |    6 +++++-
 6 files changed, 109 insertions(+), 13 deletions(-)

--- NEW FILE 0002-gdu-Prefer-using-dev_t-to-device-file-when-comparing.patch ---
>From f909a095df0189569c28a786d01a0abda9f7e76a Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz at redhat.com>
Date: Tue, 8 Dec 2009 13:54:27 -0500
Subject: [PATCH 2/3] [gdu] Prefer using dev_t to device file when comparing devices

This works around new behavior in mount(8) where it decides to put
/dev/mapper/<blah> in /etc/mtab instead of the /dev/dm-0 device that
the user actually requested.

Of course /dev/mapper/<blah> currently does not exist in the udev
database because of device-mapper brokenness so without this fix
things can never work if using a sufficiently new mount(8) command.

Signed-off-by: David Zeuthen <davidz at redhat.com>
---
 monitor/gdu/ggdudrive.c         |   12 +++++++--
 monitor/gdu/ggdudrive.h         |    4 +-
 monitor/gdu/ggduvolume.c        |   49 +++++++++++++++++++++++++++++++++++---
 monitor/gdu/ggduvolume.h        |    2 +
 monitor/gdu/ggduvolumemonitor.c |   49 ++++++++++++++++++++++++++++++++++++--
 monitor/gdu/ggduvolumemonitor.h |    5 ++++
 6 files changed, 109 insertions(+), 12 deletions(-)

diff --git a/monitor/gdu/ggdudrive.c b/monitor/gdu/ggdudrive.c
index 309e18c..72126a0 100644
--- a/monitor/gdu/ggdudrive.c
+++ b/monitor/gdu/ggdudrive.c
@@ -46,6 +46,7 @@ struct _GGduDrive {
   GIcon *icon;
   gchar *name;
   gchar *device_file;
+  dev_t dev;
   gboolean is_media_removable;
   gboolean has_media;
   gboolean can_eject;
@@ -128,6 +129,7 @@ update_drive (GGduDrive *drive)
   GIcon *old_icon;
   gchar *old_name;
   gchar *old_device_file;
+  dev_t old_dev;
   gboolean old_is_media_removable;
   gboolean old_has_media;
   gboolean old_can_eject;
@@ -151,6 +153,7 @@ update_drive (GGduDrive *drive)
 
   old_name = g_strdup (drive->name);
   old_device_file = g_strdup (drive->device_file);
+  old_dev = drive->dev;
   old_icon = drive->icon != NULL ? g_object_ref (drive->icon) : NULL;
 
   /* in with the new */
@@ -170,6 +173,7 @@ update_drive (GGduDrive *drive)
   if (device == NULL)
     {
       g_free (drive->device_file);
+      drive->dev = 0;
       drive->device_file = NULL;
       drive->is_media_removable = TRUE;
       drive->has_media = TRUE;
@@ -179,6 +183,7 @@ update_drive (GGduDrive *drive)
   else
     {
       g_free (drive->device_file);
+      drive->dev = gdu_device_get_dev (device);
       drive->device_file = g_strdup (gdu_device_get_device_file (device));
       drive->is_media_removable = gdu_device_is_removable (device);
       drive->has_media = gdu_device_is_media_available (device);
@@ -265,6 +270,7 @@ update_drive (GGduDrive *drive)
               (old_can_poll_for_media == drive->can_poll_for_media) &&
               (g_strcmp0 (old_name, drive->name) == 0) &&
               (g_strcmp0 (old_device_file, drive->device_file) == 0) &&
+              (old_dev == drive->dev) &&
               g_icon_equal (old_icon, drive->icon)
               );
 
@@ -1200,10 +1206,10 @@ g_gdu_drive_drive_iface_init (GDriveIface *iface)
 }
 
 gboolean
-g_gdu_drive_has_device_file (GGduDrive      *drive,
-                             const gchar    *device_file)
+g_gdu_drive_has_dev (GGduDrive      *drive,
+                     dev_t           dev)
 {
-  return g_strcmp0 (drive->device_file, device_file) == 0;
+  return drive->dev == dev;
 }
 
 gboolean
diff --git a/monitor/gdu/ggdudrive.h b/monitor/gdu/ggdudrive.h
index e182c29..e1aab7d 100644
--- a/monitor/gdu/ggdudrive.h
+++ b/monitor/gdu/ggdudrive.h
@@ -52,8 +52,8 @@ void       g_gdu_drive_set_volume      (GGduDrive      *drive,
 void       g_gdu_drive_unset_volume    (GGduDrive      *drive,
                                         GGduVolume     *volume);
 void       g_gdu_drive_disconnected    (GGduDrive      *drive);
-gboolean   g_gdu_drive_has_device_file (GGduDrive      *drive,
-                                        const gchar    *device_file);
+gboolean   g_gdu_drive_has_dev         (GGduDrive      *drive,
+                                        dev_t           dev);
 time_t     g_gdu_drive_get_time_of_last_media_insertion (GGduDrive      *drive);
 
 gboolean   g_gdu_drive_has_presentable (GGduDrive       *drive,
diff --git a/monitor/gdu/ggduvolume.c b/monitor/gdu/ggduvolume.c
index be324c9..6e2fcd3 100644
--- a/monitor/gdu/ggduvolume.c
+++ b/monitor/gdu/ggduvolume.c
@@ -77,6 +77,7 @@ struct _GGduVolume
   GFile *activation_root;
   gchar *name;
   gchar *device_file;
+  dev_t dev;
   gchar *uuid;
   gboolean can_mount;
   gboolean should_automount;
@@ -179,6 +180,7 @@ update_volume (GGduVolume *volume)
   gboolean old_should_automount;
   gchar *old_name;
   gchar *old_device_file;
+  dev_t old_dev;
   GIcon *old_icon;
   gboolean keep_cleartext_volume;
 
@@ -187,6 +189,7 @@ update_volume (GGduVolume *volume)
   old_should_automount = volume->should_automount;
   old_name = g_strdup (volume->name);
   old_device_file = g_strdup (volume->device_file);
+  old_dev = volume->dev;
   old_icon = volume->icon != NULL ? g_object_ref (volume->icon) : NULL;
 
   /* ---------------------------------------------------------------------------------------------------- */
@@ -194,11 +197,14 @@ update_volume (GGduVolume *volume)
   /* if the volume is a fstab mount point, get the data from there */
   if (volume->unix_mount_point != NULL)
     {
+      struct stat_buf;
+
       volume->can_mount = TRUE;
       volume->should_automount = FALSE;
 
       g_free (volume->device_file);
       volume->device_file = g_strdup (g_unix_mount_point_get_device_path (volume->unix_mount_point));
+      volume->dev = 0;
 
       if (volume->icon != NULL)
         g_object_unref (volume->icon);
@@ -289,9 +295,15 @@ update_volume (GGduVolume *volume)
 
       g_free (volume->device_file);
       if (luks_cleartext_volume_device != NULL)
-        volume->device_file = g_strdup (gdu_device_get_device_file (luks_cleartext_volume_device));
+        {
+          volume->device_file = g_strdup (gdu_device_get_device_file (luks_cleartext_volume_device));
+          volume->dev = gdu_device_get_dev (luks_cleartext_volume_device);
+        }
       else
-        volume->device_file = NULL;
+        {
+          volume->device_file = NULL;
+          volume->dev = 0;
+        }
 
       volume->can_mount = TRUE;
 
@@ -327,9 +339,15 @@ update_volume (GGduVolume *volume)
 
       g_free (volume->device_file);
       if (device != NULL)
-        volume->device_file = g_strdup (gdu_device_get_device_file (device));
+        {
+          volume->device_file = g_strdup (gdu_device_get_device_file (device));
+          volume->dev = gdu_device_get_dev (device);
+        }
       else
-        volume->device_file = NULL;
+        {
+          volume->device_file = NULL;
+          volume->dev = 0;
+        }
 
       volume->can_mount = TRUE;
 
@@ -369,6 +387,7 @@ update_volume (GGduVolume *volume)
               (old_should_automount == volume->should_automount) &&
               (g_strcmp0 (old_name, volume->name) == 0) &&
               (g_strcmp0 (old_device_file, volume->device_file) == 0) &&
+              (old_dev == volume->dev) &&
               g_icon_equal (old_icon, volume->icon)
               );
 
@@ -1676,6 +1695,28 @@ g_gdu_volume_volume_iface_init (GVolumeIface *iface)
 }
 
 gboolean
+g_gdu_volume_has_dev (GGduVolume   *volume,
+                      dev_t         dev)
+{
+  dev_t _dev;
+
+  _dev = volume->dev;
+
+  if (volume->cleartext_gdu_volume != NULL)
+    {
+      GduDevice *luks_cleartext_volume_device;
+      luks_cleartext_volume_device = gdu_presentable_get_device (GDU_PRESENTABLE (volume->cleartext_gdu_volume));
+      if (luks_cleartext_volume_device != NULL)
+        {
+          _dev = gdu_device_get_dev (luks_cleartext_volume_device);
+          g_object_unref (luks_cleartext_volume_device);
+        }
+    }
+
+  return _dev == dev;
+}
+
+gboolean
 g_gdu_volume_has_device_file (GGduVolume   *volume,
                               const gchar  *device_file)
 {
diff --git a/monitor/gdu/ggduvolume.h b/monitor/gdu/ggduvolume.h
index a230d28..007484a 100644
--- a/monitor/gdu/ggduvolume.h
+++ b/monitor/gdu/ggduvolume.h
@@ -71,6 +71,8 @@ gboolean    g_gdu_volume_has_uuid       (GGduVolume       *volume,
                                          const char       *uuid);
 gboolean   g_gdu_volume_has_device_file (GGduVolume      *volume,
                                          const gchar     *device_file);
+gboolean   g_gdu_volume_has_dev         (GGduVolume       *volume,
+                                         dev_t             dev);
 
 GduPresentable *g_gdu_volume_get_presentable (GGduVolume *volume);
 
diff --git a/monitor/gdu/ggduvolumemonitor.c b/monitor/gdu/ggduvolumemonitor.c
index c5b58a0..bcf23f1 100644
--- a/monitor/gdu/ggduvolumemonitor.c
+++ b/monitor/gdu/ggduvolumemonitor.c
@@ -1061,16 +1061,37 @@ find_disc_volume_for_device_file (GGduVolumeMonitor *monitor,
                                   const gchar       *device_file)
 {
   GList *l;
+  GGduVolume *ret;
+  struct stat stat_buf;
+
+  ret = NULL;
+
+  if (stat (device_file, &stat_buf) == 0)
+    {
+      for (l = monitor->disc_volumes; l != NULL; l = l->next)
+        {
+          GGduVolume *volume = G_GDU_VOLUME (l->data);
+          if (g_gdu_volume_has_dev (volume, stat_buf.st_rdev))
+            {
+              ret = volume;
+              goto out;
+            }
+        }
+    }
 
   for (l = monitor->disc_volumes; l != NULL; l = l->next)
     {
       GGduVolume *volume = G_GDU_VOLUME (l->data);
 
       if (g_gdu_volume_has_device_file (volume, device_file))
-        return volume;
+        {
+          ret = volume;
+          goto out;
+        }
     }
 
-  return NULL;
+ out:
+  return ret;
 }
 
 static GGduVolume *
@@ -1079,8 +1100,23 @@ find_volume_for_device_file (GGduVolumeMonitor *monitor,
 {
   GList *l;
   GGduVolume *ret;
+  struct stat stat_buf;
 
   ret = NULL;
+
+  if (stat (device_file, &stat_buf) == 0)
+    {
+      for (l = monitor->volumes; l != NULL; l = l->next)
+        {
+          GGduVolume *volume = G_GDU_VOLUME (l->data);
+          if (g_gdu_volume_has_dev (volume, stat_buf.st_rdev))
+            {
+              ret = volume;
+              goto out;
+            }
+        }
+    }
+
   for (l = monitor->volumes; l != NULL; l = l->next)
     {
       GGduVolume *volume = G_GDU_VOLUME (l->data);
@@ -1113,12 +1149,19 @@ find_drive_by_device_file (GGduVolumeMonitor *monitor,
                            const gchar       *device_file)
 {
   GList *l;
+  struct stat stat_buf;
+
+  if (stat (device_file, &stat_buf) != 0)
+    {
+      g_warning ("%s:%s: Error statting %s: %m", G_STRLOC, G_STRFUNC, device_file);
+      return NULL;
+    }
 
   for (l = monitor->drives; l != NULL; l = l->next)
     {
       GGduDrive *drive = G_GDU_DRIVE (l->data);
 
-      if (g_gdu_drive_has_device_file (drive, device_file))
+      if (g_gdu_drive_has_dev (drive, stat_buf.st_rdev))
         return drive;
     }
 
diff --git a/monitor/gdu/ggduvolumemonitor.h b/monitor/gdu/ggduvolumemonitor.h
index b91ceb9..2b6383a 100644
--- a/monitor/gdu/ggduvolumemonitor.h
+++ b/monitor/gdu/ggduvolumemonitor.h
@@ -28,6 +28,11 @@
 #include <gio/gio.h>
 #include <gio/gunixmounts.h>
 
+/* for dev_t */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 #include <gdu/gdu.h>
 
 G_BEGIN_DECLS
-- 
1.6.5.5


0003-gdu-Be-more-careful-with-automounting-use-a-whitelis.patch:
 ggduvolume.c |   52 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 47 insertions(+), 5 deletions(-)

--- NEW FILE 0003-gdu-Be-more-careful-with-automounting-use-a-whitelis.patch ---
>From e286c9b3f032c84298b715eaf821bc8a7df59bc3 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz at redhat.com>
Date: Tue, 8 Dec 2009 14:33:43 -0500
Subject: [PATCH 3/3] [gdu] Be more careful with automounting - use a whitelist

The current behavior is that we try to automount all filesystems. This
has unintended consequences for big iron boxes connected to a SAN when
the user is logging in as root (thus having all polkit authorizations
at hand) - literally hundreds or thousands of devices may get mounted.

As such, only automount filesystems from the current whitelist

 - anything connected via USB or Firewire or SDIO buses
 - optical discs

Signed-off-by: David Zeuthen <davidz at redhat.com>
---
 monitor/gdu/ggduvolume.c |   51 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/monitor/gdu/ggduvolume.c b/monitor/gdu/ggduvolume.c
index 6e2fcd3..23f5060 100644
--- a/monitor/gdu/ggduvolume.c
+++ b/monitor/gdu/ggduvolume.c
@@ -351,13 +351,56 @@ update_volume (GGduVolume *volume)
 
       volume->can_mount = TRUE;
 
-      /* If a volume (partition) appear _much later_ than when media was insertion it
-       * can only be because the media was repartitioned. We don't want to automount
-       * such volumes.
+      /* Only automount filesystems from drives of known types/interconnects:
+       *
+       *  - USB
+       *  - Firewire
+       *  - sdio
+       *  - optical discs
+       *
+       * The mantra here is "be careful" - we really don't want to
+       * automount fs'es from all devices in a SAN etc - We REALLY
+       * need to be CAREFUL here.
+       *
+       * Sidebar: Actually, a surprisingly large number of admins like
+       *          to log into GNOME as root (thus having all polkit
+       *          authorizations) and if weren't careful we'd
+       *          automount all mountable devices from the box. See
+       *          the enterprise distro bug trackers for details.
        */
-      volume->should_automount = TRUE;
+      volume->should_automount = FALSE;
       if (volume->drive != NULL)
         {
+          GduPresentable *drive_presentable;
+          drive_presentable = g_gdu_drive_get_presentable (volume->drive);
+          if (drive_presentable != NULL)
+            {
+              GduDevice *drive_device;
+              drive_device = gdu_presentable_get_device (drive_presentable);
+              if (drive_device != NULL)
+                {
+                  if (gdu_device_is_drive (drive_device))
+                    {
+                      const gchar *connection_interface;
+
+                      connection_interface = gdu_device_drive_get_connection_interface (drive_device);
+
+                      if (g_strcmp0 (connection_interface, "usb") == 0 ||
+                          g_strcmp0 (connection_interface, "firewire") == 0 ||
+                          g_strcmp0 (connection_interface, "sdio") == 0 ||
+                          gdu_device_is_optical_disc (drive_device))
+                        {
+                          volume->should_automount = TRUE;
+                        }
+                    }
+                  g_object_unref (drive_device);
+                }
+            }
+
+          /* If a volume (partition) appear _much later_ than when media was inserted it
+           * can only be because the media was repartitioned. We don't want to automount
+           * such volumes.
+           */
           now = time (NULL);
           if (now - g_gdu_drive_get_time_of_last_media_insertion (volume->drive) > 5)
             volume->should_automount = FALSE;
-- 
1.6.5.5



Index: gvfs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gvfs/F-12/gvfs.spec,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -p -r1.174 -r1.175
--- gvfs.spec	1 Dec 2009 11:04:17 -0000	1.174
+++ gvfs.spec	8 Dec 2009 19:51:28 -0000	1.175
@@ -1,7 +1,7 @@
 Summary: Backends for the gio framework in GLib
 Name: gvfs
 Version: 1.4.2
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: LGPLv2+
 Group: System Environment/Libraries
 URL: http://www.gtk.org
@@ -47,6 +47,12 @@ Patch4: gvfs-1.4.3-ftp-fixes.patch 
 Patch12: gvfs-1.4.1-http-suport-stream-query-info.patch
 Patch13: gvfs-1.4.1-http-soup-header-parsing.patch
 
+# from upstream (in master and gnome-2-28 branch already)
+Patch20: 0001-gdu-Stop-assuming-that-drives-have-no-enclosing-pres.patch
+Patch21: 0002-gdu-Prefer-using-dev_t-to-device-file-when-comparing.patch
+Patch22: 0003-gdu-Be-more-careful-with-automounting-use-a-whitelis.patch
+
+
 Obsoletes: gnome-mount <= 0.8
 Obsoletes: gnome-mount-nautilus-properties <= 0.8
 
@@ -148,6 +154,9 @@ and iPod Touches to applications using g
 %patch4 -p1 -b .ftp-fix
 %patch12 -p1 -b .http-query-info
 %patch13 -p1 -b .http-headers
+%patch20 -p1 -b .udisks-fixes
+%patch21 -p1 -b .handle-new-umount-behavior
+%patch22 -p1 -b .careful-automounting
 
 %build
 
@@ -313,6 +322,12 @@ killall -USR1 gvfsd >&/dev/null || :
 %{_datadir}/gvfs/remote-volume-monitors/afc.monitor
 
 %changelog
+* Tue Dec  8 2009 David Zeuthen <davidz at redhat.com> - 1.4.2-3
+- Backport fixes from git
+- Correct wrong assumptions about how libgdu.so works
+- Make LUKS volumes work with new mount(8) behavior
+- Be more careful deciding what volumes to automatically mount
+
 * Tue Dec  1 2009 Alexander Larsson <alexl at redhat.com> - 1.4.2-2
 - Backport fixes from git:
 - Don't leak metadata strings




More information about the scm-commits mailing list