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 696163 - Overwriting an file using the MTP backend in nautilus fails with "could not send object info."
Overwriting an file using the MTP backend in nautilus fails with "could not s...
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: mtp backend
1.15.x
Other Linux
: Normal normal
: ---
Assigned To: Philip Langdale
gvfs-maint
Depends on: 696016
Blocks: 696190
 
 
Reported: 2013-03-19 21:56 UTC by Nirbheek Chauhan
Modified: 2013-08-16 03:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Support overwrite in do_push (1.76 KB, patch)
2013-03-20 16:12 UTC, Philip Langdale
none Details | Review

Description Nirbheek Chauhan 2013-03-19 21:56:01 UTC
Trying to overwrite a file fails with "could not send object info" in LIBMTP_Send_File_From_File() instead of prompting the user for an action. Perhaps because the backend doesn't check for an existing file and raise G_IO_ERROR_EXISTS in do_push()? 

I compared the mtp backend to the obexftp backend and found that it doesn't handle all the possible error cases. Is that on purpose? If not, I'll attach a patch to handle the error cases properly.
Comment 1 Philip Langdale 2013-03-19 22:13:49 UTC
Patches always welcome :-)

Does Nautilus actually try to delete the file if it gets G_IO_ERROR_EXISTS?
Comment 2 Nirbheek Chauhan 2013-03-20 06:45:42 UTC
(In reply to comment #1)
> Patches always welcome :-)
> 
> Does Nautilus actually try to delete the file if it gets G_IO_ERROR_EXISTS?

Yep, it does:

copy_move_file() in libnautilus-private/nautilus-file-operations.c:

       /* Conflict */
        if (!overwrite &&
            IS_IO_ERROR (error, EXISTS)) {
                gboolean is_merge;
                ConflictResponseData *response;

                [...]
                response = run_conflict_dialog (job, src, dest, dest_dir);
                [...]

So, if the operation returns G_IO_ERROR_EXISTS, the file name conflict dialog is popped up. In either case, returning the correct error is part of the API, so it should be returned appropriately. :)
Comment 3 Philip Langdale 2013-03-20 16:07:18 UTC
It's not quite that simple. It re-issues the copy with the OVERWRITE copy flag set, which the backend then needs to respect. Right now I ignore the copy flags.

It's actually easier for me to deal with this - as this change is simpler when done on top of the patch for bug 696016.
Comment 4 Philip Langdale 2013-03-20 16:12:33 UTC
Created attachment 239368 [details] [review]
Support overwrite in do_push
Comment 5 Nirbheek Chauhan 2013-03-20 16:23:24 UTC
(In reply to comment #3)
> It's not quite that simple. It re-issues the copy with the OVERWRITE copy flag
> set, which the backend then needs to respect. Right now I ignore the copy
> flags.
> 

Yeah, that's what I meant. Nautilus tries to overwrite based on the user's input in the conflict resolution window. I didn't notice that do_push ignores the copy flags, though.

> It's actually easier for me to deal with this - as this change is simpler when
> done on top of the patch for bug 696016.

That bug and its parents are great. Thanks for taking care of this!