Hi again. I just spotted another peculiarity when inspecting the rsync log. When using --compare-dest, source files that have permissions that differ from the "comparables" are not logged, unless you're using -i. Here's a testing session: $ ls -lR .: total 12 drwxr-xr-x 2 vidar users 4096 2005-03-31 14:16 cmp/ drwxr-xr-x 2 vidar users 4096 2005-03-31 14:23 dst/ drwxr-xr-x 2 vidar users 4096 2005-03-31 14:16 src/ ./cmp: total 4 -rwxr-xr-x 1 vidar users 17 2005-03-31 14:16 slackware-version* ./dst: total 0 ./src: total 4 -rw-r--r-- 1 vidar users 17 2005-03-31 14:16 slackware-version Note the permissions; the cmp file has been chmodded a+x. $ rsync -av --compare-dest="../cmp" src/ dst/ building file list ... done ./ sent 115 bytes received 32 bytes 294.00 bytes/sec total size is 17 speedup is 0.12 $ ls -l dst total 4 -rw-r--r-- 1 vidar users 17 2005-03-31 14:16 slackware-version So the file was copied despite not being listed $ rm dst/slackware-version $ rsync -avi --compare-dest="../cmp" src/ dst/ building file list ... done .d..t.... ./ .f...p... slackware-version sent 115 bytes received 32 bytes 294.00 bytes/sec total size is 17 speedup is 0.12 $ The same behaviour can be seen when using --log-format instead of -v; if there's an "%i" present, everything is logged correctly, but without, files with different permissions are silently left out. Vidar
On Thu, Mar 31, 2005 at 02:34:14PM +0200, Vidar Madsen wrote:> I just spotted another peculiarity when inspecting the rsync log. When > using --compare-dest, source files that have permissions that differ > from the "comparables" are not logged, unless you're using -i.Yes, rsync has historically not reported files that are the same except for their attributes (permissions, group, owner) unless you use two -v options or (in 2.6.4) a log-format with %i (e.g. using the -i option). However, --compare-dest does complicate this, since the identical file can be in the --compare-dest dir, and not in the actual destination dir. Earlier in the development cycle, I noticed that rsync was not updating a file that differed in attributes when using --compare-dest, so I decided to fix that for 2.6.4. However, since the file is not actually transferred (it is copied locally), it can be deceptive that the name is not output with only one -v. The way it currently works is that rsync outputs just what it would have output if the destination were a merging of the --compare-dest files with the destination files. ..wayne..
On Thu, Mar 31, 2005 at 02:34:14PM +0200, Vidar Madsen wrote:> I just spotted another peculiarity when inspecting the rsync log. When > using --compare-dest, source files that have permissions that differ > from the "comparables" are not logged, unless you're using -i.I think I have a better heuristic for this case. Attached is a patch that makes rsync itemize the copy as a "local change" (so the leading 'c' will get set) and output the name of the locally-copied file if itemized-output is not enabled. ..wayne.. -------------- next part -------------- --- generator.c 31 Mar 2005 23:30:03 -0000 1.195 +++ generator.c 1 Apr 2005 18:10:27 -0000 @@ -923,8 +923,25 @@ static void recv_generator(char *fname, } match_level = 0; statret = -1; - } else - set_perms(fname, file, NULL, 0); + } else { + if (itemizing) { + itemize(file, ndx, 0, &st, + ITEM_LOCAL_CHANGE, 0, + NULL); + } else if (verbose && code) { + rprintf(code, "%s\n", + safe_fname(fname)); + } + set_perms(fname, file, NULL, + maybe_PERMS_REPORT); + if (preserve_hard_links + && file->link_u.links) { + hard_link_cluster(file, ndx, + itemizing, + code); + } + return; + } } else if (compare_dest || match_level == 1) { fnamecmp = fnamecmpbuf; fnamecmp_type = i;