fn copy_file(from: &Path, to: &Path) -> Result<()>Expand description
Copy one file’s bytes, giving the destination a current modification time.
Deliberately not fs::copy. On macOS that is fcopyfile(COPYFILE_ALL),
which carries the source’s mtime across to the copy — so a restore lands
a two-month-old stamp on bytes written seconds ago. Retention keys on the
max_ts in the directory name, so nothing here changes either way; what
changes is every reader outside this process that treats (len, mtime) as
a path’s identity, because a restore is precisely the case where a path’s
contents change. Writing the bytes rather than cloning the file makes the
timestamp current as a consequence of the write, with no call anyone has to
remember. offload_restore_stamps_current_mtime fails if this becomes
fs::copy.