From 0a7db7a5b6065d966d36d3bff2ff0e852a6e232f Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Mon, 4 Oct 2010 14:40:15 +0200 Subject: [PATCH 1/4] - Fix sftp poll timeout --- gvfs-1.6.4-gconf-deadlock.patch | 154 ----------------------------- gvfs-1.6.5-sftp-poll-timeout.patch | 30 ++++++ gvfs.spec | 13 ++- 3 files changed, 42 insertions(+), 155 deletions(-) delete mode 100644 gvfs-1.6.4-gconf-deadlock.patch create mode 100644 gvfs-1.6.5-sftp-poll-timeout.patch diff --git a/gvfs-1.6.4-gconf-deadlock.patch b/gvfs-1.6.4-gconf-deadlock.patch deleted file mode 100644 index 514fa7b..0000000 --- a/gvfs-1.6.4-gconf-deadlock.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 5c060227daefafb6c0751422fa585483fc861515 Mon Sep 17 00:00:00 2001 -From: Tomas Bzatek -Date: Wed, 08 Sep 2010 16:13:20 +0000 -Subject: Move GConf initialization from backend constructor - -Solve the deadlock described in bug 628889 ---- -diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c -index 88dac26..a4010c5 100644 ---- a/daemon/gvfsbackendsmb.c -+++ b/daemon/gvfsbackendsmb.c -@@ -121,6 +121,27 @@ g_vfs_backend_smb_finalize (GObject *object) - static void - g_vfs_backend_smb_init (GVfsBackendSmb *backend) - { -+#ifdef HAVE_GCONF -+ GConfClient *gclient; -+#endif -+ -+#ifdef HAVE_GCONF -+ gclient = gconf_client_get_default (); -+ if (gclient) -+ { -+ char *workgroup; -+ -+ workgroup = gconf_client_get_string (gclient, -+ PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL); -+ -+ if (workgroup && workgroup[0]) -+ default_workgroup = workgroup; -+ else -+ g_free (workgroup); -+ -+ g_object_unref (gclient); -+ } -+#endif - } - - /** -@@ -2109,9 +2130,6 @@ g_vfs_backend_smb_class_init (GVfsBackendSmbClass *klass) - { - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GVfsBackendClass *backend_class = G_VFS_BACKEND_CLASS (klass); --#ifdef HAVE_GCONF -- GConfClient *gclient; --#endif - - gobject_class->finalize = g_vfs_backend_smb_finalize; - -@@ -2138,25 +2156,6 @@ g_vfs_backend_smb_class_init (GVfsBackendSmbClass *klass) - backend_class->move = do_move; - backend_class->try_query_settable_attributes = try_query_settable_attributes; - backend_class->set_attribute = do_set_attribute; -- --#ifdef HAVE_GCONF -- gclient = gconf_client_get_default (); -- if (gclient) -- { -- char *workgroup; -- -- workgroup = gconf_client_get_string (gclient, -- PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL); -- -- if (workgroup && workgroup[0]) -- default_workgroup = workgroup; -- else -- g_free (workgroup); -- -- g_object_unref (gclient); -- } --#endif -- - } - - void -diff --git a/daemon/gvfsbackendsmbbrowse.c b/daemon/gvfsbackendsmbbrowse.c -index 97d3c99..dd3dc2a 100644 ---- a/daemon/gvfsbackendsmbbrowse.c -+++ b/daemon/gvfsbackendsmbbrowse.c -@@ -247,11 +247,35 @@ g_vfs_backend_smb_browse_finalize (GObject *object) - static void - g_vfs_backend_smb_browse_init (GVfsBackendSmbBrowse *backend) - { -+#ifdef HAVE_GCONF -+ GConfClient *gclient; -+#endif -+ - backend->entries_lock = g_mutex_new (); - backend->update_cache_lock = g_mutex_new (); - - if (mount_tracker == NULL) - mount_tracker = g_mount_tracker_new (NULL); -+ -+#ifdef HAVE_GCONF -+ gclient = gconf_client_get_default (); -+ if (gclient) -+ { -+ char *workgroup; -+ -+ workgroup = gconf_client_get_string (gclient, -+ PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL); -+ -+ if (workgroup && workgroup[0]) -+ default_workgroup = workgroup; -+ else -+ g_free (workgroup); -+ -+ g_object_unref (gclient); -+ } -+#endif -+ -+ DEBUG ("g_vfs_backend_smb_browse_init: default workgroup = '%s'\n", default_workgroup ? default_workgroup : "NULL"); - } - - /** -@@ -1456,9 +1480,6 @@ g_vfs_backend_smb_browse_class_init (GVfsBackendSmbBrowseClass *klass) - { - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GVfsBackendClass *backend_class = G_VFS_BACKEND_CLASS (klass); --#ifdef HAVE_GCONF -- GConfClient *gclient; --#endif - - gobject_class->finalize = g_vfs_backend_smb_browse_finalize; - -@@ -1475,26 +1496,6 @@ g_vfs_backend_smb_browse_class_init (GVfsBackendSmbBrowseClass *klass) - backend_class->try_query_info = try_query_info; - backend_class->enumerate = do_enumerate; - backend_class->try_enumerate = try_enumerate; -- --#ifdef HAVE_GCONF -- gclient = gconf_client_get_default (); -- if (gclient) -- { -- char *workgroup; -- -- workgroup = gconf_client_get_string (gclient, -- PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL); -- -- if (workgroup && workgroup[0]) -- default_workgroup = workgroup; -- else -- g_free (workgroup); -- -- g_object_unref (gclient); -- } --#endif -- -- DEBUG ("g_vfs_backend_smb_browse_class_init - default workgroup = '%s'\n", default_workgroup ? default_workgroup : "NULL"); - } - - void --- -cgit v0.8.3.1 diff --git a/gvfs-1.6.5-sftp-poll-timeout.patch b/gvfs-1.6.5-sftp-poll-timeout.patch new file mode 100644 index 0000000..a236dd2 --- /dev/null +++ b/gvfs-1.6.5-sftp-poll-timeout.patch @@ -0,0 +1,30 @@ +From 4033907045abcf498686c1b34be7b0160260088d Mon Sep 17 00:00:00 2001 +From: Andreas Henriksson +Date: Sat, 02 Oct 2010 12:51:54 +0000 +Subject: sftp: fix poll() timeout. + +When switching from select() to poll() in commit +"sftp: Use poll() to cope with openssh-5.6 changes" (c6be45c8934) +the difference in seconds vs milliseconds for select/poll timeout +argument was missed. + +SFTP_READ_TIMEOUT is defined in seconds, so multiply it with 1000 +when using it with poll(). + +https://bugzilla.gnome.org/show_bug.cgi?id=631169 +--- +diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c +index 9fecf6a..f6b7785 100644 +--- a/daemon/gvfsbackendsftp.c ++++ b/daemon/gvfsbackendsftp.c +@@ -869,7 +869,7 @@ handle_login (GVfsBackend *backend, + fds[1].fd = prompt_fd; + fds[1].events = POLLIN; + +- ret = poll(fds, 2, SFTP_READ_TIMEOUT); ++ ret = poll(fds, 2, SFTP_READ_TIMEOUT * 1000); + + if (ret <= 0) + { +-- +cgit v0.8.3.1 diff --git a/gvfs.spec b/gvfs.spec index 8f2c70c..067849c 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -1,7 +1,7 @@ Summary: Backends for the gio framework in GLib Name: gvfs Version: 1.6.4 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.gtk.org @@ -40,6 +40,12 @@ Patch0: gvfs-archive-integration.patch # https://bugzilla.redhat.com/show_bug.cgi?id=552856 Patch15: gvfs-1.5.1-gphoto2-no-storageinfo-support.patch +# from upstream +Patch16: gvfs-1.6.2-stringv-dbus.patch + +# from upstream +Patch17: gvfs-1.6.5-sftp-poll-timeout.patch + Obsoletes: gnome-mount <= 0.8 Obsoletes: gnome-mount-nautilus-properties <= 0.8 @@ -137,6 +143,8 @@ including phones and music players to applications using gvfs. %setup -q %patch0 -p1 -b .archive-integration %patch15 -p1 -b .gphoto2-storageinfo +%patch16 -p1 -b .stringv-dbus +%patch17 -p1 -b .sftp-timeout %build @@ -306,6 +314,9 @@ killall -USR1 gvfsd >&/dev/null || : %endif %changelog +* Mon Oct 4 2010 Tomas Bzatek - 1.6.4-2 +- Fix sftp poll timeout + * Wed Sep 29 2010 Matthias Clasen - 1.6.4-1 - Update to 1.6.4 From bac5a0e0bb05b84be883b93eea3a53c53173fafe Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Wed, 13 Oct 2010 16:38:35 +0200 Subject: [PATCH 2/4] - FUSE: Add O_TRUNC support for open() --- gvfs-1.6.5-fuse-open-trunc-support.patch | 77 ++++++++++++++++++++++++ gvfs.spec | 10 ++- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 gvfs-1.6.5-fuse-open-trunc-support.patch diff --git a/gvfs-1.6.5-fuse-open-trunc-support.patch b/gvfs-1.6.5-fuse-open-trunc-support.patch new file mode 100644 index 0000000..b5d096d --- /dev/null +++ b/gvfs-1.6.5-fuse-open-trunc-support.patch @@ -0,0 +1,77 @@ +From 0d1dc99a87d354e8af9cb0f98827bafb2cd7f577 Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Wed, 13 Oct 2010 16:25:51 +0200 +Subject: [PATCH] fuse: Add O_TRUNC support for open() + +This requires kernel version 2.6.24 or later. + +See bug 627567 for details. +--- + client/gvfsfusedaemon.c | 16 +++++++++++----- + 1 files changed, 11 insertions(+), 5 deletions(-) + +diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c +index 13cb74d..bc3090d 100644 +--- a/client/gvfsfusedaemon.c ++++ b/client/gvfsfusedaemon.c +@@ -948,7 +948,7 @@ setup_input_stream (GFile *file, FileHandle *fh) + } + + static gint +-setup_output_stream (GFile *file, FileHandle *fh) ++setup_output_stream (GFile *file, FileHandle *fh, int flags) + { + GError *error = NULL; + gint result = 0; +@@ -968,7 +968,10 @@ setup_output_stream (GFile *file, FileHandle *fh) + + if (!fh->stream) + { +- fh->stream = g_file_append_to (file, 0, NULL, &error); ++ if (flags & O_TRUNC) ++ fh->stream = g_file_replace (file, NULL, FALSE, 0, NULL, &error); ++ else ++ fh->stream = g_file_append_to (file, 0, NULL, &error); + if (fh->stream) + fh->pos = g_seekable_tell (G_SEEKABLE (fh->stream)); + } +@@ -1024,7 +1027,7 @@ vfs_open (const gchar *path, struct fuse_file_info *fi) + set_pid_for_file (file); + + if (fi->flags & O_WRONLY || fi->flags & O_RDWR) +- result = setup_output_stream (file, fh); ++ result = setup_output_stream (file, fh, fi->flags); + else + result = setup_input_stream (file, fh); + +@@ -1406,7 +1409,7 @@ vfs_write (const gchar *path, const gchar *buf, size_t len, off_t offset, + { + g_mutex_lock (fh->mutex); + +- result = setup_output_stream (file, fh); ++ result = setup_output_stream (file, fh, 0); + if (result == 0) + { + result = write_stream (fh, buf, len, offset); +@@ -1857,7 +1860,7 @@ vfs_ftruncate (const gchar *path, off_t size, struct fuse_file_info *fi) + { + g_mutex_lock (fh->mutex); + +- result = setup_output_stream (file, fh); ++ result = setup_output_stream (file, fh, 0); + + if (result == 0) + { +@@ -2336,6 +2339,9 @@ vfs_init (struct fuse_conn_info *conn) + subthread_main_loop = g_main_loop_new (NULL, FALSE); + subthread = g_thread_create ((GThreadFunc) subthread_main, NULL, FALSE, NULL); + ++ /* Indicate O_TRUNC support for open() */ ++ conn->want |= FUSE_CAP_ATOMIC_O_TRUNC; ++ + return NULL; + } + +-- +1.7.3.1 + diff --git a/gvfs.spec b/gvfs.spec index 067849c..edb2023 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -1,7 +1,7 @@ Summary: Backends for the gio framework in GLib Name: gvfs Version: 1.6.4 -Release: 2%{?dist} +Release: 3%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.gtk.org @@ -46,6 +46,10 @@ Patch16: gvfs-1.6.2-stringv-dbus.patch # from upstream Patch17: gvfs-1.6.5-sftp-poll-timeout.patch +# https://bugzilla.gnome.org/show_bug.cgi?id=627567 +# Data loss when writing files +Patch18: gvfs-1.6.5-fuse-open-trunc-support.patch + Obsoletes: gnome-mount <= 0.8 Obsoletes: gnome-mount-nautilus-properties <= 0.8 @@ -145,6 +149,7 @@ including phones and music players to applications using gvfs. %patch15 -p1 -b .gphoto2-storageinfo %patch16 -p1 -b .stringv-dbus %patch17 -p1 -b .sftp-timeout +%patch18 -p1 -b .fuse-trunc %build @@ -314,6 +319,9 @@ killall -USR1 gvfsd >&/dev/null || : %endif %changelog +* Wed Oct 13 2010 Tomas Bzatek - 1.6.4-3 +- FUSE: Add O_TRUNC support for open() + * Mon Oct 4 2010 Tomas Bzatek - 1.6.4-2 - Fix sftp poll timeout From 55fafde92f60c2e483310165e542f34a287854c4 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Mon, 1 Nov 2010 16:19:00 +0100 Subject: [PATCH 3/4] - Use correct "usb:" address for GPhoto mounts with gudev (#642836) --- gvfs-1.6.5-gphoto-addresses.patch | 124 ++++++++++++++++++++++++++++++ gvfs.spec | 8 +- 2 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 gvfs-1.6.5-gphoto-addresses.patch diff --git a/gvfs-1.6.5-gphoto-addresses.patch b/gvfs-1.6.5-gphoto-addresses.patch new file mode 100644 index 0000000..bd7fbb1 --- /dev/null +++ b/gvfs-1.6.5-gphoto-addresses.patch @@ -0,0 +1,124 @@ +From 089ba0b1af08f8b7506bd867a415e197f4017ec0 Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Thu, 28 Oct 2010 16:25:12 +0000 +Subject: Use correct "usb:" address for GPhoto mounts with gudev + +gphoto2 expects the usb:X,X addresses to use the dirname and device +names from libusb, which are zero-padded. Given that it's what udev +gives us, just don't transform it to an int before printing. + +https://bugzilla.gnome.org/show_bug.cgi?id=631562 +--- +diff --git a/monitor/gphoto2/ggphoto2volumemonitor.c b/monitor/gphoto2/ggphoto2volumemonitor.c +index 9fefc5d..25affe3 100644 +--- a/monitor/gphoto2/ggphoto2volumemonitor.c ++++ b/monitor/gphoto2/ggphoto2volumemonitor.c +@@ -83,7 +83,7 @@ static void update_cameras (GGPhoto2VolumeMonitor *monitor, + GList **removed_volumes); + #endif + +-static GList* get_stores_for_camera (int bus_num, int device_num); ++static GList* get_stores_for_camera (const char *bus_num, const char *device_num); + + G_DEFINE_TYPE (GGPhoto2VolumeMonitor, g_gphoto2_volume_monitor, G_TYPE_VOLUME_MONITOR) + +@@ -195,9 +195,7 @@ gudev_add_camera (GGPhoto2VolumeMonitor *monitor, GUdevDevice *device, gboolean + GGPhoto2Volume *volume; + GList *store_heads, *l; + guint num_store_heads; +- const char *property; +- int usb_bus_num; +- int usb_device_num; ++ const char *usb_bus_num, *usb_device_num; + + /* For iPhones and iPod Touches, don't mount gphoto mounts, + * we already have access through AFC */ +@@ -209,19 +207,17 @@ gudev_add_camera (GGPhoto2VolumeMonitor *monitor, GUdevDevice *device, gboolean + } + #endif /* HAVE_AFC */ + +- property = g_udev_device_get_property (device, "BUSNUM"); +- if (property == NULL) { ++ usb_bus_num = g_udev_device_get_property (device, "BUSNUM"); ++ if (usb_bus_num == NULL) { + g_warning("device %s has no BUSNUM property, ignoring", g_udev_device_get_device_file (device)); + return; + } +- usb_bus_num = atoi (property); + +- property = g_udev_device_get_property (device, "DEVNUM"); +- if (property == NULL) { ++ usb_device_num = g_udev_device_get_property (device, "DEVNUM"); ++ if (usb_device_num == NULL) { + g_warning("device %s has no DEVNUM property, ignoring", g_udev_device_get_device_file (device)); + return; + } +- usb_device_num = atoi (property); + + /* g_debug ("gudev_add_camera: camera device %s (bus: %i, device: %i)", + g_udev_device_get_device_file (device), +@@ -241,11 +237,11 @@ gudev_add_camera (GGPhoto2VolumeMonitor *monitor, GUdevDevice *device, gboolean + */ + if (num_store_heads == 1) + { +- uri = g_strdup_printf ("gphoto2://[usb:%03d,%03d]", usb_bus_num, usb_device_num); ++ uri = g_strdup_printf ("gphoto2://[usb:%s,%s]", usb_bus_num, usb_device_num); + } + else + { +- uri = g_strdup_printf ("gphoto2://[usb:%03d,%03d]/%s", usb_bus_num, usb_device_num, ++ uri = g_strdup_printf ("gphoto2://[usb:%s,%s]/%s", usb_bus_num, usb_device_num, + store_path[0] == '/' ? store_path + 1 : store_path); + } + /* g_debug ("gudev_add_camera: ... adding URI for storage head: %s", uri); */ +@@ -608,7 +604,7 @@ update_all (GGPhoto2VolumeMonitor *monitor, + #endif + + static GList * +-get_stores_for_camera (int bus_num, int device_num) ++get_stores_for_camera (const char *bus_num, const char *device_num) + { + GList *l; + CameraStorageInformation *storage_info; +@@ -624,7 +620,7 @@ get_stores_for_camera (int bus_num, int device_num) + camera = NULL; + context = NULL; + l = NULL; +- port = g_strdup_printf ("usb:%d,%d", bus_num, device_num); ++ port = g_strdup_printf ("usb:%s,%s", bus_num, device_num); + + /* Connect to the camera */ + context = gp_context_new (); +@@ -686,6 +682,21 @@ out: + } + + #ifndef HAVE_GUDEV ++static GList * ++get_stores_for_camera_int (int bus_num, int device_num) ++{ ++ GList *ret; ++ char *bus_num_str, *device_num_str; ++ ++ bus_num_str = g_strdup_printf ("%d", bus_num); ++ device_num_str = g_strdup_printf ("%d", device_num); ++ ret = get_stores_for_camera (bus_num_str, device_num_str); ++ g_free (bus_num_str); ++ g_free (device_num_str); ++ ++ return ret; ++} ++ + static void + update_cameras (GGPhoto2VolumeMonitor *monitor, + GList **added_volumes, +@@ -781,7 +792,7 @@ update_cameras (GGPhoto2VolumeMonitor *monitor, + # error "Need OS specific tweaks" + #endif + +- store_heads = get_stores_for_camera (usb_bus_num, usb_device_num); ++ store_heads = get_stores_for_camera_int (usb_bus_num, usb_device_num); + num_store_heads = g_list_length (store_heads); + for (l = store_heads ; l != NULL; l = l->next) + { +-- +cgit v0.8.3.1 diff --git a/gvfs.spec b/gvfs.spec index edb2023..059cc0d 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -1,7 +1,7 @@ Summary: Backends for the gio framework in GLib Name: gvfs Version: 1.6.4 -Release: 3%{?dist} +Release: 4%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.gtk.org @@ -50,6 +50,9 @@ Patch17: gvfs-1.6.5-sftp-poll-timeout.patch # Data loss when writing files Patch18: gvfs-1.6.5-fuse-open-trunc-support.patch +# from upstream +Patch19: gvfs-1.6.5-gphoto-addresses.patch + Obsoletes: gnome-mount <= 0.8 Obsoletes: gnome-mount-nautilus-properties <= 0.8 @@ -319,6 +322,9 @@ killall -USR1 gvfsd >&/dev/null || : %endif %changelog +* Mon Nov 1 2010 Tomas Bzatek - 1.6.4-4 +- Use correct "usb:" address for GPhoto mounts with gudev (#642836) + * Wed Oct 13 2010 Tomas Bzatek - 1.6.4-3 - FUSE: Add O_TRUNC support for open() From 6d3661769b5e7ba36ae11963d0a82ab077ea689e Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Mon, 1 Nov 2010 16:22:20 +0100 Subject: [PATCH 4/4] Apply the patch --- gvfs.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/gvfs.spec b/gvfs.spec index 059cc0d..24e52ab 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -153,6 +153,7 @@ including phones and music players to applications using gvfs. %patch16 -p1 -b .stringv-dbus %patch17 -p1 -b .sftp-timeout %patch18 -p1 -b .fuse-trunc +%patch19 -p1 -b .gphoto-addresses %build