On Nov 10, 2006, at 9:28 PM, Wayne Davison wrote:
On Fri, Nov 10, 2006 at 04:18:51PM +0100, Wesley W. Terpstra wrote:
However, if you sync a file that is identical in all respects except
the resource fork (xattrs), then the mtime is wrong for the first
run, but not the second (peanut->peanut2).
I would imagine that is because rsync didn't call stat() on the
file, so
it doesn't know that the mtime changed.
Ahh, of course. It did the stat before the setxattr, so didn't think
the mtime needed updating, because it was correct already/before.
We might want the set_xattr()
function to restore the file's mtime (from file->modtime) when it
thinks
that the mtime of the file was affected.
On osx the mtime only seems to get updated if you set things in
com.apple.*, AFAICT.
However, that's not to say there might not be more!
I just checked on FreeBSD, and it resets the mtime on EVERY attribute
change:
[EMAIL PROTECTED] ~/rsync-cvs/rsync -a peanut peanut2
[EMAIL PROTECTED] stat peanut*
1042 4249 -rw-r--r-- 1 terpstra users 0 0 "Nov 11 07:29:14 2006"
"Nov 11 07:28:29 2006" "Nov 11 07:28:51 2006" "Nov 11 07:28:29
2006" 16384 0 0 peanut
1042 4251 -rw-r--r-- 1 terpstra users 0 0 "Nov 11 07:29:40 2006"
"Nov 11 07:28:29 2006" "Nov 11 07:29:40 2006" "Nov 11 07:28:29
2006" 16384 0 0 peanut2
[EMAIL PROTECTED] setextattr user test value peanut2
[EMAIL PROTECTED] stat peanut*
1042 4249 -rw-r--r-- 1 terpstra users 0 0 "Nov 11 07:29:14 2006"
"Nov 11 07:28:29 2006" "Nov 11 07:28:51 2006" "Nov 11 07:28:29
2006" 16384 0 0 peanut
1042 4251 -rw-r--r-- 1 terpstra users 0 0 "Nov 11 07:29:40 2006"
"Nov 11 07:29:58 2006" "Nov 11 07:29:58 2006" "Nov 11 07:28:29
2006" 16384 4 0 peanut2
So, perhaps the sensible thing to do is just assume that the mtime is
changed if you call set_xattr at all?
Or have the set_xattr()
function change the value of the sxp->st.st_mtime variable, and
have the
regular mtime-setting code come after the xattr-setting code.
That makes the most sense to me, as long as there are no side-effects
to putting the mtime code later.
--
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html