rpms/gvfs/F-12 gvfs-1.5.4-sftp-unmount.patch, NONE, 1.1 gvfs.spec, 1.181, 1.182
Tomas Bzatek
tbzatek at fedoraproject.org
Mon Feb 15 14:38:43 UTC 2010
Author: tbzatek
Update of /cvs/extras/rpms/gvfs/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26245
Modified Files:
gvfs.spec
Added Files:
gvfs-1.5.4-sftp-unmount.patch
Log Message:
* Mon Feb 15 2010 Tomas Bzatek <tbzatek at redhat.com> - 1.4.3-6
- sftp: fix crash on unmount
gvfs-1.5.4-sftp-unmount.patch:
gvfsbackendsftp.c | 39 +++++++++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)
--- NEW FILE gvfs-1.5.4-sftp-unmount.patch ---
>From 468a8c1cb699d2e2e146b8ec4faa811bf1214ce1 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek at redhat.com>
Date: Mon, 15 Feb 2010 15:15:59 +0100
Subject: [PATCH] sftp: Cancel all pending reads in reply_stream on unmount
Close the active read_reply_async() channel waiting for input from the sftp process.
---
daemon/gvfsbackendsftp.c | 38 +++++++++++++++++++++++++++++++++++---
1 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index 23b482b..44922f6 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -161,6 +161,8 @@ struct _GVfsBackendSftp
GInputStream *reply_stream;
GDataInputStream *error_stream;
+ GCancellable *reply_stream_cancellable;
+
guint32 current_id;
/* Output Queue */
@@ -254,6 +256,9 @@ g_vfs_backend_sftp_finalize (GObject *object)
if (backend->command_stream)
g_object_unref (backend->command_stream);
+ if (backend->reply_stream_cancellable)
+ g_object_unref (backend->reply_stream_cancellable);
+
if (backend->reply_stream)
g_object_unref (backend->reply_stream);
@@ -1216,6 +1221,13 @@ read_reply_async_got_len (GObject *source_object,
error = NULL;
res = g_input_stream_read_finish (G_INPUT_STREAM (source_object), result, &error);
+ /* Bail out if cancelled */
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ {
+ g_object_unref (backend);
+ return;
+ }
+
check_input_stream_read_result (backend, res, error);
backend->reply_size_read += res;
@@ -1224,7 +1236,8 @@ read_reply_async_got_len (GObject *source_object,
{
g_input_stream_read_async (backend->reply_stream,
&backend->reply_size + backend->reply_size_read, 4 - backend->reply_size_read,
- 0, NULL, read_reply_async_got_len, backend);
+ 0, backend->reply_stream_cancellable, read_reply_async_got_len,
+ backend);
return;
}
backend->reply_size = GUINT32_FROM_BE (backend->reply_size);
@@ -1242,7 +1255,9 @@ read_reply_async (GVfsBackendSftp *backend)
backend->reply_size_read = 0;
g_input_stream_read_async (backend->reply_stream,
&backend->reply_size, 4,
- 0, NULL, read_reply_async_got_len, backend);
+ 0, backend->reply_stream_cancellable,
+ read_reply_async_got_len,
+ backend);
}
static void send_command (GVfsBackendSftp *backend);
@@ -1561,6 +1576,7 @@ do_mount (GVfsBackend *backend,
}
op_backend->reply_stream = g_unix_input_stream_new (stdout_fd, TRUE);
+ op_backend->reply_stream_cancellable = g_cancellable_new ();
make_fd_nonblocking (stderr_fd);
is = g_unix_input_stream_new (stderr_fd, TRUE);
@@ -1607,7 +1623,7 @@ do_mount (GVfsBackend *backend,
return;
}
- read_reply_async (op_backend);
+ read_reply_async (g_object_ref (op_backend));
sftp_mount_spec = g_mount_spec_new ("sftp");
if (op_backend->user_specified_in_uri)
@@ -1704,6 +1720,21 @@ try_mount (GVfsBackend *backend,
return FALSE;
}
+static gboolean
+try_unmount (GVfsBackend *backend,
+ GVfsJobUnmount *job,
+ GMountUnmountFlags flags,
+ GMountSource *mount_source)
+{
+ GVfsBackendSftp *op_backend = G_VFS_BACKEND_SFTP (backend);
+
+ if (op_backend->reply_stream && op_backend->reply_stream_cancellable)
+ g_cancellable_cancel (op_backend->reply_stream_cancellable);
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+
+ return TRUE;
+}
+
static int
io_error_code_for_sftp_error (guint32 code, int failure_error)
{
@@ -4630,6 +4661,7 @@ g_vfs_backend_sftp_class_init (GVfsBackendSftpClass *klass)
backend_class->mount = real_do_mount;
backend_class->try_mount = try_mount;
+ backend_class->try_unmount = try_unmount;
backend_class->try_open_icon_for_read = try_open_icon_for_read;
backend_class->try_open_for_read = try_open_for_read;
backend_class->try_read = try_read;
--
1.6.6.1
Index: gvfs.spec
===================================================================
RCS file: /cvs/extras/rpms/gvfs/F-12/gvfs.spec,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -p -r1.181 -r1.182
--- gvfs.spec 8 Feb 2010 16:44:31 -0000 1.181
+++ gvfs.spec 15 Feb 2010 14:38:42 -0000 1.182
@@ -1,7 +1,7 @@
Summary: Backends for the gio framework in GLib
Name: gvfs
Version: 1.4.3
-Release: 5%{?dist}
+Release: 6%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@@ -54,6 +54,10 @@ Patch21: gvfs-1.5.2-ftp-separate-data-co
Patch22: gvfs-1.5.2-ftp-PASV-v4.patch
Patch23: gvfs-1.5.2-ftp-PASV-EPASV-v4-v6.patch
+# gvfsd-sftp crashes on unmount
+# https://bugzilla.redhat.com/show_bug.cgi?id=557548
+Patch24: gvfs-1.5.4-sftp-unmount.patch
+
# AFC patches from upstream
Patch30: gvfs-1.4.1-afc-hide-dot-files.patch
Patch31: gvfs-1.4.1-afc-fast-mime.patch
@@ -181,6 +185,7 @@ including phones and music players to ap
%patch21 -p1 -b .ftp-separate-data-connection-method-supported
%patch22 -p1 -b .ftp-PASV-v4
%patch23 -p1 -b .ftp-PASV-EPASV-v4-v6
+%patch24 -p1 -b .sftp-unmount
%patch30 -p1 -b .afc-hide-dot-files.patch
%patch31 -p1 -b .afc-fast-mime.patch
@@ -363,6 +368,9 @@ killall -USR1 gvfsd >&/dev/null || :
%{_datadir}/gvfs/remote-volume-monitors/afc.monitor
%changelog
+* Mon Feb 15 2010 Tomas Bzatek <tbzatek at redhat.com> - 1.4.3-6
+- sftp: fix crash on unmount
+
* Mon Feb 8 2010 Tomas Bzatek <tbzatek at redhat.com> - 1.4.3-5
- ftp: backport several PASV/EPSV fixes from master (#542205, #555033)
- AFC: Use new libimobiledevice library
More information about the scm-commits
mailing list