rpms/gvfs/devel 0001-Disallow-mounting-empty-drives.patch, NONE, 1.1 0002-Disallow-ejecting-empty-drives.patch, NONE, 1.1 0003-Silently-drop-eject-error-messages-when-detaching-dr.patch, NONE, 1.1 gvfs-1.4.1-no-poll-for-media.patch, NONE, 1.1 gvfs-1.4.1-separate-eject-safely-remove-drive.patch, NONE, 1.1 gvfs-1.4.1-trash-dont-overwrite.patch, NONE, 1.1 obex-crasher.patch, NONE, 1.1 gvfs.spec, 1.158, 1.159

Bastien Nocera hadess at fedoraproject.org
Wed Oct 14 13:40:05 UTC 2009


Author: hadess

Update of /cvs/pkgs/rpms/gvfs/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13902

Modified Files:
	gvfs.spec 
Added Files:
	0001-Disallow-mounting-empty-drives.patch 
	0002-Disallow-ejecting-empty-drives.patch 
	0003-Silently-drop-eject-error-messages-when-detaching-dr.patch 
	gvfs-1.4.1-no-poll-for-media.patch 
	gvfs-1.4.1-separate-eject-safely-remove-drive.patch 
	gvfs-1.4.1-trash-dont-overwrite.patch obex-crasher.patch 
Log Message:
* Wed Oct 14 2009 Bastien Nocera <bnocera at redhat.com> 1.4.0-6
- Fix crasher in ObexFTP (#528181)
- Don't always overwrite on trash restore
- Separate "Safely Remove Drive" from "Eject"
- Don't advertise can_poll for drives not using removable media
- Disallow mounting empty drives
- Disallow ejecting empty drives
- Silently drop eject error messages when detaching drive


0001-Disallow-mounting-empty-drives.patch:
 gvfsbackendcomputer.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- NEW FILE 0001-Disallow-mounting-empty-drives.patch ---
>From a0c8d67cfea614c8c920af7c4ce2d90e4ce7256f Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek at redhat.com>
Date: Fri, 2 Oct 2009 15:05:44 +0200
Subject: [PATCH 1/3] Disallow mounting empty drives

This concerns only removable media drives without any detected volumes.
The end result is no Mount item in Nautilus popup menu and no action taken
on double-click over the drive icon.

The exception is floppy drives, where we always allow mount without need
to detecting media manually first.
---
 daemon/gvfsbackendcomputer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/daemon/gvfsbackendcomputer.c b/daemon/gvfsbackendcomputer.c
index 4f4b9ca..59eadba 100644
--- a/daemon/gvfsbackendcomputer.c
+++ b/daemon/gvfsbackendcomputer.c
@@ -473,7 +473,7 @@ recompute_files (GVfsBackendComputer *backend)
           file->icon = g_drive_get_icon (file->drive);
           file->display_name = g_drive_get_name (file->drive);
           file->can_eject = g_drive_can_eject (file->drive);
-          file->can_mount = TRUE;
+          file->can_mount = ! g_drive_is_media_removable (file->drive) || ! g_drive_is_media_check_automatic (file->drive) || g_drive_has_media (file->drive);
         }
 
       if (file->drive)
-- 
1.6.5.rc2


0002-Disallow-ejecting-empty-drives.patch:
 ggdudrive.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- NEW FILE 0002-Disallow-ejecting-empty-drives.patch ---
>From bef30fdc1cb0986326eac9acd7b5125cd8f4b61c Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek at redhat.com>
Date: Fri, 2 Oct 2009 15:21:51 +0200
Subject: [PATCH 2/3] Disallow ejecting empty drives

Similar to previous commit, hide the Eject menu item when drive has no media.
---
 monitor/gdu/ggdudrive.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/monitor/gdu/ggdudrive.c b/monitor/gdu/ggdudrive.c
index b99ef6e..3509382 100644
--- a/monitor/gdu/ggdudrive.c
+++ b/monitor/gdu/ggdudrive.c
@@ -188,7 +188,8 @@ update_drive (GGduDrive *drive)
        *
        * See also below where we e.g. set can_eject to TRUE for non-removable drives.
        */
-      drive->can_eject = gdu_device_drive_get_is_media_ejectable (device) || gdu_device_drive_get_requires_eject (device) || gdu_device_is_removable (device);
+      drive->can_eject = ((gdu_device_drive_get_is_media_ejectable (device) || gdu_device_is_removable (device)) && gdu_device_is_media_available (device)) ||
+                           gdu_device_drive_get_requires_eject (device);
       drive->is_media_check_automatic = gdu_device_is_media_change_detected (device);
       drive->can_poll_for_media = gdu_device_is_removable (device);
     }
-- 
1.6.5.rc2


0003-Silently-drop-eject-error-messages-when-detaching-dr.patch:
 ggdudrive.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

--- NEW FILE 0003-Silently-drop-eject-error-messages-when-detaching-dr.patch ---
>From 6d7f1a8a842376be8f72cc1fc90fc3101e9752a3 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek at redhat.com>
Date: Fri, 2 Oct 2009 15:35:41 +0200
Subject: [PATCH 3/3] Silently drop eject error messages when detaching drive

If there's no media in drive and yet it's marked as detachable,
calling eject would cause "no media in drive" error.
This is the case with my USB SD card reader.
---
 monitor/gdu/ggdudrive.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/monitor/gdu/ggdudrive.c b/monitor/gdu/ggdudrive.c
index 3509382..eb70d75 100644
--- a/monitor/gdu/ggdudrive.c
+++ b/monitor/gdu/ggdudrive.c
@@ -648,6 +648,18 @@ eject_cb (GduDevice *device,
 {
   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
   GGduDrive *drive;
+  gboolean drive_detachable;
+
+  drive = G_GDU_DRIVE (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
+  drive_detachable = drive->can_stop == FALSE && drive->start_stop_type == G_DRIVE_START_STOP_TYPE_SHUTDOWN;
+
+  if (error != NULL && error->code == G_IO_ERROR_FAILED && 
+      drive_detachable && ! drive->has_media && drive->is_media_removable)
+    {
+      /* Silently drop the error if there's no media in drive and we're still trying to detach it (see below) */
+      g_error_free (error);
+      error = NULL;
+    }
 
   if (error != NULL)
     {
@@ -658,8 +670,7 @@ eject_cb (GduDevice *device,
       goto out;
     }
 
-  drive = G_GDU_DRIVE (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
-  if (drive->can_stop == FALSE && drive->start_stop_type == G_DRIVE_START_STOP_TYPE_SHUTDOWN)
+  if (drive_detachable)
     {
       /* If device is not ejectable but it is detachable and we don't support stop(),
        * then also run Detach() after Eject() - see update_drive() for details for why...
-- 
1.6.5.rc2


gvfs-1.4.1-no-poll-for-media.patch:
 ggdudrive.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- NEW FILE gvfs-1.4.1-no-poll-for-media.patch ---
>From 780bae9c28df7e6d5f2463d9621f7db48524ee24 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz at redhat.com>
Date: Fri, 09 Oct 2009 00:26:11 +0000
Subject: Fix return value of gdu_drive_can_poll_for_media()

If a drive doesn't use removable media, we shouldn't advertise that it
can be polled.
---
diff --git a/monitor/gdu/ggdudrive.c b/monitor/gdu/ggdudrive.c
index 9920829..20f8940 100644
--- a/monitor/gdu/ggdudrive.c
+++ b/monitor/gdu/ggdudrive.c
@@ -190,7 +190,7 @@ update_drive (GGduDrive *drive)
        */
       drive->can_eject = gdu_device_drive_get_is_media_ejectable (device) || gdu_device_drive_get_requires_eject (device) || gdu_device_is_removable (device);
       drive->is_media_check_automatic = gdu_device_is_media_change_detected (device);
-      drive->can_poll_for_media = TRUE;
+      drive->can_poll_for_media = gdu_device_is_removable (device);
     }
 
   /* determine start/stop type */
--
cgit v0.8.2

gvfs-1.4.1-separate-eject-safely-remove-drive.patch:
 ggdudrive.c |   53 ++++++++++++++++++++++-------------------------------
 1 file changed, 22 insertions(+), 31 deletions(-)

--- NEW FILE gvfs-1.4.1-separate-eject-safely-remove-drive.patch ---
>From 92bd6869f22bbe582f51f4ffca4d71f65ef9d6a6 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz at redhat.com>
Date: Fri, 09 Oct 2009 00:20:27 +0000
Subject: Bug 597864 –  Need to separate "Safely Remove Drive" from "Eject"

Some systems use internal USB devices. Automatically detaching such
drives when calling gdu_drive_eject() (triggered by e.g. the eject
button in the Nautilus sidebar) as we do right now leads to loss of
the drive until reboot (since the device is internal). The only viable
option right now is to separate "Safely Remove Drive" and "Eject".

If we gain infrastructure to let us know with 100% accuracy that a
given receptacle is external we can go back to the previous behavior.

See http://bugs.freedesktop.org/show_bug.cgi?id=24343 for details.
---
diff --git a/monitor/gdu/ggdudrive.c b/monitor/gdu/ggdudrive.c
index b99ef6e..9920829 100644
--- a/monitor/gdu/ggdudrive.c
+++ b/monitor/gdu/ggdudrive.c
@@ -212,39 +212,31 @@ update_drive (GGduDrive *drive)
     }
   else if (device != NULL && gdu_device_drive_get_can_detach (device))
     {
-      /* If the device is not ejectable, just detach on Eject() and claim to be ejectable.
+      /* Ideally, for non-ejectable devices (e.g. non-cdrom, non-zip)
+       * such as USB sticks we'd display "Eject" instead of "Shutdown"
+       * since it is more familiar and the common case. The way this
+       * should work is that after the Eject() method returns we call
+       * Detach() - see eject_cb() below.
        *
-       * This is so we get the UI to display "Eject" instead of "Shutdown" since it is
-       * more familiar and the common case. The way this works is that after the Eject()
-       * method returns we call Detach() - see eject_cb() below.
+       * (Note that it's not enough to just call Detach() since some
+       * devices, such as the Kindle, only works with Eject(). So we
+       * call them both in order).
        *
-       * (Note that it's not enough to just call Detach() since some devices, such as
-       * the Kindle, only works with Eject(). So we call them both in order)
+       * We actually used to do this (and that's why eject_cb() still
+       * has this code) but some systems use internal USB devices for
+       * e.g. SD card readers. If we were to detach these then the
+       * user would have to power-cycle the system to get the device
+       * back. See http://bugs.freedesktop.org/show_bug.cgi?id=24343
+       * for more details.
+       *
+       * In the future, if we know for sure that a port is external
+       * (like, from DMI data) we can go back to doing this. For now
+       * the user will get all the options...
        */
-      if (!gdu_device_drive_get_is_media_ejectable (device))
-        {
-          drive->can_eject = TRUE;
-          /* we still set this since
-           *
-           * a) it helps when debugging things using gvfs-mount(1) output
-           *    since the tool will print can_stop=0 but start_stop_type=shutdown
-           *
-           * b) we use it in eject_cb() to determine we need to call Detach()
-           *    after Eject() successfully completes
-           */
-          drive->start_stop_type = G_DRIVE_START_STOP_TYPE_SHUTDOWN;
-        }
-      else
-        {
-          /* So here the device is ejectable and detachable - for example, a USB CD-ROM
-           * drive or a CD-ROM drive in an Ultrabay - for these, we want to offer both
-           * "Eject" and "Shutdown" options in the UI
-           */
-          drive->can_stop = TRUE;
-          drive->can_start = FALSE;
-          drive->can_start_degraded = FALSE;
-          drive->start_stop_type = G_DRIVE_START_STOP_TYPE_SHUTDOWN;
-        }
+      drive->can_stop = TRUE;
+      drive->can_start = FALSE;
+      drive->can_start_degraded = FALSE;
+      drive->start_stop_type = G_DRIVE_START_STOP_TYPE_SHUTDOWN;
     }
 
   if (device != NULL)
--
cgit v0.8.2

gvfs-1.4.1-trash-dont-overwrite.patch:
 gvfsbackendtrash.c   |    2 +-
 trashlib/trashitem.c |    8 +++++---
 trashlib/trashitem.h |    2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

--- NEW FILE gvfs-1.4.1-trash-dont-overwrite.patch ---
>From 0b09cc8e57bc5fa701dd685d648fd338b92b2c48 Mon Sep 17 00:00:00 2001
From: Alexander Larsson <alexl at redhat.com>
Date: Thu, 08 Oct 2009 13:11:10 +0000
Subject: Don't always overwrite on trash restore

We want to get overwrite dialogs when restoring from trash.

https://bugzilla.gnome.org/show_bug.cgi?id=596618
---
diff --git a/daemon/gvfsbackendtrash.c b/daemon/gvfsbackendtrash.c
index 166bd04..e515fb8 100644
--- a/daemon/gvfsbackendtrash.c
+++ b/daemon/gvfsbackendtrash.c
@@ -447,7 +447,7 @@ trash_backend_pull (GVfsBackend           *vfs_backend,
               destination = g_file_new_for_path (local_path);
 
               if (remove_source)
-                it_worked = trash_item_restore (item, destination, &error);
+                it_worked = trash_item_restore (item, destination, flags, &error);
               else
                 it_worked = g_file_copy (real, destination, flags, 
                                          G_VFS_JOB (job)->cancellable, 
diff --git a/daemon/trashlib/trashitem.c b/daemon/trashlib/trashitem.c
index 335e8d4..bcfc301 100644
--- a/daemon/trashlib/trashitem.c
+++ b/daemon/trashlib/trashitem.c
@@ -486,7 +486,9 @@ trash_item_delete (TrashItem  *item,
       temp_name = g_file_get_child (expunged, buffer);
 
       /* "restore" the item into the expunged folder */
-      if (trash_item_restore (item, temp_name, NULL))
+      if (trash_item_restore (item, temp_name,
+			      G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS,
+			      NULL))
         {
           trash_expunge (expunged);
           success = TRUE;
@@ -507,11 +509,11 @@ trash_item_delete (TrashItem  *item,
 gboolean
 trash_item_restore (TrashItem  *item,
                     GFile      *dest,
+		    GFileCopyFlags flags,
                     GError    **error)
 {
   if (g_file_move (item->file, dest,
-                   G_FILE_COPY_OVERWRITE |
-                   G_FILE_COPY_NOFOLLOW_SYMLINKS |
+		   flags |
                    G_FILE_COPY_NO_FALLBACK_FOR_MOVE,
                    NULL, NULL, NULL, error))
     {
diff --git a/daemon/trashlib/trashitem.h b/daemon/trashlib/trashitem.h
index 0fe0938..ad78202 100644
--- a/daemon/trashlib/trashitem.h
+++ b/daemon/trashlib/trashitem.h
@@ -54,6 +54,7 @@ gboolean        trash_item_delete            (TrashItem          *item,
                                               GError            **error);
 gboolean        trash_item_restore           (TrashItem          *item,
                                               GFile              *dest,
+					      GFileCopyFlags      flags,
                                               GError            **error);
 
 #endif /* _trashitem_h_ */
--
cgit v0.8.2

obex-crasher.patch:
 gvfsbackendobexftp.c |    1 +
 1 file changed, 1 insertion(+)

--- NEW FILE obex-crasher.patch ---
commit 59a657175301c5b99bce0ce9a53b14efc202eb8e
Author: Bastien Nocera <hadess at hadess.net>
Date:   Wed Oct 14 14:27:43 2009 +0100

    Fix crasher in obexftp backend
    
    Spotted by Matthias Clasen
    
    See https://bugzilla.redhat.com/show_bug.cgi?id=528181

diff --git a/daemon/gvfsbackendobexftp.c b/daemon/gvfsbackendobexftp.c
index e658b16..84969db 100644
--- a/daemon/gvfsbackendobexftp.c
+++ b/daemon/gvfsbackendobexftp.c
@@ -1816,6 +1816,7 @@ do_push (GVfsBackend *backend,
       push_data_free (job_data);
 
       g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
+      return;
     }
 
   push_data_free (job_data);


Index: gvfs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gvfs/devel/gvfs.spec,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -p -r1.158 -r1.159
--- gvfs.spec	8 Oct 2009 14:51:35 -0000	1.158
+++ gvfs.spec	14 Oct 2009 13:40:05 -0000	1.159
@@ -1,7 +1,7 @@
 Summary: Backends for the gio framework in GLib
 Name: gvfs
 Version: 1.4.0
-Release: 4%{?dist}
+Release: 6%{?dist}
 License: LGPLv2+
 Group: System Environment/Libraries
 URL: http://www.gtk.org
@@ -44,6 +44,17 @@ Patch3: consider-logical-partitions.patc
 # https://bugzilla.redhat.com/show_bug.cgi?id=526892
 # Nautilus not displaying friendly icons for SSH-connected system
 Patch4: gvfs-1.4.0-mountspec-from-string.patch
+# from upstream
+Patch5: gvfs-1.4.1-trash-dont-overwrite.patch
+Patch6: gvfs-1.4.1-separate-eject-safely-remove-drive.patch
+Patch7: gvfs-1.4.1-no-poll-for-media.patch
+# https://bugzilla.redhat.com/show_bug.cgi?id=520497
+# annoying error dialogs
+Patch8: 0001-Disallow-mounting-empty-drives.patch
+Patch9: 0002-Disallow-ejecting-empty-drives.patch
+Patch10: 0003-Silently-drop-eject-error-messages-when-detaching-dr.patch
+# https://bugzilla.redhat.com/show_bug.cgi?id=528181
+Patch11: obex-crasher.patch
 
 %description
 The gvfs package provides backend implementations for the gio
@@ -140,6 +151,13 @@ and iPod Touches to applications using g
 %patch2 -p1 -b .http-icons
 %patch3 -p1 -b .logical-partitions
 %patch4 -p1 -b .favicons
+%patch5 -p1 -b .trash-overwrite
+%patch6 -p1 -b .separate-eject
+%patch7 -p1 -b .no-poll
+%patch8 -p1 -b .mount-empty
+%patch9 -p1 -b .eject-empty
+%patch10 -p1 -b .error-detaching
+%patch11 -p1 -b .push-fail
 
 %build
 
@@ -293,6 +311,15 @@ update-desktop-database &> /dev/null ||:
 %{_datadir}/gvfs/remote-volume-monitors/afc.monitor
 
 %changelog
+* Wed Oct 14 2009 Bastien Nocera <bnocera at redhat.com> 1.4.0-6
+- Fix crasher in ObexFTP (#528181)
+- Don't always overwrite on trash restore
+- Separate "Safely Remove Drive" from "Eject"
+- Don't advertise can_poll for drives not using removable media
+- Disallow mounting empty drives
+- Disallow ejecting empty drives
+- Silently drop eject error messages when detaching drive
+
 * Thu Oct  8 2009 Tomas Bzatek <tbzatek at redhat.com> - 1.4.0-4
 - Fix Nautilus not displaying friendly icons for SSH-connected system (#526892)
 - Actually apply the logical partitions patch




More information about the fedora-extras-commits mailing list