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 740383 - Allow items on Google Drive to be renamed
Allow items on Google Drive to be renamed
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: File and Folder Operations
unspecified
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks: 739008
 
 
Reported: 2014-11-19 18:12 UTC by Debarshi Ray
Modified: 2014-11-21 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
file: Let renames work on Google Drive (1.54 KB, patch)
2014-11-19 18:18 UTC, Debarshi Ray
committed Details | Review
file: Remove unused variable (1.21 KB, patch)
2014-11-19 18:18 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2014-11-19 18:12:37 UTC
I have been working on a GVfs backend for Google Drive (see bug 739008). The semantics of Google Drive and the implementation of the rename operation in Nautilus don't work together.

The path to a file or folder (ie. a GDataDocumentsEntry) on Google Drive is composed of their document-ids. See:
https://developer.gnome.org/gdata/unstable/GDataDocumentsEntry.html#gdata-documents-entry-get-path

These document-ids are not human readable and not what is presented in the UI. In other words, the document-id is the standard::name, while the title of the GDataDocumentsEntry makes up the standard::display-name.

When a rename happens, the SetDisplayName method is invoked on the GVfs backend which changes the title of the entry, but the document-id usually remains the same. See:
https://developer.gnome.org/gdata/unstable/GDataEntry.html#gdata-entry-set-title

This breaks the logic in nautilus' rename operation because it expects both standard::name and standard::display-name to change, which is usually what happens on other backends. Since the standard::name of the file before and after the operation is the same, it thinks that there is some other file by the same name which would get overwritten and hides it. But in reality, it is the same file that we are renaming, and not some other file.

I propose to tweak the logic a bit to accommodate this scenario.

As far as I can see, this does not adversely affect other file systems. I tried a local UNIX file system and a WebDAV mount. The backends correctly return a G_IO_ERROR_EXISTS if you try to give a name to a file that is already taken, and the operation errors out gracefully. So, we are probably not going to hit the above logic in nautilus for the other backends anyway.
Comment 1 Debarshi Ray 2014-11-19 18:18:25 UTC
Created attachment 291026 [details] [review]
file: Let renames work on Google Drive
Comment 2 Debarshi Ray 2014-11-19 18:18:52 UTC
Created attachment 291027 [details] [review]
file: Remove unused variable
Comment 3 Carlos Soriano 2014-11-20 09:11:38 UTC
So, if any backend except the google one is actually using that logic because g_file_set_display_name_async raises an error in those cases, why don't you just raise an error in g_file_set_display_name_async for google backend case as well and we can get rid of that logic in nautilus?
Comment 4 Debarshi Ray 2014-11-20 10:34:37 UTC
(In reply to comment #3)
> So, if any backend except the google one is actually using that logic because
> g_file_set_display_name_async raises an error in those cases, why don't you
> just raise an error in g_file_set_display_name_async for google backend case

This logic in the rename operation is based on standard::name, and for Google Drive it is impossible for any two entities to have the same standard::name because they are document-ids generated by the server. So, we will never encounter a scenario where we are renaming a file and its standard::name after the operation is the same as another file, in which case we would have had to hide the other file.

In other words, the uniqueness of the standard::name is guaranteed by the server and we don't need to raise G_IO_ERROR_EXISTS.

However, we do encounter the case where the standard::name of the file remains unchanged before and after rename operation because that is how the Google Drive backend works - only the standard::display-name is changed. This causes nautilus to think that the 'new' standard::name is the same as that of another file and it needs to hide it. In reality, there isn't any other file with the same standard::name. It is the same file that we are renaming, so we should not hide anything.

> we can get rid of that logic in nautilus?

We can, but I don't know nautilus well enough to know whether it will have any negative consequences.
Comment 5 Carlos Soriano 2014-11-20 13:35:17 UTC
Ok I see, I would like in any case to get rid of that logic. I would let Cosimo take a look here since I don't know enough to make a decision neither.
If that logic is not needed, delete that part and your patch is not needed.
If it is needed, then your patch looks ok.
Comment 6 Cosimo Cecchi 2014-11-21 06:10:52 UTC
Review of attachment 291027 [details] [review]:

OK
Comment 7 Cosimo Cecchi 2014-11-21 06:15:16 UTC
Review of attachment 291026 [details] [review]:

I think this is a reasonable patch. That check has been there for a very long time (commit 6194a4b0) and I'd rather leave it in.
Comment 8 Debarshi Ray 2014-11-21 13:12:01 UTC
Thanks for taking a look, Cosimo.