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 721234 - ftp backend should set etag::value
ftp backend should set etag::value
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-12-30 11:29 UTC by Ross Lagerwall
Modified: 2014-01-23 10:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ftp: Set etag::value (1.18 KB, patch)
2013-12-30 11:31 UTC, Ross Lagerwall
committed Details | Review

Description Ross Lagerwall 2013-12-30 11:29:37 UTC
The ftp backend should set etag::value like the sftp backend does based on the modification time.
Comment 1 Ross Lagerwall 2013-12-30 11:31:47 UTC
Created attachment 265027 [details] [review]
ftp: Set etag::value

Set etag::value based on the file's modification time.
Comment 2 Ondrej Holy 2014-01-10 15:44:07 UTC
Why do we need this? I think It should be implemented etag check also into the replace method (as in smb, sftp, dav backends) to make sense.
Comment 3 Ross Lagerwall 2014-01-10 15:52:09 UTC
(In reply to comment #2)
> Why do we need this? I think It should be implemented etag check also into the
> replace method (as in smb, sftp, dav backends) to make sense.

The etag check is used when replacing a file; however, etag::value is used for GFileInfo results.

Compare the output of gvfs-info on a file with sftp and ftp; the sftp backend has a etag::value line whereas the ftp backend doesn't.

The corresponding bit of code which sets etag::value in the sftp backend is in parse_attributes():
  if (flags & SSH_FILEXFER_ATTR_ACMODTIME)
    {
      guint32 v;
      char *etag;
      
      v = g_data_input_stream_read_uint32 (reply, NULL, NULL);
      g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_ACCESS, v);
      v = g_data_input_stream_read_uint32 (reply, NULL, NULL);
      g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED, v);

      etag = g_strdup_printf ("%lu", (long unsigned int)v);
      g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_ETAG_VALUE, etag); << etag::value is set here
      g_free (etag);
    }
Comment 4 Ross Lagerwall 2014-01-10 15:53:46 UTC
Of course, the etag should also be checked when replacing a file with the ftp backend but that is a separate issue.
Comment 5 Ondrej Holy 2014-01-17 11:51:22 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Why do we need this? I think It should be implemented etag check also into the
> > replace method (as in smb, sftp, dav backends) to make sense.
> 
> The etag check is used when replacing a file; however, etag::value is used for
> GFileInfo results.

You are right, I know about. I've been looking that some editors even use it.
Comment 6 Ondrej Holy 2014-01-17 12:04:43 UTC
Review of attachment 265027 [details] [review]:

Looks good. However would be nice to add comment/warning into replace function, or file a new bug about.
Comment 7 Ross Lagerwall 2014-01-17 13:11:26 UTC
(In reply to comment #6)
> Review of attachment 265027 [details] [review]:
> 
> Looks good. However would be nice to add comment/warning into replace function,
> or file a new bug about.

Opened as bug 722412.
Comment 8 Ross Lagerwall 2014-01-23 10:14:17 UTC
Pushed to master as 947ca91. Thanks for the review!