Hi, below you find a patch fixing a bug in the file comparison code: The current code skips the unchanged_file() check when that check succeeded for an earlier candidate, which could lead to accepting a file with a different checksum as unchanged, for example.
Please be aware that the patch is untested. Florian diff --git a/generator.c b/generator.c index a112da6..2df1b28 100644 --- a/generator.c +++ b/generator.c @@ -876,26 +876,22 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx, pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); if (link_stat(cmpbuf, &sxp->st, 0) < 0 || !S_ISREG(sxp->st.st_mode)) continue; - switch (match_level) { - case 0: + if (match_level < 1) { best_match = j; match_level = 1; - /* FALL THROUGH */ - case 1: - if (!unchanged_file(cmpbuf, file, &sxp->st)) - continue; + } + if (!unchanged_file(cmpbuf, file, &sxp->st)) + continue; + if (match_level < 2) { best_match = j; match_level = 2; - /* FALL THROUGH */ - case 2: - if (!unchanged_attrs(cmpbuf, file, sxp)) { - free_stat_x(sxp); - continue; - } - best_match = j; - match_level = 3; - break; } + if (!unchanged_attrs(cmpbuf, file, sxp)) { + free_stat_x(sxp); + continue; + } + best_match = j; + match_level = 3; break; } while (basis_dir[++j] != NULL); -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html