[patch] xfer fails silently (bug 320869)



Currently vfs happily returns RESULT_OK when trying to xfer a file to a
remote uri even if the xfer didn't really happen. For instance try

gnomevfs-copy README ftp://ftp.gnome.org/robots.txt
gnomevfs-copy /etc/fstab ssh://paolo:xxxx localhost/foo.txt (where /foo.txt,
already exists)

This is very bad for gedit since we cannot know if a save operation was
really successful or not.

The problem seems to be that xfer calls handle_error() and then it
assumes that the error has been handled and thus it returns OK. However
in in abort mode handle_error simply returns FALSE, with the net result
of always returning OK no matter which error occurred.

http://bugzilla.gnome.org/show_bug.cgi?id=320869 contains a minimal
patch (attached below) to address the issue for the abort case, but
someone more familiar with xfer should look into it: since we pass
&result to handle_error() I suspect we should just let handle_error set
the result appropriately and never assign result = OK.


ciao

	Paolo
Index: libgnomevfs/gnome-vfs-xfer.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-xfer.c,v
retrieving revision 1.126
diff -u -p -r1.126 gnome-vfs-xfer.c
--- libgnomevfs/gnome-vfs-xfer.c	29 Aug 2005 19:39:55 -0000	1.126
+++ libgnomevfs/gnome-vfs-xfer.c	7 Nov 2005 12:00:37 -0000
@@ -2516,11 +2516,10 @@ gnome_vfs_xfer_uri_internal (const GList
 		progress->progress_info->total_bytes_copied = 0;
 
 		if (result != GNOME_VFS_OK) {
-			/* don't care about any results from handle_error */
-			handle_error (&result, progress, &error_mode, &skip);
-
-			/* whatever error it was, we handled it */
-			result = GNOME_VFS_OK;
+			if (handle_error (&result, progress, &error_mode, &skip)) {
+				/* whatever error it was, we handled it */
+				result = GNOME_VFS_OK;
+			}
 		} else {
 			call_progress (progress, GNOME_VFS_XFER_PHASE_READYTOGO);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]