When using sync to a path on an ecryptfs mount, rclone does not preserve the milliseconds portion of the file timestamp. This results in rclone continually thinking that files need their modification time resynced.
Ecryptfs is capable of millisecond-resolution mod timestamps, as validated by touch:
Thanks! Command output is below. Looks like rclone touch also isn't doing the right thing - resulting file has only seconds resolution. All of the following was done in an ecryptfs-mounted directory:
Yep, rclone touch works AOK and maintains the milliseconds on touched files directly on normal filesystems. I also tested more nuanced scenarios like overlay and full timestamp resolution is maintained. So far I've only been able to reproduce this on ecryptfs.
Reviewing the syscalls, looks like rclone and touch both use the utimensat syscall. However, rclone sets the time explicitly, whereas touch passes NULL:
Interesting further diving: I tested with rsync and the resulting files it synchronizes to an ecryptfs mount also don't maintain millisecond-level resolution. However, surprisingly a subsequent rsync doesn't try to re-sync the mtime, even with the --times flag.
Turns out this is because rsync has a default modify-window of 0, which translates to integer seconds:
--modify-window=NUM, -@
When comparing two timestamps, rsync treats the timestamps as being equal if they differ by no more than the modify-window value. The default is 0, which matches just integer seconds.
As such, rsync doesn't happen to get bitten by this bad ecryptfs behaviour (when using default flags), while rclone does.