diff --git a/0001-Disallow-mounting-empty-drives.patch b/0001-Disallow-mounting-empty-drives.patch new file mode 100644 index 0000000..e8604f5 --- /dev/null +++ b/0001-Disallow-mounting-empty-drives.patch @@ -0,0 +1,31 @@ +From a0c8d67cfea614c8c920af7c4ce2d90e4ce7256f Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +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 + diff --git a/0002-Disallow-ejecting-empty-drives.patch b/0002-Disallow-ejecting-empty-drives.patch new file mode 100644 index 0000000..ac0841b --- /dev/null +++ b/0002-Disallow-ejecting-empty-drives.patch @@ -0,0 +1,27 @@ +From bef30fdc1cb0986326eac9acd7b5125cd8f4b61c Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +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 + diff --git a/0003-Silently-drop-eject-error-messages-when-detaching-dr.patch b/0003-Silently-drop-eject-error-messages-when-detaching-dr.patch new file mode 100644 index 0000000..e295913 --- /dev/null +++ b/0003-Silently-drop-eject-error-messages-when-detaching-dr.patch @@ -0,0 +1,48 @@ +From 6d7f1a8a842376be8f72cc1fc90fc3101e9752a3 Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +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 + diff --git a/gvfs-1.4.1-no-poll-for-media.patch b/gvfs-1.4.1-no-poll-for-media.patch new file mode 100644 index 0000000..d1d6c20 --- /dev/null +++ b/gvfs-1.4.1-no-poll-for-media.patch @@ -0,0 +1,23 @@ +From 780bae9c28df7e6d5f2463d9621f7db48524ee24 Mon Sep 17 00:00:00 2001 +From: David Zeuthen +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 diff --git a/gvfs-1.4.1-separate-eject-safely-remove-drive.patch b/gvfs-1.4.1-separate-eject-safely-remove-drive.patch new file mode 100644 index 0000000..c187ecb --- /dev/null +++ b/gvfs-1.4.1-separate-eject-safely-remove-drive.patch @@ -0,0 +1,84 @@ +From 92bd6869f22bbe582f51f4ffca4d71f65ef9d6a6 Mon Sep 17 00:00:00 2001 +From: David Zeuthen +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 diff --git a/gvfs-1.4.1-trash-dont-overwrite.patch b/gvfs-1.4.1-trash-dont-overwrite.patch new file mode 100644 index 0000000..31581b0 --- /dev/null +++ b/gvfs-1.4.1-trash-dont-overwrite.patch @@ -0,0 +1,65 @@ +From 0b09cc8e57bc5fa701dd685d648fd338b92b2c48 Mon Sep 17 00:00:00 2001 +From: Alexander Larsson +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 diff --git a/gvfs.spec b/gvfs.spec index a41918b..cededf8 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -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.patch # 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 gvfs. %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 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 - 1.4.0-4 - Fix Nautilus not displaying friendly icons for SSH-connected system (#526892) - Actually apply the logical partitions patch diff --git a/obex-crasher.patch b/obex-crasher.patch new file mode 100644 index 0000000..f722ee7 --- /dev/null +++ b/obex-crasher.patch @@ -0,0 +1,22 @@ +commit 59a657175301c5b99bce0ce9a53b14efc202eb8e +Author: Bastien Nocera +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);