Matt McCutchen
2007-Oct-30 21:20 UTC
Rsync hard-links devices with different mtimes despite -t: expected?
I noticed that rsync is happy to hard-link a device node from a --link-dest dir even if its mtime differs from that of the source device node and --times is given. Is this behavior expected? It seems to break the rule that a difference in preserved attributes disqualifies a hard link. To see the behavior, run the following as root: mkdir src dest basis mknod src/null c 1 3 sleep 1 mknod basis/null c 1 3 rsync -a -ii --link-dest=../basis/ src/ dest/ find . -ls stat src/null dest/null Rsync produces the following very bogus-looking itemize output: .d ./ hD..t...... null Matt
Matt McCutchen
2007-Nov-03 19:46 UTC
Rsync hard-links devices with different mtimes despite -t: expected?
On Tue, 2007-10-30 at 17:20 -0400, Matt McCutchen wrote:> I noticed that rsync is happy to hard-link a device node from a > --link-dest dir even if its mtime differs from that of the source device > node and --times is given. Is this behavior expected? It seems to > break the rule that a difference in preserved attributes disqualifies a > hard link.The same strange behavior happens for regular files if --size-only is passed. The underlying issue is that unchanged_attrs compares all preserved attributes except mtimes. Why are mtimes omitted? Matt
Wayne Davison
2007-Nov-03 21:19 UTC
Rsync hard-links devices with different mtimes despite -t: expected?
On Tue, Oct 30, 2007 at 05:20:30PM -0400, Matt McCutchen wrote:> I noticed that rsync is happy to hard-link a device node from a > --link-dest dir even if its mtime differs from that of the source > device node and --times is given. Is this behavior expected?Not really. It doesn't hurt anything with devices, but we should obey the general rule only linking things don't differ in attributes that we are preserving. The code in unchanged_attrs() was expecting that the mtime would have been compared in the unchanged_file() routine, but that assumption is not true for some of the code paths that ended up using the routine. The latest CVS makes unchanged_attrs() ensure that the mtime is the same. ..wayne..
Matt McCutchen
2007-Nov-04 17:09 UTC
Rsync hard-links devices with different mtimes despite -t: expected?
On Sat, 2007-11-03 at 14:19 -0700, Wayne Davison wrote:> The latest CVS makes unchanged_attrs() ensure that the mtime is the > same.Good. Now the mtime check in try_dests_reg at generator.c:906 is redundant; I suggest that you remove it. Matt
Possibly Parallel Threads
- [Bug 12036] New: Multiple --link-dest, --copy-dest, or --compare-dest flags produce incorrect behavior
- Rsync itemizing "p" even when -p, -E are off
- DO NOT REPLY [Bug 5644] New: Option to recheck basis dirs for existing dest files
- DO NOT REPLY [Bug 7618] New: symlinks and --link-dest
- [PATCH] Bug fix for file comparison