gvfs should set file attributes properly
Submitted by Alexandre Rostovtsev
Assigned to gvf..@..e.bugs
Link to original bug (#527339)
Description
Currently, gvfs doesn't seem to have much support for setting file attributes. Grepping through the code, the only backend that implements try_set_attribute() is sftp, and it only allows you to set UNIX_MODE.
Without the ability to set attributes on all writeable backends, 'gvfs-copy --preserve' is useless, and it is impossible to truly fix bug 515777.
However, adding attribute writing is more complex than just implementing try_set_attribute(). For example, the sftp protocol does not allow you to set atime and mtime independently: both must be set in a single command. As a result, you are trying to set all file attributes once, the obvious implementation of try_set_attribute() will result in race conditions.
I think the solution is to instead create a try_set_attributes_from_info() (and corresponding g_daemon_set_attributes_from_info()) mechanism. Not only will it enable a race-free file-attribute setting, it will also decrease network traffic and remove the need to wait for a reply after setting each unit of metadata.
Version: 0.2.x