On a PPC machine running Mac OS X, I noticed that creation time is not preserved for files that are transferred (i.e. versus files that are not transferred, or files that have only attribute changes). I discovered two things that work together to cause this: 1) cmp_time (util.c) doesn't check for negative values provided in file1 or file2. If file2 is positive, and file1 is negative, and absolute_value(file1) > file2, cmp_time returns 0, even though the times are obviously different. Of course, a file's crtime should never be negative, which leads me to #2. 2) set_file_attrs (rsync.c) doesn't initialize sx2.crtime (e.g. when the sxp argument is NULL). This leads to crtime values that are occasionally > 2^31, resulting in negative crtimes. The attached patch resolves these. Mike -------------- next part -------------- A non-text attachment was scrubbed... Name: crtimes_ppc.patch Type: application/octet-stream Size: 704 bytes Desc: not available Url : http://lists.samba.org/archive/rsync/attachments/20080929/27b16716/crtimes_ppc.obj -------------- next part --------------
On Mon, Sep 29, 2008 at 09:49:26AM -0500, Mike Bombich wrote:> 1) cmp_time (util.c) doesn't check for negative values provided in file1 or > file2. If file2 is positive, and file1 is negative, and > absolute_value(file1) > file2, cmp_time returns 0, even though the times > are obviously different.Yeah, that's a subtle one. I've changed it in a little simpler way: reordering the args in the ifs so that an underflow can't trigger a spurious successful test. Patch attached.> 2) set_file_attrs (rsync.c) doesn't initialize sx2.crtime (e.g. when the > sxp argument is NULL).Thanks! I've applied that change to the crtimes diff. ..wayne.. -------------- next part -------------- A non-text attachment was scrubbed... Name: cmp_time.diff Type: text/x-diff Size: 350 bytes Desc: not available Url : http://lists.samba.org/archive/rsync/attachments/20080929/e9a8e903/cmp_time.bin
Possibly Parallel Threads
- [Bug 13522] New: Patch fileflags.diff and crtimes.diff
- Bug with crtimes and hard links?
- DO NOT REPLY [Bug 6276] crtimes.patch does not preserve creation dates on Mac x86_64 only
- DO NOT REPLY [Bug 7685] New: rsync should not set the creation data on the root folder of an HFS+ volume
- [Bug 10643] New: cmp_time() returns incorrect result due to integer overflow