schilytools star has the ability to restore ctimes from tarfiles. This
is useful when restoring filesystems as root in single user mode, and
I thought I'd like rsync to do the same.
I started working off the rsync-patches/atimes.diff patch but noticed
that this patch is buggy and presently does not work. (It fails to set
the atime and it fails to set the mtime too). Even if this is fixed
that patch does not provide for setting nanosecond times.
The way nanosecond mtimes are presently handled is clunky and I am
looking for advice on how to proceed:
- would one want to use the st_ctim, st_atim st_mtim - struct timespec
structures in struct stat - when available.
If the code to handle nanosecond times for mtime is cleaned up it
could be reused consistently for the ctime and atimes and [1] in
patches
It would be possible to produce a new patch which incorporated new
options atimes (-U --atimes) and (-W --ctimes) - with the caveat that
-W has to be run as root and messes with the system clock, and maybe
support --ctimes --atimes only st_ctim, etc. is available)
If anyone has already done this work or thought about it (or can point
to another project which has done this) I'd be glad for advice.
[1] and possibly birthtimes (by setting the clock before a creat but
that is too ugly even for me to contemplate)