Yep, rclone touch
works AOK and maintains the milliseconds on touch
ed 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:
syscall from rclone:
utimensat(AT_FDCWD, "/home/alienth/tmp/bar", [{tv_sec=1628501018, tv_nsec=492082171} /* 2021-08-09T01:23:38.492082171-0800 */, {tv_sec=1628501018, tv_nsec=492082171} /* 2021-08-09T01:23:38.492082171-0800 */], 0) = 0
syscall from touch
(fd 0 is our bar
file):
utimensat(0, NULL, NULL, 0) = 0
Docs from utimensat
:
If times is NULL, then both timestamps are set to the current time.
Perhaps this is a bug with ecryptfs only when using utimensat
with an explicit timestamp?
End result of all of this of course is that rclone continually wants to synchronize timestamps when using sync
against a path from an ecryptfs mount.