From 7b80cd0ec6fe3a0c515dbf121f7153eb11afccee Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 9 Dec 2006 02:03:39 +0000 Subject: [PATCH] Fixed failing hunks. --- acls.diff | 446 +++++++++++++++++++++++--------------------- detect-renamed.diff | 47 ++--- early-checksum.diff | 58 +++--- 3 files changed, 286 insertions(+), 265 deletions(-) diff --git a/acls.diff b/acls.diff index b237aba..f1ea47d 100644 --- a/acls.diff +++ b/acls.diff @@ -1324,7 +1324,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. extern int preserve_links; extern int preserve_hard_links; extern int preserve_devices; -@@ -144,6 +145,8 @@ static void list_file_entry(struct file_ +@@ -147,6 +148,8 @@ static void list_file_entry(struct file_ permstring(permbuf, f->mode); len = F_LENGTH(f); @@ -1333,7 +1333,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. #ifdef SUPPORT_LINKS if (preserve_links && S_ISLNK(f->mode)) { rprintf(FINFO, "%s %11.0f %s %s -> %s\n", -@@ -621,6 +624,12 @@ static struct file_struct *recv_file_ent +@@ -624,6 +627,12 @@ static struct file_struct *recv_file_ent } #endif @@ -1346,7 +1346,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (always_checksum && S_ISREG(mode)) extra_len += SUM_EXTRA_CNT * EXTRA_LEN; -@@ -733,6 +742,11 @@ static struct file_struct *recv_file_ent +@@ -736,6 +745,11 @@ static struct file_struct *recv_file_ent read_buf(f, bp, checksum_len); } @@ -1358,7 +1358,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. return file; } -@@ -993,6 +1007,9 @@ static struct file_struct *send_file_nam +@@ -996,6 +1010,9 @@ static struct file_struct *send_file_nam unsigned short flags) { struct file_struct *file; @@ -1368,7 +1368,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. file = make_file(fname, flist, stp, flags, f == -2 ? SERVER_FILTERS : ALL_FILTERS); -@@ -1002,11 +1019,24 @@ static struct file_struct *send_file_nam +@@ -1005,11 +1022,24 @@ static struct file_struct *send_file_nam if (chmod_modes && !S_ISLNK(file->mode)) file->mode = tweak_mode(file->mode, chmod_modes); @@ -1411,7 +1411,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. extern char *backup_dir; extern char *backup_suffix; extern int backup_suffix_len; -@@ -517,22 +519,27 @@ static void do_delete_pass(struct file_l +@@ -518,22 +520,27 @@ static void do_delete_pass(struct file_l rprintf(FINFO, " \r"); } @@ -1444,7 +1444,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. int32 iflags, uchar fnamecmp_type, const char *xname) { if (statret >= 0) { /* A from-dest-dir statret can == 1! */ -@@ -540,20 +547,24 @@ void itemize(struct file_struct *file, i +@@ -541,20 +548,24 @@ void itemize(struct file_struct *file, i : S_ISDIR(file->mode) ? !omit_dir_times : !S_ISLNK(file->mode); @@ -1474,16 +1474,16 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } else iflags |= ITEM_IS_NEW; -@@ -807,7 +818,7 @@ void check_for_finished_hlinks(int itemi +@@ -809,7 +820,7 @@ void check_for_finished_hlinks(int itemi * handling the file, -1 if no dest-linking occurred, or a non-negative * value if we found an alternate basis file. */ static int try_dests_reg(struct file_struct *file, char *fname, int ndx, - char *cmpbuf, STRUCT_STAT *stp, int itemizing, + char *cmpbuf, statx *sxp, int itemizing, - int maybe_ATTRS_REPORT, enum logcode code) + enum logcode code) { int best_match = -1; -@@ -816,7 +827,7 @@ static int try_dests_reg(struct file_str +@@ -818,7 +829,7 @@ static int try_dests_reg(struct file_str do { pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); @@ -1492,7 +1492,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. continue; switch (match_level) { case 0: -@@ -824,16 +835,20 @@ static int try_dests_reg(struct file_str +@@ -826,16 +837,20 @@ static int try_dests_reg(struct file_str match_level = 1; /* FALL THROUGH */ case 1: @@ -1516,7 +1516,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. continue; best_match = j; match_level = 3; -@@ -848,7 +863,7 @@ static int try_dests_reg(struct file_str +@@ -850,7 +865,7 @@ static int try_dests_reg(struct file_str if (j != best_match) { j = best_match; pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); @@ -1525,16 +1525,22 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. return -1; } -@@ -856,15 +871,20 @@ static int try_dests_reg(struct file_str - #ifdef SUPPORT_HARD_LINKS - if (link_dest) { - int i = itemizing && (verbose > 1 || stdout_format_has_i > 1); -- if (hard_link_one(file, ndx, fname, 0, stp, -+ if (hard_link_one(file, ndx, fname, 0, sxp, - cmpbuf, 1, i, code) < 0) +@@ -860,16 +875,25 @@ static int try_dests_reg(struct file_str + if (!hard_link_one(file, fname, cmpbuf, 1)) goto try_a_copy; if (preserve_hard_links && F_IS_HLINKED(file)) - hard_link_cluster(file, ndx, itemizing, code, j); +- finish_hard_link(file, fname, stp, itemizing, code, j); ++ finish_hard_link(file, fname, &sxp->st, itemizing, code, j); + if (itemizing && (verbose > 1 || stdout_format_has_i > 1)) { +- itemize(file, ndx, 1, stp, ++#ifdef SUPPORT_ACLS ++ if (preserve_acls && !ACL_READY(*sxp)) ++ get_acl(fname, sxp); ++#endif ++ itemize(file, ndx, 1, sxp, + ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, + 0, ""); + } } else #endif - if (itemizing) @@ -1546,10 +1552,10 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. +#endif + itemize(file, ndx, 0, sxp, 0, 0, NULL); + } - if (verbose > 1 && maybe_ATTRS_REPORT) { + if (verbose > 1 && maybe_ATTRS_REPORT) rprintf(FCLIENT, "%s is uptodate\n", fname); - } -@@ -880,8 +900,13 @@ static int try_dests_reg(struct file_str + return -2; +@@ -886,8 +910,13 @@ static int try_dests_reg(struct file_str } return -1; } @@ -1565,16 +1571,25 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. set_file_attrs(fname, file, NULL, 0); if (maybe_ATTRS_REPORT && ((!itemizing && verbose && match_level == 2) -@@ -904,7 +929,7 @@ static int try_dests_reg(struct file_str +@@ -898,7 +927,7 @@ static int try_dests_reg(struct file_str + } + #ifdef SUPPORT_HARD_LINKS + if (preserve_hard_links && F_IS_HLINKED(file)) +- finish_hard_link(file, fname, stp, itemizing, code, -1); ++ finish_hard_link(file, fname, &sxp->st, itemizing, code, -1); + #endif + return -2; + } +@@ -910,7 +939,7 @@ static int try_dests_reg(struct file_str * handling the file, or -1 if no dest-linking occurred, or a non-negative * value if we found an alternate basis file. */ static int try_dests_non(struct file_struct *file, char *fname, int ndx, - char *cmpbuf, STRUCT_STAT *stp, int itemizing, + char *cmpbuf, statx *sxp, int itemizing, - int maybe_ATTRS_REPORT, enum logcode code) + enum logcode code) { char lnk[MAXPATHLEN]; -@@ -937,24 +962,24 @@ static int try_dests_non(struct file_str +@@ -943,24 +972,24 @@ static int try_dests_non(struct file_str do { pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); @@ -1604,7 +1619,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. continue; break; #endif -@@ -969,7 +994,7 @@ static int try_dests_non(struct file_str +@@ -975,7 +1004,7 @@ static int try_dests_non(struct file_str case TYPE_SPECIAL: case TYPE_DEVICE: devp = F_RDEV_P(file); @@ -1613,7 +1628,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. continue; break; #ifdef SUPPORT_LINKS -@@ -986,7 +1011,11 @@ static int try_dests_non(struct file_str +@@ -992,7 +1021,11 @@ static int try_dests_non(struct file_str match_level = 2; best_match = j; } @@ -1626,7 +1641,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. match_level = 3; best_match = j; break; -@@ -999,7 +1028,7 @@ static int try_dests_non(struct file_str +@@ -1005,7 +1038,7 @@ static int try_dests_non(struct file_str if (j != best_match) { j = best_match; pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); @@ -1635,7 +1650,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. return -1; } -@@ -1030,7 +1059,15 @@ static int try_dests_non(struct file_str +@@ -1036,7 +1069,15 @@ static int try_dests_non(struct file_str : ITEM_LOCAL_CHANGE + (match_level == 3 ? ITEM_XNAME_FOLLOWS : 0); char *lp = match_level == 3 ? "" : NULL; @@ -1652,7 +1667,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if (verbose > 1 && maybe_ATTRS_REPORT) { rprintf(FCLIENT, "%s%s is uptodate\n", -@@ -1043,6 +1080,7 @@ static int try_dests_non(struct file_str +@@ -1049,6 +1090,7 @@ static int try_dests_non(struct file_str } static int phase = 0; @@ -1660,7 +1675,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. /* Acts on the_file_list->file's ndx'th item, whose name is fname. If a dir, * make sure it exists, and has the right permissions/timestamp info. For -@@ -1064,7 +1102,8 @@ static void recv_generator(char *fname, +@@ -1069,7 +1111,8 @@ static void recv_generator(char *fname, static int need_fuzzy_dirlist = 0; struct file_struct *fuzzy_file = NULL; int fd = -1, f_copy = -1; @@ -1670,7 +1685,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. struct file_struct *back_file = NULL; int statret, real_ret, stat_errno; char *fnamecmp, *partialptr, *backupptr = NULL; -@@ -1120,6 +1159,9 @@ static void recv_generator(char *fname, +@@ -1125,6 +1168,9 @@ static void recv_generator(char *fname, } else if (!dry_run) return; } @@ -1680,7 +1695,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (dry_run > 1) { statret = -1; stat_errno = ENOENT; -@@ -1127,7 +1169,7 @@ static void recv_generator(char *fname, +@@ -1132,7 +1178,7 @@ static void recv_generator(char *fname, const char *dn = file->dirname ? file->dirname : "."; if (parent_dirname != dn && strcmp(parent_dirname, dn) != 0) { if (relative_paths && !implied_dirs @@ -1689,7 +1704,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. && create_directory_path(fname) < 0) { rsyserr(FERROR, errno, "recv_generator: mkdir %s failed", -@@ -1139,6 +1181,10 @@ static void recv_generator(char *fname, +@@ -1144,6 +1190,10 @@ static void recv_generator(char *fname, } if (fuzzy_basis) need_fuzzy_dirlist = 1; @@ -1700,7 +1715,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } parent_dirname = dn; -@@ -1148,7 +1194,7 @@ static void recv_generator(char *fname, +@@ -1153,7 +1203,7 @@ static void recv_generator(char *fname, need_fuzzy_dirlist = 0; } @@ -1709,7 +1724,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. keep_dirlinks && S_ISDIR(file->mode)); stat_errno = errno; } -@@ -1166,8 +1212,9 @@ static void recv_generator(char *fname, +@@ -1171,8 +1221,9 @@ static void recv_generator(char *fname, * mode based on the local permissions and some heuristics. */ if (!preserve_perms) { int exists = statret == 0 @@ -1721,7 +1736,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if (S_ISDIR(file->mode)) { -@@ -1176,8 +1223,8 @@ static void recv_generator(char *fname, +@@ -1181,8 +1232,8 @@ static void recv_generator(char *fname, * file of that name and it is *not* a directory, then * we need to delete it. If it doesn't exist, then * (perhaps recursively) create it. */ @@ -1732,7 +1747,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. return; statret = -1; } -@@ -1186,14 +1233,14 @@ static void recv_generator(char *fname, +@@ -1191,14 +1242,14 @@ static void recv_generator(char *fname, dry_run++; } real_ret = statret; @@ -1746,10 +1761,10 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (statret != 0 && basis_dir[0] != NULL) { - int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st, + int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx, - itemizing, maybe_ATTRS_REPORT, code); + itemizing, code); if (j == -2) { itemizing = 0; -@@ -1202,7 +1249,11 @@ static void recv_generator(char *fname, +@@ -1207,7 +1258,11 @@ static void recv_generator(char *fname, statret = 1; } if (itemizing && f_out != -1) { @@ -1762,7 +1777,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL); } if (real_ret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) { -@@ -1222,22 +1273,22 @@ static void recv_generator(char *fname, +@@ -1227,21 +1282,21 @@ static void recv_generator(char *fname, return; } } @@ -1782,16 +1797,15 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_IS_HLINKED(file) -- && hard_link_check(file, ndx, fname, statret, &st, -+ && hard_link_check(file, ndx, fname, statret, &sx, - itemizing, code, HL_CHECK_MASTER)) + if (preserve_hard_links && F_NOT_HLINK_FIRST(file) +- && hard_link_check(file, ndx, fname, statret, &st, itemizing, code)) - return; ++ && hard_link_check(file, ndx, fname, statret, &sx, itemizing, code)) + goto cleanup; #endif if (preserve_links && S_ISLNK(file->mode)) { -@@ -1257,14 +1308,14 @@ static void recv_generator(char *fname, +@@ -1261,17 +1316,17 @@ static void recv_generator(char *fname, char lnk[MAXPATHLEN]; int len; @@ -1808,8 +1822,12 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. + set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT); #ifdef SUPPORT_HARD_LINKS if (preserve_hard_links && F_IS_HLINKED(file)) - hard_link_cluster(file, ndx, itemizing, code, -1); -@@ -1275,10 +1326,10 @@ static void recv_generator(char *fname, +- finish_hard_link(file, fname, &st, itemizing, code, -1); ++ finish_hard_link(file, fname, &sx.st, itemizing, code, -1); + #endif + if (remove_source_files == 1) + goto return_with_success; +@@ -1279,10 +1334,10 @@ static void recv_generator(char *fname, } /* Not the right symlink (or not a symlink), so * delete it. */ @@ -1819,19 +1837,10 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } else if (basis_dir[0] != NULL) { - int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st, + int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx, - itemizing, maybe_ATTRS_REPORT, code); + itemizing, code); if (j == -2) { #ifndef CAN_HARDLINK_SYMLINK -@@ -1295,7 +1346,7 @@ static void recv_generator(char *fname, - } - #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_IS_HLINKED(file) -- && hard_link_check(file, ndx, fname, -1, &st, -+ && hard_link_check(file, ndx, fname, -1, &sx, - itemizing, code, HL_SKIP)) - return; - #endif -@@ -1305,7 +1356,7 @@ static void recv_generator(char *fname, +@@ -1307,7 +1362,7 @@ static void recv_generator(char *fname, } else { set_file_attrs(fname, file, NULL, 0); if (itemizing) { @@ -1840,7 +1849,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. ITEM_LOCAL_CHANGE, 0, NULL); } if (code != FNONE && verbose) -@@ -1331,33 +1382,38 @@ static void recv_generator(char *fname, +@@ -1333,33 +1388,38 @@ static void recv_generator(char *fname, if (statret == 0) { char *t; if (IS_DEVICE(file->mode)) { @@ -1873,7 +1882,8 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. + set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT); #ifdef SUPPORT_HARD_LINKS if (preserve_hard_links && F_IS_HLINKED(file)) - hard_link_cluster(file, ndx, itemizing, code, -1); +- finish_hard_link(file, fname, &st, itemizing, code, -1); ++ finish_hard_link(file, fname, &sx.st, itemizing, code, -1); #endif if (remove_source_files == 1) goto return_with_success; @@ -1886,19 +1896,10 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } else if (basis_dir[0] != NULL) { - int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st, + int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx, - itemizing, maybe_ATTRS_REPORT, code); + itemizing, code); if (j == -2) { #ifndef CAN_HARDLINK_SPECIAL -@@ -1374,7 +1430,7 @@ static void recv_generator(char *fname, - } - #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_IS_HLINKED(file) -- && hard_link_check(file, ndx, fname, -1, &st, -+ && hard_link_check(file, ndx, fname, -1, &sx, - itemizing, code, HL_SKIP)) - return; - #endif -@@ -1389,7 +1445,11 @@ static void recv_generator(char *fname, +@@ -1389,7 +1449,11 @@ static void recv_generator(char *fname, } else { set_file_attrs(fname, file, NULL, 0); if (itemizing) { @@ -1911,7 +1912,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. ITEM_LOCAL_CHANGE, 0, NULL); } if (code != FNONE && verbose) -@@ -1401,7 +1461,7 @@ static void recv_generator(char *fname, +@@ -1401,7 +1465,7 @@ static void recv_generator(char *fname, if (remove_source_files == 1) goto return_with_success; } @@ -1920,7 +1921,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if (!S_ISREG(file->mode)) { -@@ -1435,7 +1495,7 @@ static void recv_generator(char *fname, +@@ -1435,7 +1499,7 @@ static void recv_generator(char *fname, } if (update_only && statret == 0 @@ -1929,7 +1930,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (verbose > 1) rprintf(FINFO, "%s is newer\n", fname); return; -@@ -1444,20 +1504,20 @@ static void recv_generator(char *fname, +@@ -1444,20 +1508,20 @@ static void recv_generator(char *fname, fnamecmp = fname; fnamecmp_type = FNAMECMP_FNAME; @@ -1945,7 +1946,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (statret != 0 && basis_dir[0] != NULL) { - int j = try_dests_reg(file, fname, ndx, fnamecmpbuf, &st, + int j = try_dests_reg(file, fname, ndx, fnamecmpbuf, &sx, - itemizing, maybe_ATTRS_REPORT, code); + itemizing, code); if (j == -2) { if (remove_source_files == 1) goto return_with_success; @@ -1954,7 +1955,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if (j >= 0) { fnamecmp = fnamecmpbuf; -@@ -1467,7 +1527,7 @@ static void recv_generator(char *fname, +@@ -1467,7 +1531,7 @@ static void recv_generator(char *fname, } real_ret = statret; @@ -1963,7 +1964,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (partial_dir && (partialptr = partial_dir_fname(fname)) != NULL && link_stat(partialptr, &partial_st, 0) == 0 -@@ -1486,7 +1546,7 @@ static void recv_generator(char *fname, +@@ -1486,7 +1550,7 @@ static void recv_generator(char *fname, rprintf(FINFO, "fuzzy basis selected for %s: %s\n", fname, fnamecmpbuf); } @@ -1972,16 +1973,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. statret = 0; fnamecmp = fnamecmpbuf; fnamecmp_type = FNAMECMP_FUZZY; -@@ -1496,7 +1556,7 @@ static void recv_generator(char *fname, - if (statret != 0) { - #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_IS_HLINKED(file) -- && hard_link_check(file, ndx, fname, statret, &st, -+ && hard_link_check(file, ndx, fname, statret, &sx, - itemizing, code, HL_SKIP)) - return; - #endif -@@ -1507,38 +1567,51 @@ static void recv_generator(char *fname, +@@ -1505,38 +1569,52 @@ static void recv_generator(char *fname, return; } @@ -2000,28 +1992,30 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. handle_partial_dir(partialptr, PDIR_DELETE); } if (itemizing) { -- itemize(file, ndx, real_ret, &real_st, +- itemize(file, ndx, statret, &st, +#ifdef SUPPORT_ACLS -+ if (preserve_acls && real_ret == 0) -+ get_acl(fnamecmp, &real_sx); ++ if (preserve_acls && statret == 0) ++ get_acl(fnamecmp, &sx); +#endif -+ itemize(file, ndx, real_ret, &real_sx, ++ itemize(file, ndx, statret, &sx, 0, 0, NULL); +#ifdef SUPPORT_ACLS -+ if (preserve_acls) { -+ if (fnamecmp_type == FNAMECMP_FNAME) { -+ sx.acc_acl = real_sx.acc_acl; -+ sx.def_acl = real_sx.def_acl; -+ } else -+ free_acl(&real_sx); -+ } ++ //if (preserve_acls) { ++ //if (fnamecmp_type == FNAMECMP_FNAME) { ++ //sx.acc_acl = real_sx.acc_acl; ++ //sx.def_acl = real_sx.def_acl; ++ //} else ++ //free_acl(&real_sx); ++ //} ++ assert(fnamecmp_type == FNAMECMP_FNAME); +#endif } - set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT); + set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT); #ifdef SUPPORT_HARD_LINKS if (preserve_hard_links && F_IS_HLINKED(file)) - hard_link_cluster(file, ndx, itemizing, code, -1); +- finish_hard_link(file, fname, &st, itemizing, code, -1); ++ finish_hard_link(file, fname, &sx.st, itemizing, code, -1); #endif if (remove_source_files != 1) - return; @@ -2040,13 +2034,10 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. fnamecmp = partialptr; fnamecmp_type = FNAMECMP_PARTIAL_DIR; statret = 0; -@@ -1563,18 +1636,22 @@ static void recv_generator(char *fname, +@@ -1561,16 +1639,20 @@ static void recv_generator(char *fname, /* pretend the file didn't exist */ #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links && F_IS_HLINKED(file) -- && hard_link_check(file, ndx, fname, statret, &st, -+ && hard_link_check(file, ndx, fname, statret, &sx, - itemizing, code, HL_SKIP)) + if (preserve_hard_links && F_NOT_HLINK_LAST(file)) - return; + goto cleanup; #endif @@ -2066,7 +2057,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) { close(fd); -@@ -1585,7 +1662,7 @@ static void recv_generator(char *fname, +@@ -1581,7 +1663,7 @@ static void recv_generator(char *fname, full_fname(backupptr)); unmake_file(back_file); close(fd); @@ -2075,7 +2066,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if ((f_copy = do_open(backupptr, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0) { -@@ -1593,14 +1670,14 @@ static void recv_generator(char *fname, +@@ -1589,14 +1671,14 @@ static void recv_generator(char *fname, full_fname(backupptr)); unmake_file(back_file); close(fd); @@ -2092,7 +2083,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if (verbose > 2) -@@ -1618,8 +1695,16 @@ static void recv_generator(char *fname, +@@ -1618,26 +1700,34 @@ static void recv_generator(char *fname, iflags |= ITEM_BASIS_TYPE_FOLLOWS; if (fnamecmp_type == FNAMECMP_FUZZY) iflags |= ITEM_XNAME_FOLLOWS; @@ -2110,9 +2101,10 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if (!do_xfers) { -@@ -1627,17 +1712,17 @@ static void recv_generator(char *fname, + #ifdef SUPPORT_HARD_LINKS if (preserve_hard_links && F_IS_HLINKED(file)) - hard_link_cluster(file, ndx, itemizing, code, -1); +- finish_hard_link(file, fname, &st, itemizing, code, -1); ++ finish_hard_link(file, fname, &sx.st, itemizing, code, -1); #endif - return; + goto cleanup; @@ -2132,7 +2124,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (f_copy >= 0) { close(f_copy); -@@ -1650,6 +1735,13 @@ static void recv_generator(char *fname, +@@ -1650,6 +1740,13 @@ static void recv_generator(char *fname, } close(fd); @@ -2146,7 +2138,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } void generate_files(int f_out, struct file_list *flist, char *local_name) -@@ -1716,6 +1808,8 @@ void generate_files(int f_out, struct fi +@@ -1716,6 +1813,8 @@ void generate_files(int f_out, struct fi * notice that and let us know via the redo pipe (or its closing). */ ignore_timeout = 1; @@ -2165,20 +2157,20 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. extern int make_backups; extern int remove_source_files; extern int stdout_format_has_i; -@@ -150,15 +151,19 @@ void init_hard_links(void) +@@ -119,15 +120,19 @@ void match_hard_links(void) } static int maybe_hard_link(struct file_struct *file, int ndx, - const char *fname, int statret, STRUCT_STAT *stp, + const char *fname, int statret, statx *sxp, - const char *toname, STRUCT_STAT *to_stp, - int itemizing, enum logcode code) + const char *oldname, STRUCT_STAT *old_stp, + const char *realname, int itemizing, enum logcode code) { if (statret == 0) { -- if (stp->st_dev == to_stp->st_dev -- && stp->st_ino == to_stp->st_ino) { -+ if (sxp->st.st_dev == to_stp->st_dev -+ && sxp->st.st_ino == to_stp->st_ino) { +- if (stp->st_dev == old_stp->st_dev +- && stp->st_ino == old_stp->st_ino) { ++ if (sxp->st.st_dev == old_stp->st_dev ++ && sxp->st.st_ino == old_stp->st_ino) { if (itemizing) { - itemize(file, ndx, statret, stp, +#ifdef SUPPORT_ACLS @@ -2189,107 +2181,133 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0, ""); } -@@ -173,12 +178,12 @@ static int maybe_hard_link(struct file_s - return -1; - } - } -- return hard_link_one(file, ndx, fname, statret, stp, toname, -+ return hard_link_one(file, ndx, fname, statret, sxp, toname, - 0, itemizing, code); - } +@@ -148,7 +153,11 @@ static int maybe_hard_link(struct file_s + if (hard_link_one(file, fname, oldname, 0)) { + if (itemizing) { +- itemize(file, ndx, statret, stp, ++#ifdef SUPPORT_ACLS ++ if (preserve_acls && statret == 0 && !ACL_READY(*sxp)) ++ get_acl(fname, sxp); ++#endif ++ itemize(file, ndx, statret, sxp, + ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0, + realname); + } +@@ -162,7 +171,7 @@ static int maybe_hard_link(struct file_s + /* Only called if FLAG_HLINKED is set and FLAG_HLINK_FIRST is not. Returns: + * 0 = process the file, 1 = skip the file, -1 = error occurred. */ int hard_link_check(struct file_struct *file, int ndx, const char *fname, - int statret, STRUCT_STAT *stp, int itemizing, + int statret, statx *sxp, int itemizing, - enum logcode code, int skip) + enum logcode code) { - int head; -@@ -221,7 +226,7 @@ int hard_link_check(struct file_struct * - || st2.st_ino != st3.st_ino) - continue; - statret = 1; -- stp = &st3; -+ sxp->st = st3; - if (verbose < 2 || !stdout_format_has_i) { - itemizing = 0; - code = FNONE; -@@ -231,12 +236,16 @@ int hard_link_check(struct file_struct * - if (!unchanged_file(cmpbuf, file, &st3)) - continue; - statret = 1; -- stp = &st3; -- if (unchanged_attrs(file, &st3)) -+ sxp->st = st3; + STRUCT_STAT prev_st; +@@ -213,18 +222,20 @@ int hard_link_check(struct file_struct * + if (statret < 0 && basis_dir[0] != NULL) { + /* If we match an alt-dest item, we don't output this as a change. */ + char cmpbuf[MAXPATHLEN]; +- STRUCT_STAT alt_st; ++ statx alt_sx; + int j = 0; +#ifdef SUPPORT_ACLS -+ if (preserve_acls) -+ get_acl(cmpbuf, sxp); ++ alt_sx.acc_acl = alt_sx.def_acl = NULL; +#endif -+ if (unchanged_attrs(file, sxp)) - break; - } while (basis_dir[++j] != NULL); + do { + pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); +- if (link_stat(cmpbuf, &alt_st, 0) < 0) ++ if (link_stat(cmpbuf, &alt_sx.st, 0) < 0) + continue; + if (link_dest) { +- if (prev_st.st_dev != alt_st.st_dev +- || prev_st.st_ino != alt_st.st_ino) ++ if (prev_st.st_dev != alt_sx.st.st_dev ++ || prev_st.st_ino != alt_sx.st.st_ino) + continue; + statret = 1; +- *stp = alt_st; + if (verbose < 2 || !stdout_format_has_i) { + itemizing = 0; + code = FNONE; +@@ -233,16 +244,36 @@ int hard_link_check(struct file_struct * + } + break; } -- maybe_hard_link(file, ndx, fname, statret, stp, -+ maybe_hard_link(file, ndx, fname, statret, sxp, - toname, &st2, itemizing, code); - if (remove_source_files == 1 && do_xfers) - send_msg_int(MSG_SUCCESS, ndx); -@@ -249,7 +258,7 @@ int hard_link_check(struct file_struct * - } - - int hard_link_one(struct file_struct *file, int ndx, const char *fname, -- int statret, STRUCT_STAT *stp, const char *toname, int terse, -+ int statret, statx *sxp, const char *toname, int terse, - int itemizing, enum logcode code) - { - if (do_link(toname, fname)) { -@@ -265,7 +274,11 @@ int hard_link_one(struct file_struct *fi - } - - if (itemizing) { -- itemize(file, ndx, statret, stp, +- if (!unchanged_file(cmpbuf, file, &alt_st)) ++ if (!unchanged_file(cmpbuf, file, &alt_sx.st)) + continue; + statret = 1; +- *stp = alt_st; +- if (unchanged_attrs(file, &alt_st)) +#ifdef SUPPORT_ACLS -+ if (preserve_acls && statret == 0 && !ACL_READY(*sxp)) -+ get_acl(fname, sxp); ++ if (preserve_acls) ++ get_acl(cmpbuf, &alt_sx); ++#endif ++ if (unchanged_attrs(file, &alt_sx)) + break; + } while (basis_dir[++j] != NULL); ++ if (statret == 1) { ++ sxp->st = alt_sx.st; ++#ifdef SUPPORT_ACLS ++ if (preserve_acls) { ++ if (!ACL_READY(*sxp)) ++ get_acl(cmpbuf, sxp); ++ else { ++ sxp->acc_acl = alt_sx.acc_acl; ++ sxp->def_acl = alt_sx.def_acl; ++ } ++ } ++#endif ++ } ++#ifdef SUPPORT_ACLS ++ else if (preserve_acls) ++ free_acl(&alt_sx); +#endif -+ itemize(file, ndx, statret, sxp, - ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0, - terse ? "" : toname); } -@@ -279,14 +292,15 @@ void hard_link_cluster(struct file_struc + +- if (maybe_hard_link(file, ndx, fname, statret, stp, prev_name, &prev_st, ++ if (maybe_hard_link(file, ndx, fname, statret, sxp, prev_name, &prev_st, + realname, itemizing, code) < 0) + return -1; + +@@ -277,7 +308,8 @@ void finish_hard_link(struct file_struct + STRUCT_STAT *stp, int itemizing, enum logcode code, + int alt_dest) { - char hlink1[MAXPATHLEN]; - char *hlink2; -- STRUCT_STAT st1, st2; -+ statx sx; +- STRUCT_STAT st, prev_st; ++ statx prev_sx; + STRUCT_STAT st; - int statret, ndx = master; - struct hlist *hl = F_HL_LIST(file); + char alt_name[MAXPATHLEN], *prev_name; + const char *our_name; + int prev_statret, ndx, prev_ndx = F_HL_PREV(file); +@@ -301,14 +333,24 @@ void finish_hard_link(struct file_struct + } else + our_name = fname; - hl->hlindex = FINISHED_LINK; - if (dry_run) - hl->dest_used = dest_used + 1; -- if (link_stat(f_name(file, hlink1), &st1, 0) < 0) -+ if (link_stat(f_name(file, hlink1), &st, 0) < 0) - return; - if (!(file->flags & FLAG_HLINK_FIRST)) { - while (!(file->flags & FLAG_HLINK_LAST)) { -@@ -302,9 +316,13 @@ void hard_link_cluster(struct file_struc - if (hl->hlindex != SKIPPED_LINK) - continue; - hlink2 = f_name(file, NULL); -- statret = link_stat(hlink2, &st2, 0); -- maybe_hard_link(file, ndx, hlink2, statret, &st2, -- hlink1, &st1, itemizing, code); -+ statret = link_stat(hlink2, &sx.st, 0); -+ maybe_hard_link(file, ndx, hlink2, statret, &sx, -+ hlink1, &st, itemizing, code); ++#ifdef SUPPORT_ACLS ++ prev_sx.acc_acl = prev_sx.def_acl = NULL; ++#endif ++ + while ((ndx = prev_ndx) >= 0) { ++ int val; + file = FPTR(ndx); + file->flags = (file->flags & ~FLAG_HLINK_FIRST) | FLAG_HLINK_DONE; + prev_ndx = F_HL_PREV(file); + prev_name = f_name(file, NULL); +- prev_statret = link_stat(prev_name, &prev_st, 0); +- if (maybe_hard_link(file, ndx, prev_name, prev_statret, &prev_st, +- our_name, stp, fname, itemizing, code) < 0) ++ prev_statret = link_stat(prev_name, &prev_sx.st, 0); ++ val = maybe_hard_link(file, ndx, prev_name, prev_statret, &prev_sx, ++ our_name, stp, fname, itemizing, code); +#ifdef SUPPORT_ACLS + if (preserve_acls) -+ free_acl(&sx); ++ free_acl(&prev_sx); +#endif ++ if (val < 0) + continue; if (remove_source_files == 1 && do_xfers) send_msg_int(MSG_SUCCESS, ndx); - hl->hlindex = FINISHED_LINK; --- old/lib/sysacls.c +++ new/lib/sysacls.c @@ -0,0 +1,3251 @@ @@ -5737,7 +5755,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. int ndx, recv_ok; if (verbose > 2) -@@ -550,7 +555,16 @@ int recv_files(int f_in, struct file_lis +@@ -545,7 +550,16 @@ int recv_files(int f_in, struct file_lis * mode based on the local permissions and some heuristics. */ if (!preserve_perms) { int exists = fd1 != -1; @@ -5946,7 +5964,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. --- old/rsync.h +++ new/rsync.h -@@ -496,6 +496,14 @@ struct idev { +@@ -500,6 +500,14 @@ struct idev { #define IN_LOOPBACKNET 127 #endif @@ -5960,8 +5978,8 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. + #define GID_NONE ((gid_t)-1) - #define HL_CHECK_MASTER 0 -@@ -553,10 +561,12 @@ extern int preserve_gid; + struct file_struct { +@@ -548,10 +556,12 @@ extern int preserve_gid; /* When the associated option is on, all entries will have these present: */ #define F_UID(f) REQ_EXTRA(f, preserve_uid)->uid #define F_GID(f) REQ_EXTRA(f, preserve_gid)->gid @@ -5969,12 +5987,12 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. /* These items are per-entry optional and mutally exclusive: */ #define F_HL_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev - #define F_HL_LIST(f) OPT_EXTRA(f, LEN64_BUMP(f))->hlist + #define F_HL_PREV(f) OPT_EXTRA(f, LEN64_BUMP(f))->num +#define F_DEF_ACL(f) OPT_EXTRA(f, LEN64_BUMP(f))->unum /* This optional item might follow an F_HL_*() item. * (Note: a device doesn't need to check LEN64_BUMP(f).) */ -@@ -694,6 +704,17 @@ struct stats { +@@ -687,6 +697,17 @@ struct stats { struct chmod_mode_struct; @@ -5992,7 +6010,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. #include "byteorder.h" #include "lib/mdfour.h" #include "lib/wildmatch.h" -@@ -712,6 +733,16 @@ struct chmod_mode_struct; +@@ -705,6 +726,16 @@ struct chmod_mode_struct; #define NORETURN __attribute__((__noreturn__)) #endif @@ -6690,7 +6708,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. EOT diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed" -@@ -186,15 +186,15 @@ $RSYNC -ivvplrtH --link-dest="$todir" "$ +@@ -185,15 +185,15 @@ $RSYNC -ivvplrtH --link-dest="$todir" "$ | tee "$outfile" filter_outfile cat <"$chkfile" @@ -6715,9 +6733,9 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. EOT diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed" -@@ -236,14 +236,14 @@ filter_outfile - # TODO fix really-old problem when combining -H with --compare-dest: - # missing output for foo/extra hard-link (and it might not be updated)! +@@ -233,15 +233,15 @@ $RSYNC -ivvplrtH --compare-dest="$todir" + | tee "$outfile" + filter_outfile cat <"$chkfile" -cd ./ -cd bar/ @@ -6726,6 +6744,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. -cd foo/ -.f foo/config1 -.f foo/config2 +-.f foo/extra -.L foo/sym -> ../bar/baz/rsync +cd ./ +cd bar/ @@ -6734,6 +6753,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. +cd foo/ +.f foo/config1 +.f foo/config2 ++.f foo/extra +.L foo/sym -> ../bar/baz/rsync EOT diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed" diff --git a/detect-renamed.diff b/detect-renamed.diff index 621fd66..247be0c 100644 --- a/detect-renamed.diff +++ b/detect-renamed.diff @@ -42,8 +42,8 @@ TODO: extern int protocol_version; extern int sanitize_paths; extern struct stats stats; -@@ -77,6 +78,8 @@ static dev_t tmp_rdev; - static struct idev tmp_idev; +@@ -80,6 +81,8 @@ static struct idev tmp_idev; + #endif static char tmp_sum[MD4_SUM_LENGTH]; +struct file_list the_fattr_list; @@ -51,7 +51,7 @@ TODO: static char empty_sum[MD4_SUM_LENGTH]; static int flist_count_offset; -@@ -259,6 +262,44 @@ static mode_t from_wire_mode(int mode) +@@ -262,6 +265,44 @@ static mode_t from_wire_mode(int mode) return mode; } @@ -96,7 +96,7 @@ TODO: static void send_directory(int f, struct file_list *flist, char *fbuf, int len); -@@ -1411,6 +1452,25 @@ struct file_list *recv_file_list(int f) +@@ -1414,6 +1455,25 @@ struct file_list *recv_file_list(int f) clean_flist(flist, relative_paths, 1); @@ -132,7 +132,7 @@ TODO: extern int whole_file; extern int list_only; extern int new_root_dir; -@@ -91,18 +92,21 @@ extern char *backup_dir; +@@ -91,6 +92,7 @@ extern char *backup_dir; extern char *backup_suffix; extern int backup_suffix_len; extern struct file_list *the_file_list; @@ -140,7 +140,8 @@ TODO: extern struct filter_list_struct server_filter_list; int ignore_perishable = 0; - int non_perishable_cnt = 0; +@@ -98,12 +100,14 @@ int non_perishable_cnt = 0; + int maybe_ATTRS_REPORT = 0; static int deletion_count = 0; /* used to implement --max-delete */ +static int unexplored_dirs = 1; @@ -155,7 +156,7 @@ TODO: #define DEL_RECURSE (1<<1) /* recurse */ #define DEL_DIR_IS_EMPTY (1<<2) /* internal delete_FUNCTIONS use only */ -@@ -124,11 +128,121 @@ static int is_backup_file(char *fn) +@@ -125,11 +129,121 @@ static int is_backup_file(char *fn) return k > 0 && strcmp(fn+k, backup_suffix) == 0; } @@ -277,7 +278,7 @@ TODO: */ static enum delret delete_item(char *fbuf, int mode, char *replace, int flags) { -@@ -150,6 +264,8 @@ static enum delret delete_item(char *fbu +@@ -151,6 +265,8 @@ static enum delret delete_item(char *fbu goto check_ret; /* OK: try to delete the directory. */ } @@ -286,7 +287,7 @@ TODO: if (!replace && max_delete >= 0 && ++deletion_count > max_delete) return DR_AT_LIMIT; -@@ -196,6 +312,8 @@ static enum delret delete_item(char *fbu +@@ -197,6 +313,8 @@ static enum delret delete_item(char *fbu * its contents, otherwise just checks for content. Returns DR_SUCCESS or * DR_NOT_EMPTY. Note that fname must point to a MAXPATHLEN buffer! (The * buffer is used for recursion, but returned unchanged.) @@ -295,7 +296,7 @@ TODO: */ static enum delret delete_dir_contents(char *fname, int flags) { -@@ -252,6 +370,8 @@ static enum delret delete_dir_contents(c +@@ -253,6 +371,8 @@ static enum delret delete_dir_contents(c if (S_ISDIR(fp->mode) && delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS) ret = DR_NOT_EMPTY; @@ -304,7 +305,7 @@ TODO: if (delete_item(fname, fp->mode, NULL, flags) != DR_SUCCESS) ret = DR_NOT_EMPTY; } -@@ -404,15 +524,19 @@ static void do_delayed_deletions(char *d +@@ -405,15 +525,19 @@ static void do_delayed_deletions(char *d * all the --delete-WHEN options. Note that the fbuf pointer must point to a * MAXPATHLEN buffer with the name of the directory in it (the functions we * call will append names onto the end, but the old dir value will be restored @@ -327,7 +328,7 @@ TODO: int dlen, i; if (!flist) { -@@ -426,6 +550,8 @@ static void delete_in_dir(struct file_li +@@ -427,6 +551,8 @@ static void delete_in_dir(struct file_li if (verbose > 2) rprintf(FINFO, "delete_in_dir(%s)\n", fbuf); @@ -336,7 +337,7 @@ TODO: if (allowed_lull) maybe_send_keepalive(); -@@ -433,12 +559,14 @@ static void delete_in_dir(struct file_li +@@ -434,12 +560,14 @@ static void delete_in_dir(struct file_li return; /* Impossible... */ if (io_error && !(lp_ignore_errors(module_id) || ignore_errors)) { @@ -356,7 +357,7 @@ TODO: } while (cur_depth >= file->dir.depth && cur_depth >= min_depth) -@@ -449,6 +577,9 @@ static void delete_in_dir(struct file_li +@@ -450,6 +578,9 @@ static void delete_in_dir(struct file_li dlen = strlen(fbuf); filt_array[cur_depth] = push_local_filters(fbuf, dlen); @@ -366,7 +367,7 @@ TODO: if (one_file_system) { if (file->flags & FLAG_TOP_DIR) filesystem_dev = stp->st_dev; -@@ -458,6 +589,11 @@ static void delete_in_dir(struct file_li +@@ -459,6 +590,11 @@ static void delete_in_dir(struct file_li dirlist = get_dirlist(fbuf, dlen, 0); @@ -378,7 +379,7 @@ TODO: /* If an item in dirlist is not found in flist, delete it * from the filesystem. */ for (i = dirlist->count; i--; ) { -@@ -470,16 +606,23 @@ static void delete_in_dir(struct file_li +@@ -471,16 +607,23 @@ static void delete_in_dir(struct file_li f_name(fp, NULL)); continue; } @@ -405,7 +406,7 @@ TODO: flist_free(dirlist); } -@@ -509,9 +652,9 @@ static void do_delete_pass(struct file_l +@@ -510,9 +653,9 @@ static void do_delete_pass(struct file_l || !S_ISDIR(st.st_mode)) continue; @@ -417,7 +418,7 @@ TODO: if (do_progress && !am_server) rprintf(FINFO, " \r"); -@@ -1042,6 +1185,7 @@ static int try_dests_non(struct file_str +@@ -1048,6 +1191,7 @@ static int try_dests_non(struct file_str return j; } @@ -425,7 +426,7 @@ TODO: static int phase = 0; /* Acts on the_file_list->file's ndx'th item, whose name is fname. If a dir, -@@ -1228,8 +1372,12 @@ static void recv_generator(char *fname, +@@ -1233,8 +1377,12 @@ static void recv_generator(char *fname, if (real_ret != 0 && one_file_system) real_st.st_dev = filesystem_dev; if (delete_during && f_out != -1 && !phase && dry_run < 2 @@ -440,8 +441,8 @@ TODO: return; } -@@ -1500,8 +1648,14 @@ static void recv_generator(char *fname, - itemizing, code, HL_SKIP)) +@@ -1498,8 +1646,14 @@ static void recv_generator(char *fname, + if (preserve_hard_links && F_NOT_HLINK_LAST(file)) return; #endif - if (stat_errno == ENOENT) @@ -478,9 +479,9 @@ TODO: whole_file = 0; if (verbose >= 2) { rprintf(FINFO, "delta-transmission %s\n", -@@ -1758,7 +1918,23 @@ void generate_files(int f_out, struct fi +@@ -1757,7 +1917,23 @@ void generate_files(int f_out, struct fi } - recv_generator(NULL, NULL, 0, 0, 0, code, -1); + recv_generator(NULL, NULL, 0, 0, code, -1); if (delete_during) - delete_in_dir(NULL, NULL, NULL, NULL); + delete_in_dir(NULL, NULL, NULL, NULL, 0); diff --git a/early-checksum.diff b/early-checksum.diff index d910ab4..7c2afc8 100644 --- a/early-checksum.diff +++ b/early-checksum.diff @@ -24,7 +24,7 @@ To use this patch, run these commands for a successful build: extern int module_id; extern int ignore_errors; extern int numeric_ids; -@@ -730,6 +731,15 @@ static struct file_struct *recv_file_ent +@@ -734,6 +735,15 @@ static struct file_struct *recv_file_ent bp = tmp_sum; } read_buf(f, bp, checksum_len); @@ -50,7 +50,7 @@ To use this patch, run these commands for a successful build: extern int checksum_len; extern char *partial_dir; extern char *basis_dir[]; -@@ -505,7 +506,8 @@ void itemize(struct file_struct *file, i +@@ -578,7 +579,8 @@ void itemize(struct file_struct *file, i /* Perform our quick-check heuristic for determining if a file is unchanged. */ @@ -60,7 +60,7 @@ To use this patch, run these commands for a successful build: { if (st->st_size != F_LENGTH(file)) return 0; -@@ -514,6 +516,8 @@ int unchanged_file(char *fn, struct file +@@ -587,6 +589,8 @@ int unchanged_file(char *fn, struct file of the file time to determine whether to sync */ if (always_checksum && S_ISREG(st->st_mode)) { char sum[MD4_SUM_LENGTH]; @@ -69,7 +69,7 @@ To use this patch, run these commands for a successful build: file_checksum(fn, sum, st->st_size); return memcmp(sum, F_SUM(file), checksum_len) == 0; } -@@ -750,7 +754,7 @@ static int try_dests_reg(struct file_str +@@ -826,7 +830,7 @@ static int try_dests_reg(struct file_str match_level = 1; /* FALL THROUGH */ case 1: @@ -78,7 +78,7 @@ To use this patch, run these commands for a successful build: continue; best_match = j; match_level = 2; -@@ -1418,7 +1422,7 @@ static void recv_generator(char *fname, +@@ -1512,7 +1516,7 @@ static void recv_generator(char *fname, ; else if (fnamecmp_type == FNAMECMP_FUZZY) ; @@ -89,15 +89,15 @@ To use this patch, run these commands for a successful build: handle_partial_dir(partialptr, PDIR_DELETE); --- old/hlink.c +++ new/hlink.c -@@ -234,7 +234,7 @@ int hard_link_check(struct file_struct * - } - break; - } -- if (!unchanged_file(cmpbuf, file, &st3)) -+ if (!unchanged_file(cmpbuf, 0, file, &st3)) - continue; - statret = 1; - st = &st3; +@@ -233,7 +233,7 @@ int hard_link_check(struct file_struct * + } + break; + } +- if (!unchanged_file(cmpbuf, file, &alt_st)) ++ if (!unchanged_file(cmpbuf, 0, file, &alt_st)) + continue; + statret = 1; + *stp = alt_st; --- old/main.c +++ new/main.c @@ -47,6 +47,7 @@ extern int copy_dirlinks; @@ -118,7 +118,7 @@ To use this patch, run these commands for a successful build: int local_server = 0; int new_root_dir = 0; mode_t orig_umask = 0; -@@ -785,6 +789,7 @@ static void do_server_recv(int f_in, int +@@ -788,6 +792,7 @@ static void do_server_recv(int f_in, int struct file_list *flist; char *local_name = NULL; char *dir = NULL; @@ -126,9 +126,9 @@ To use this patch, run these commands for a successful build: int save_verbose = verbose; if (filesfrom_fd >= 0) { -@@ -828,6 +833,10 @@ static void do_server_recv(int f_in, int - filesfrom_fd = -1; - } +@@ -836,6 +841,10 @@ static void do_server_recv(int f_in, int + init_hard_links(); + #endif + strlcpy(olddir, curr_dir, sizeof olddir); + if (always_checksum && !local_server && argc > 0) @@ -137,7 +137,7 @@ To use this patch, run these commands for a successful build: flist = recv_file_list(f_in); verbose = save_verbose; if (!flist) { -@@ -836,6 +845,9 @@ static void do_server_recv(int f_in, int +@@ -844,6 +853,9 @@ static void do_server_recv(int f_in, int } the_file_list = flist; @@ -147,7 +147,7 @@ To use this patch, run these commands for a successful build: if (argc > 0) local_name = get_local_name(flist,argv[0]); -@@ -917,6 +929,7 @@ int client_run(int f_in, int f_out, pid_ +@@ -923,6 +935,7 @@ int client_run(int f_in, int f_out, pid_ { struct file_list *flist = NULL; int exit_code = 0, exit_code2 = 0; @@ -155,9 +155,9 @@ To use this patch, run these commands for a successful build: char *local_name = NULL; cleanup_child_pid = pid; -@@ -991,11 +1004,18 @@ int client_run(int f_in, int f_out, pid_ - filesfrom_fd = -1; - } +@@ -1002,11 +1015,18 @@ int client_run(int f_in, int f_out, pid_ + init_hard_links(); + #endif + strlcpy(olddir, curr_dir, sizeof olddir); + if (always_checksum && !local_server) @@ -176,11 +176,11 @@ To use this patch, run these commands for a successful build: --- old/rsync.h +++ new/rsync.h -@@ -66,6 +66,7 @@ - #define FLAG_HLINK_FIRST (1<<6) /* receiver/generator */ +@@ -67,6 +67,7 @@ #define FLAG_HLINK_LAST (1<<7) /* receiver/generator */ - #define FLAG_LENGTH64 (1<<8) /* sender/receiver/generator */ -+#define FLAG_SUM_DIFFERS (1<<9) /* receiver/generator */ + #define FLAG_HLINK_DONE (1<<8) /* receiver/generator */ + #define FLAG_LENGTH64 (1<<9) /* sender/receiver/generator */ ++#define FLAG_SUM_DIFFERS (1<<10)/* receiver/generator */ - /* update this if you make incompatible changes */ - #define PROTOCOL_VERSION 30 + #define BITS_SET(val,bits) (((val) & (bits)) == (bits)) + #define BITS_SETnUNSET(val,onbits,offbits) (((val) & ((onbits)|(offbits))) == (onbits)) -- 2.34.1