From af7eb67accc33f120054901cc7608bf4666c0c54 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 2 May 2006 17:21:29 +0000 Subject: [PATCH] Fixed failing hunks. --- acls.diff | 94 ++++++++++++++++++++++----------------------- early-checksum.diff | 32 +++++++-------- 2 files changed, 64 insertions(+), 62 deletions(-) diff --git a/acls.diff b/acls.diff index 1739358..d9e1fef 100644 --- a/acls.diff +++ b/acls.diff @@ -1372,7 +1372,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. file->modtime = modtime; file->length = file_length; -@@ -703,6 +723,11 @@ static struct file_struct *receive_file_ +@@ -701,6 +721,11 @@ static struct file_struct *receive_file_ read_buf(f, sum, checksum_len); } @@ -1384,7 +1384,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. return file; } -@@ -952,6 +977,9 @@ static struct file_struct *send_file_nam +@@ -950,6 +975,9 @@ static struct file_struct *send_file_nam unsigned short flags) { struct file_struct *file; @@ -1394,7 +1394,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); -@@ -961,6 +989,15 @@ static struct file_struct *send_file_nam +@@ -959,6 +987,15 @@ static struct file_struct *send_file_nam if (chmod_modes && !S_ISLNK(file->mode)) file->mode = tweak_mode(file->mode, chmod_modes); @@ -1410,7 +1410,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. maybe_emit_filelist_progress(flist->count + flist_count_offset); flist_expand(flist); -@@ -968,6 +1005,15 @@ static struct file_struct *send_file_nam +@@ -966,6 +1003,15 @@ static struct file_struct *send_file_nam if (file->basename[0]) { flist->files[flist->count++] = file; send_file_entry(file, f); @@ -1436,7 +1436,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. extern int preserve_links; extern int preserve_devices; extern int preserve_specials; -@@ -85,6 +86,7 @@ extern long block_size; /* "long" becaus +@@ -87,6 +88,7 @@ extern long block_size; /* "long" becaus extern int max_delete; extern int force_delete; extern int one_file_system; @@ -1444,7 +1444,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. extern struct stats stats; extern dev_t filesystem_dev; extern char *backup_dir; -@@ -317,22 +319,27 @@ static void do_delete_pass(struct file_l +@@ -319,22 +321,27 @@ static void do_delete_pass(struct file_l rprintf(FINFO, " \r"); } @@ -1477,7 +1477,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. int32 iflags, uchar fnamecmp_type, char *xname) { if (statret >= 0) { /* A from-dest-dir statret can == 1! */ -@@ -340,19 +347,23 @@ void itemize(struct file_struct *file, i +@@ -342,19 +349,23 @@ void itemize(struct file_struct *file, i : S_ISDIR(file->mode) ? !omit_dir_times : !S_ISLNK(file->mode); @@ -1506,7 +1506,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } else iflags |= ITEM_IS_NEW; -@@ -603,7 +614,7 @@ void check_for_finished_hlinks(int itemi +@@ -605,7 +616,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, @@ -1514,8 +1514,8 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. + char *cmpbuf, statx *sxp, int itemizing, int maybe_ATTRS_REPORT, enum logcode code) { - int best_match = -1; -@@ -612,7 +623,7 @@ static int try_dests_reg(struct file_str + int save_ignore_times = ignore_times; +@@ -620,7 +631,7 @@ static int try_dests_reg(struct file_str do { pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); @@ -1524,7 +1524,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. continue; switch (match_level) { case 0: -@@ -620,16 +631,20 @@ static int try_dests_reg(struct file_str +@@ -628,16 +639,20 @@ static int try_dests_reg(struct file_str match_level = 1; /* FALL THROUGH */ case 1: @@ -1542,13 +1542,13 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. +#endif + if (!unchanged_attrs(file, sxp)) continue; - if ((always_checksum || ignore_times) + if (always_checksum - && cmp_time(stp->st_mtime, file->modtime)) + && cmp_time(sxp->st.st_mtime, file->modtime)) continue; best_match = j; match_level = 3; -@@ -644,22 +659,27 @@ static int try_dests_reg(struct file_str +@@ -655,22 +670,27 @@ static int try_dests_reg(struct file_str if (j != best_match) { j = best_match; pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); @@ -1580,7 +1580,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (verbose > 1 && maybe_ATTRS_REPORT) { code = daemon_log_format_has_i || dry_run ? FCLIENT : FINFO; -@@ -678,8 +698,13 @@ static int try_dests_reg(struct file_str +@@ -689,8 +709,13 @@ static int try_dests_reg(struct file_str } return -1; } @@ -1596,7 +1596,7 @@ 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) -@@ -704,13 +729,18 @@ static int try_dests_non(struct file_str +@@ -715,13 +740,18 @@ static int try_dests_non(struct file_str enum logcode code) { char fnamebuf[MAXPATHLEN]; @@ -1618,7 +1618,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. continue; if (S_ISLNK(file->mode)) { #ifdef SUPPORT_LINKS -@@ -723,10 +753,10 @@ static int try_dests_non(struct file_str +@@ -734,10 +764,10 @@ static int try_dests_non(struct file_str #endif continue; } else if (IS_SPECIAL(file->mode)) { @@ -1631,7 +1631,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. continue; } else { rprintf(FERROR, -@@ -755,7 +785,15 @@ static int try_dests_non(struct file_str +@@ -766,7 +796,15 @@ static int try_dests_non(struct file_str int changes = compare_dest ? 0 : ITEM_LOCAL_CHANGE + (link_dest ? ITEM_XNAME_FOLLOWS : 0); char *lp = link_dest ? "" : NULL; @@ -1648,7 +1648,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if (verbose > 1 && maybe_ATTRS_REPORT) { code = daemon_log_format_has_i || dry_run -@@ -769,6 +807,7 @@ static int try_dests_non(struct file_str +@@ -780,6 +818,7 @@ static int try_dests_non(struct file_str } static int phase = 0; @@ -1656,7 +1656,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 -@@ -790,7 +829,8 @@ static void recv_generator(char *fname, +@@ -801,7 +840,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; @@ -1666,7 +1666,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; -@@ -841,6 +881,9 @@ static void recv_generator(char *fname, +@@ -852,6 +892,9 @@ static void recv_generator(char *fname, dry_run--; missing_below = -1; } @@ -1676,7 +1676,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (dry_run > 1) { statret = -1; stat_errno = ENOENT; -@@ -848,7 +891,7 @@ static void recv_generator(char *fname, +@@ -859,7 +902,7 @@ static void recv_generator(char *fname, char *dn = file->dirname ? file->dirname : "."; if (parent_dirname != dn && strcmp(parent_dirname, dn) != 0) { if (relative_paths && !implied_dirs @@ -1685,7 +1685,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", -@@ -860,6 +903,10 @@ static void recv_generator(char *fname, +@@ -871,6 +914,10 @@ static void recv_generator(char *fname, } if (fuzzy_basis) need_fuzzy_dirlist = 1; @@ -1696,7 +1696,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } parent_dirname = dn; -@@ -868,7 +915,7 @@ static void recv_generator(char *fname, +@@ -879,7 +926,7 @@ static void recv_generator(char *fname, need_fuzzy_dirlist = 0; } @@ -1705,7 +1705,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. keep_dirlinks && S_ISDIR(file->mode)); stat_errno = errno; } -@@ -886,8 +933,9 @@ static void recv_generator(char *fname, +@@ -897,8 +944,9 @@ static void recv_generator(char *fname, * mode based on the local permissions and some heuristics. */ if (!preserve_perms) { int exists = statret == 0 @@ -1717,7 +1717,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if (S_ISDIR(file->mode)) { -@@ -896,8 +944,8 @@ static void recv_generator(char *fname, +@@ -907,8 +955,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. */ @@ -1728,7 +1728,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. return; statret = -1; } -@@ -906,7 +954,11 @@ static void recv_generator(char *fname, +@@ -917,7 +965,11 @@ static void recv_generator(char *fname, dry_run++; } if (itemizing && f_out != -1) { @@ -1741,7 +1741,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL); } if (statret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) { -@@ -918,19 +970,19 @@ static void recv_generator(char *fname, +@@ -929,19 +981,19 @@ static void recv_generator(char *fname, full_fname(fname)); } } @@ -1766,7 +1766,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (preserve_links && S_ISLNK(file->mode)) { #ifdef SUPPORT_LINKS -@@ -948,7 +1000,7 @@ static void recv_generator(char *fname, +@@ -963,7 +1015,7 @@ static void recv_generator(char *fname, char lnk[MAXPATHLEN]; int len; @@ -1775,7 +1775,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. && (len = readlink(fname, lnk, MAXPATHLEN-1)) > 0) { lnk[len] = 0; /* A link already pointing to the -@@ -956,10 +1008,10 @@ static void recv_generator(char *fname, +@@ -971,10 +1023,10 @@ static void recv_generator(char *fname, * required. */ if (strcmp(lnk, file->u.link) == 0) { if (itemizing) { @@ -1788,7 +1788,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. maybe_ATTRS_REPORT); if (preserve_hard_links && file->link_u.links) { -@@ -972,9 +1024,9 @@ static void recv_generator(char *fname, +@@ -987,9 +1039,9 @@ static void recv_generator(char *fname, } /* Not the right symlink (or not a symlink), so * delete it. */ @@ -1800,7 +1800,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. statret = -1; } else if (basis_dir[0] != NULL) { if (try_dests_non(file, fname, ndx, itemizing, -@@ -990,7 +1042,7 @@ static void recv_generator(char *fname, +@@ -1005,7 +1057,7 @@ static void recv_generator(char *fname, } } if (preserve_hard_links && file->link_u.links @@ -1809,7 +1809,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. itemizing, code, HL_SKIP)) return; if (do_symlink(file->u.link,fname) != 0) { -@@ -999,7 +1051,7 @@ static void recv_generator(char *fname, +@@ -1014,7 +1066,7 @@ static void recv_generator(char *fname, } else { set_file_attrs(fname, file, NULL, 0); if (itemizing) { @@ -1818,7 +1818,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. ITEM_LOCAL_CHANGE, 0, NULL); } if (code && verbose) { -@@ -1033,18 +1085,22 @@ static void recv_generator(char *fname, +@@ -1048,18 +1100,22 @@ static void recv_generator(char *fname, itemizing = code = 0; } } @@ -1849,7 +1849,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. statret = -1; if (verbose > 2) { rprintf(FINFO,"mknod(%s,0%o,0x%x)\n", -@@ -1057,7 +1113,7 @@ static void recv_generator(char *fname, +@@ -1072,7 +1128,7 @@ static void recv_generator(char *fname, } else { set_file_attrs(fname, file, NULL, 0); if (itemizing) { @@ -1858,7 +1858,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. ITEM_LOCAL_CHANGE, 0, NULL); } if (code && verbose) -@@ -1069,12 +1125,12 @@ static void recv_generator(char *fname, +@@ -1084,12 +1140,12 @@ static void recv_generator(char *fname, } } else { if (itemizing) @@ -1874,7 +1874,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if (!S_ISREG(file->mode)) { -@@ -1108,7 +1164,7 @@ static void recv_generator(char *fname, +@@ -1123,7 +1179,7 @@ static void recv_generator(char *fname, } if (update_only && statret == 0 @@ -1883,7 +1883,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; -@@ -1117,18 +1173,18 @@ static void recv_generator(char *fname, +@@ -1132,18 +1188,18 @@ static void recv_generator(char *fname, fnamecmp = fname; fnamecmp_type = FNAMECMP_FNAME; @@ -1906,7 +1906,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (j != -1) { fnamecmp = fnamecmpbuf; fnamecmp_type = j; -@@ -1137,7 +1193,7 @@ static void recv_generator(char *fname, +@@ -1152,7 +1208,7 @@ static void recv_generator(char *fname, } real_ret = statret; @@ -1915,7 +1915,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 -@@ -1156,7 +1212,7 @@ static void recv_generator(char *fname, +@@ -1171,7 +1227,7 @@ static void recv_generator(char *fname, rprintf(FINFO, "fuzzy basis selected for %s: %s\n", fname, fnamecmpbuf); } @@ -1924,7 +1924,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. statret = 0; fnamecmp = fnamecmpbuf; fnamecmp_type = FNAMECMP_FUZZY; -@@ -1165,7 +1221,7 @@ static void recv_generator(char *fname, +@@ -1180,7 +1236,7 @@ static void recv_generator(char *fname, if (statret != 0) { if (preserve_hard_links && file->link_u.links @@ -1933,7 +1933,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. itemizing, code, HL_SKIP)) return; if (stat_errno == ENOENT) -@@ -1175,31 +1231,44 @@ static void recv_generator(char *fname, +@@ -1190,31 +1246,44 @@ static void recv_generator(char *fname, return; } @@ -1984,7 +1984,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. fnamecmp = partialptr; fnamecmp_type = FNAMECMP_PARTIAL_DIR; statret = 0; -@@ -1223,17 +1292,21 @@ static void recv_generator(char *fname, +@@ -1238,17 +1307,21 @@ static void recv_generator(char *fname, pretend_missing: /* pretend the file didn't exist */ if (preserve_hard_links && file->link_u.links @@ -2009,7 +2009,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); -@@ -1244,7 +1317,7 @@ static void recv_generator(char *fname, +@@ -1259,7 +1332,7 @@ static void recv_generator(char *fname, full_fname(backupptr)); free(back_file); close(fd); @@ -2018,7 +2018,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) { -@@ -1252,14 +1325,14 @@ static void recv_generator(char *fname, +@@ -1267,14 +1340,14 @@ static void recv_generator(char *fname, full_fname(backupptr)); free(back_file); close(fd); @@ -2035,7 +2035,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. } if (verbose > 2) -@@ -1277,24 +1350,32 @@ static void recv_generator(char *fname, +@@ -1292,24 +1365,32 @@ static void recv_generator(char *fname, iflags |= ITEM_BASIS_TYPE_FOLLOWS; if (fnamecmp_type == FNAMECMP_FUZZY) iflags |= ITEM_XNAME_FOLLOWS; @@ -2073,7 +2073,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync. if (f_copy >= 0) { close(f_copy); -@@ -1307,6 +1388,13 @@ static void recv_generator(char *fname, +@@ -1322,6 +1403,13 @@ static void recv_generator(char *fname, } close(fd); @@ -2087,7 +2087,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) -@@ -1366,6 +1454,8 @@ void generate_files(int f_out, struct fi +@@ -1381,6 +1469,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; diff --git a/early-checksum.diff b/early-checksum.diff index 0041db4..5794dd4 100644 --- a/early-checksum.diff +++ b/early-checksum.diff @@ -18,7 +18,7 @@ for a local copy, so the old algorithm is used for local copies. extern int module_id; extern int ignore_errors; extern int numeric_ids; -@@ -701,6 +702,16 @@ static struct file_struct *receive_file_ +@@ -699,6 +700,16 @@ static struct file_struct *receive_file_ sum = empty_sum; } read_buf(f, sum, checksum_len); @@ -37,7 +37,7 @@ for a local copy, so the old algorithm is used for local copies. return file; --- old/generator.c +++ new/generator.c -@@ -71,6 +71,7 @@ extern int ignore_timeout; +@@ -73,6 +73,7 @@ extern int ignore_timeout; extern int protocol_version; extern int fuzzy_basis; extern int always_checksum; @@ -45,7 +45,7 @@ for a local copy, so the old algorithm is used for local copies. extern int checksum_len; extern char *partial_dir; extern char *basis_dir[]; -@@ -374,7 +375,8 @@ void itemize(struct file_struct *file, i +@@ -376,7 +377,8 @@ void itemize(struct file_struct *file, i /* Perform our quick-check heuristic for determining if a file is unchanged. */ @@ -55,7 +55,7 @@ for a local copy, so the old algorithm is used for local copies. { if (st->st_size != file->length) return 0; -@@ -383,6 +385,8 @@ int unchanged_file(char *fn, struct file +@@ -385,6 +387,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]; @@ -64,7 +64,7 @@ for a local copy, so the old algorithm is used for local copies. file_checksum(fn, sum, st->st_size); return memcmp(sum, file->u.sum, checksum_len) == 0; } -@@ -620,7 +624,7 @@ static int try_dests_reg(struct file_str +@@ -628,7 +632,7 @@ static int try_dests_reg(struct file_str match_level = 1; /* FALL THROUGH */ case 1: @@ -73,7 +73,7 @@ for a local copy, so the old algorithm is used for local copies. continue; best_match = j; match_level = 2; -@@ -1182,7 +1186,7 @@ static void recv_generator(char *fname, +@@ -1197,7 +1201,7 @@ static void recv_generator(char *fname, ; else if (fnamecmp_type == FNAMECMP_FUZZY) ; @@ -103,15 +103,17 @@ for a local copy, so the old algorithm is used for local copies. extern int recurse; extern int relative_paths; extern int sanitize_paths; -@@ -68,6 +69,7 @@ extern char *batch_name; - - extern char curr_dir[MAXPATHLEN]; +@@ -66,6 +67,9 @@ extern char *rsync_path; + extern char *shell_cmd; + extern char *batch_name; ++extern char curr_dir[MAXPATHLEN]; ++ +int pre_checksum = 0; int local_server = 0; + int startdir_depth = 0; mode_t orig_umask = 0; - struct file_list *the_file_list; -@@ -736,6 +738,7 @@ static void do_server_recv(int f_in, int +@@ -741,6 +745,7 @@ static void do_server_recv(int f_in, int struct file_list *flist; char *local_name = NULL; char *dir = NULL; @@ -119,7 +121,7 @@ for a local copy, so the old algorithm is used for local copies. int save_verbose = verbose; if (filesfrom_fd >= 0) { -@@ -779,6 +782,10 @@ static void do_server_recv(int f_in, int +@@ -784,6 +789,10 @@ static void do_server_recv(int f_in, int filesfrom_fd = -1; } @@ -130,7 +132,7 @@ for a local copy, so the old algorithm is used for local copies. flist = recv_file_list(f_in); verbose = save_verbose; if (!flist) { -@@ -787,6 +794,9 @@ static void do_server_recv(int f_in, int +@@ -792,6 +801,9 @@ static void do_server_recv(int f_in, int } the_file_list = flist; @@ -140,7 +142,7 @@ for a local copy, so the old algorithm is used for local copies. if (argc > 0) local_name = get_local_name(flist,argv[0]); -@@ -848,6 +858,7 @@ int client_run(int f_in, int f_out, pid_ +@@ -851,6 +863,7 @@ int client_run(int f_in, int f_out, pid_ { struct file_list *flist = NULL; int exit_code = 0, exit_code2 = 0; @@ -148,7 +150,7 @@ for a local copy, so the old algorithm is used for local copies. char *local_name = NULL; cleanup_child_pid = pid; -@@ -922,11 +933,18 @@ int client_run(int f_in, int f_out, pid_ +@@ -925,11 +938,18 @@ int client_run(int f_in, int f_out, pid_ filesfrom_fd = -1; } -- 2.34.1