Bug 6672 - transfer & set nano-second times on files
transfer & set nano-second times on files
Product: rsync
Classification: Unclassified
Component: core
Other All
: P3 enhancement
: ---
Assigned To: Wayne Davison
Rsync QA Contact
Depends on:
  Show dependency treegraph
Reported: 2009-08-29 07:46 UTC by Antonio Dell'Elce
Modified: 2014-08-04 08:24 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Antonio Dell'Elce 2009-08-29 07:46:25 UTC
tv_nsec field in stat structure is not used (source code I checked does not refer to it) if available. 

This results in files being not "completely" aligned because the original file
will have  nanoseconds set all other destinations have this portion of file information set to 0.

A pratical example of when this might become a problem is Apache's ETag 
generation, Apache HTTPD correctly reads tv_nsec when available (Solaris,Cygwin
have that feature for example) and puts the value of tv_nsec in the ETag.

A cluster of Etag-generating httpds behind a load balancer would generate all
the same ETag but the "master" source which would have an ETag with no 
microseconds (ETags are limited to microseconds..) so defeating the ETag purpose.
Comment 1 Wayne Davison 2009-09-07 16:21:14 UTC
The latest git repository has support for nanosecond timestamp values.  The values are transferred as part of the file-list (when both sides are speaking the most recent (dev-version) protocol 31), and the receiver will attempt to set it.  Probably only works on Linux at the moment.

Things to enhance:

 * Figure out if there are other nanosecond setting functions that should be supported besides utimensat().
 * Figure out a good heuristic for allowing the nanoseconds to be compared (when determining if a file is up-to-date) without getting tripped up by those filesystems that round/truncate time values.

The current code leaves the quick-check algorithm unchanged, as it only checks the file's size, and the seconds portion of the modtime.
Comment 2 Teodor Milkov 2014-08-04 08:24:25 UTC
Maybe the easiest fix here would be, to extend cmp_time() in util.c to receive two more parameters: file1_st_mtimensec and file2_st_mtimensec? I guess this is not going to be portable...