After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 710321 - g_file_move returns incorrect error
g_file_move returns incorrect error
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: ftp backend
git master
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2013-10-16 19:55 UTC by Ross Lagerwall
Modified: 2013-11-01 12:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ftp: Return the correct error code for a failed move operation (1.84 KB, patch)
2013-10-16 19:58 UTC, Ross Lagerwall
accepted-commit_now Details | Review

Description Ross Lagerwall 2013-10-16 19:55:41 UTC
When the source file is on an ftp backend, g_file_move() gives the wrong error code if the source file does not exist. It returns "Operation failed" instead of "file not found".
Comment 1 Ross Lagerwall 2013-10-16 19:58:55 UTC
Created attachment 257446 [details] [review]
ftp: Return the correct error code for a failed move operation

When the source file does not exist for a move operation, return
G_IO_ERROR_NOT_FOUND (as specified by the docs) instead of
G_IO_ERROR_FAILED.
Comment 2 Ondrej Holy 2013-10-17 12:31:49 UTC
Review of attachment 257446 [details] [review]:

It looks good, just note...

::: daemon/gvfsbackendftp.c
@@ +1325,3 @@
   GVfsFtpFile *srcfile, *destfile;
+  static const GVfsFtpErrorFunc rnfr_handlers[] = { error_550_permission_or_not_found,
+                                                    NULL };

Wouldn't be better to name it move_handlers?
Comment 3 Ross Lagerwall 2013-10-17 13:09:38 UTC
Well it's specifically a handler for the RNFR command and not the RNTO command which is also part of the overall do_move().  But I guess either way would be OK.
Comment 4 Ross Lagerwall 2013-11-01 12:19:41 UTC
Pushed to master as 7fae708. Thanks!