From ccdb48f6739a9fb3893983b993210ec23891ebb2 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 18 Sep 2007 01:16:23 +0000 Subject: [PATCH] Fixed failing hunks. --- atimes.diff | 52 ++++++++++++++-------------- detect-renamed.diff | 82 ++++++++++++++++++++++----------------------- flags.diff | 76 ++++++++++++++++++++--------------------- 3 files changed, 105 insertions(+), 105 deletions(-) diff --git a/atimes.diff b/atimes.diff index be2f024..7abb3dc 100644 --- a/atimes.diff +++ b/atimes.diff @@ -9,24 +9,24 @@ TODO: need to fix this to handle 64-bit time_t values! --- old/compat.c +++ new/compat.c -@@ -45,6 +45,7 @@ extern int prune_empty_dirs; - extern int protocol_version; +@@ -44,6 +44,7 @@ extern int protocol_version; + extern int protect_args; extern int preserve_uid; extern int preserve_gid; +extern int preserve_atimes; extern int preserve_acls; extern int preserve_xattrs; extern int need_messages_from_generator; -@@ -58,7 +59,7 @@ extern char *dest_option; - extern struct filter_list_struct filter_list; +@@ -63,7 +64,7 @@ extern iconv_t ic_send, ic_recv; + #endif /* These index values are for the file-list's extra-attribute array. */ -int uid_ndx, gid_ndx, acls_ndx, xattrs_ndx; +int uid_ndx, gid_ndx, atimes_ndx, acls_ndx, xattrs_ndx; + #ifdef ICONV_OPTION + int ic_ndx; - /* The server makes sure that if either side only supports a pre-release - * version of a protocol, that both sides must speak a compatible version -@@ -105,6 +106,8 @@ void setup_protocol(int f_out,int f_in) +@@ -115,6 +116,8 @@ void setup_protocol(int f_out,int f_in) uid_ndx = ++file_extra_cnt; if (preserve_gid) gid_ndx = ++file_extra_cnt; @@ -45,7 +45,7 @@ TODO: need to fix this to handle 64-bit time_t values! extern int relative_paths; extern int implied_dirs; extern int file_extra_cnt; -@@ -172,6 +173,7 @@ void show_flist_stats(void) +@@ -174,6 +175,7 @@ void show_flist_stats(void) static void list_file_entry(struct file_struct *f) { char permbuf[PERMSTRING_SIZE]; @@ -53,7 +53,7 @@ TODO: need to fix this to handle 64-bit time_t values! double len; if (!F_IS_ACTIVE(f)) { -@@ -186,14 +188,16 @@ static void list_file_entry(struct file_ +@@ -188,14 +190,16 @@ static void list_file_entry(struct file_ #ifdef SUPPORT_LINKS if (preserve_links && S_ISLNK(f->mode)) { @@ -72,7 +72,7 @@ TODO: need to fix this to handle 64-bit time_t values! f_name(f, NULL)); } } -@@ -361,6 +365,7 @@ int push_pathname(const char *dir, int l +@@ -363,6 +367,7 @@ int push_pathname(const char *dir, int l static void send_file_entry(int f, struct file_struct *file, int ndx, int first_ndx) { static time_t modtime; @@ -80,7 +80,7 @@ TODO: need to fix this to handle 64-bit time_t values! static mode_t mode; static int64 dev; static dev_t rdev; -@@ -460,6 +465,13 @@ static void send_file_entry(int f, struc +@@ -461,6 +466,13 @@ static void send_file_entry(int f, struc xflags |= XMIT_SAME_TIME; else modtime = file->modtime; @@ -94,7 +94,7 @@ TODO: need to fix this to handle 64-bit time_t values! #ifdef SUPPORT_HARD_LINKS if (tmp_dev != 0) { -@@ -532,6 +544,8 @@ static void send_file_entry(int f, struc +@@ -534,6 +546,8 @@ static void send_file_entry(int f, struc } if (!(xflags & XMIT_SAME_MODE)) write_int(f, to_wire_mode(mode)); @@ -103,7 +103,7 @@ TODO: need to fix this to handle 64-bit time_t values! if (uid_ndx && !(xflags & XMIT_SAME_UID)) { if (protocol_version < 30) write_int(f, uid); -@@ -618,7 +632,7 @@ static void send_file_entry(int f, struc +@@ -620,7 +634,7 @@ static void send_file_entry(int f, struc static struct file_struct *recv_file_entry(struct file_list *flist, int xflags, int f) { @@ -112,7 +112,7 @@ TODO: need to fix this to handle 64-bit time_t values! static mode_t mode; static int64 dev; static dev_t rdev; -@@ -755,6 +769,16 @@ static struct file_struct *recv_file_ent +@@ -751,6 +765,16 @@ static struct file_struct *recv_file_ent } if (!(xflags & XMIT_SAME_MODE)) mode = from_wire_mode(read_int(f)); @@ -129,7 +129,7 @@ TODO: need to fix this to handle 64-bit time_t values! if (chmod_modes && !S_ISLNK(mode)) mode = tweak_mode(mode, chmod_modes); -@@ -883,6 +907,8 @@ static struct file_struct *recv_file_ent +@@ -879,6 +903,8 @@ static struct file_struct *recv_file_ent F_GROUP(file) = gid; file->flags |= gid_flags; } @@ -138,7 +138,7 @@ TODO: need to fix this to handle 64-bit time_t values! #ifdef ICONV_OPTION if (ic_ndx) F_NDX(file) = flist->used + flist->ndx_start; -@@ -1198,6 +1224,8 @@ struct file_struct *make_file(const char +@@ -1196,6 +1222,8 @@ struct file_struct *make_file(const char F_OWNER(file) = st.st_uid; if (gid_ndx) F_GROUP(file) = st.st_gid; @@ -157,7 +157,7 @@ TODO: need to fix this to handle 64-bit time_t values! extern int uid_ndx; extern int gid_ndx; extern int delete_mode; -@@ -563,6 +564,9 @@ void itemize(const char *fnamecmp, struc +@@ -562,6 +563,9 @@ void itemize(const char *fnamecmp, struc && (!(iflags & ITEM_XNAME_FOLLOWS) || *xname)) || (keep_time && cmp_time(file->modtime, sxp->st.st_mtime) != 0)) iflags |= ITEM_REPORT_TIME; @@ -167,16 +167,16 @@ TODO: need to fix this to handle 64-bit time_t values! if (!BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS)) iflags |= ITEM_REPORT_PERMS; if (uid_ndx && am_root && (uid_t)F_OWNER(file) != sxp->st.st_uid) -@@ -880,6 +884,8 @@ static int try_dests_reg(struct file_str +@@ -879,6 +883,8 @@ static int try_dests_reg(struct file_str if (link_dest) { if (!hard_link_one(file, fname, cmpbuf, 1)) goto try_a_copy; + if (preserve_atimes) + set_file_attrs(fname, file, sxp, NULL, 0); if (preserve_hard_links && F_IS_HLINKED(file)) - finish_hard_link(file, fname, &sxp->st, itemizing, code, j); + finish_hard_link(file, fname, ndx, &sxp->st, itemizing, code, j); if (itemizing && (verbose > 1 || stdout_format_has_i > 1)) { -@@ -1782,7 +1788,7 @@ static void touch_up_dirs(struct file_li +@@ -1793,7 +1799,7 @@ static void touch_up_dirs(struct file_li if (!(file->mode & S_IWUSR)) do_chmod(fname, file->mode); if (need_retouch_dir_times) @@ -187,7 +187,7 @@ TODO: need to fix this to handle 64-bit time_t values! else if (!(counter & 0xFF)) --- old/log.c +++ new/log.c -@@ -631,7 +631,8 @@ static void log_formatted(enum logcode c +@@ -630,7 +630,8 @@ static void log_formatted(enum logcode c c[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p'; c[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o'; c[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g'; @@ -215,7 +215,7 @@ TODO: need to fix this to handle 64-bit time_t values! rprintf(F," --super receiver attempts super-user activities\n"); #ifdef SUPPORT_XATTRS rprintf(F," --fake-super store/recover privileged attrs using xattrs\n"); -@@ -479,6 +481,9 @@ static struct poptOption long_options[] +@@ -480,6 +482,9 @@ static struct poptOption long_options[] {"times", 't', POPT_ARG_VAL, &preserve_times, 2, 0, 0 }, {"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, {"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, @@ -225,7 +225,7 @@ TODO: need to fix this to handle 64-bit time_t values! {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 1, 0, 0 }, {"no-omit-dir-times",0, POPT_ARG_VAL, &omit_dir_times, 0, 0, 0 }, {"no-O", 0, POPT_ARG_VAL, &omit_dir_times, 0, 0, 0 }, -@@ -1707,6 +1712,8 @@ void server_options(char **args, int *ar +@@ -1715,6 +1720,8 @@ void server_options(char **args, int *ar argstr[x++] = 'D'; if (preserve_times) argstr[x++] = 't'; @@ -244,15 +244,15 @@ TODO: need to fix this to handle 64-bit time_t values! extern int preserve_times; extern int am_root; extern int am_server; -@@ -273,6 +274,7 @@ int set_file_attrs(const char *fname, st +@@ -342,6 +343,7 @@ int set_file_attrs(const char *fname, st int updated = 0; statx sx2; int change_uid, change_gid; + time_t atime, mtime; mode_t new_mode = file->mode; + int inherit; - if (!sxp) { -@@ -310,18 +312,36 @@ int set_file_attrs(const char *fname, st +@@ -382,18 +384,36 @@ int set_file_attrs(const char *fname, st set_stat_xattr(fname, file); #endif diff --git a/detect-renamed.diff b/detect-renamed.diff index ffbb5e5..b861477 100644 --- a/detect-renamed.diff +++ b/detect-renamed.diff @@ -34,7 +34,7 @@ TODO: --- old/compat.c +++ new/compat.c -@@ -50,6 +50,7 @@ extern int preserve_hard_links; +@@ -49,6 +49,7 @@ extern int preserve_xattrs; extern int need_messages_from_generator; extern int delete_mode, delete_before, delete_during, delete_after; extern int delete_excluded; @@ -42,18 +42,18 @@ TODO: extern int make_backups; extern char *shell_cmd; /* contains VER.SUB string if client is a pre-release */ extern char *backup_dir, *backup_suffix; -@@ -204,7 +205,7 @@ void setup_protocol(int f_out,int f_in) - if (recurse && allow_inc_recurse && !preserve_hard_links +@@ -225,7 +226,7 @@ void setup_protocol(int f_out,int f_in) + } else if (protocol_version >= 30) { + if (recurse && allow_inc_recurse && !delete_before && !delete_after && !delay_updates - && (!relative_paths || implied_dirs) && !use_qsort -- && !prune_empty_dirs) -+ && !prune_empty_dirs && !detect_renamed) +- && !use_qsort && !prune_empty_dirs) ++ && !use_qsort && !prune_empty_dirs && !detect_renamed) inc_recurse = 1; need_messages_from_generator = 1; } --- old/flist.c +++ new/flist.c -@@ -60,6 +60,7 @@ extern int non_perishable_cnt; +@@ -61,6 +61,7 @@ extern int non_perishable_cnt; extern int prune_empty_dirs; extern int copy_links; extern int copy_unsafe_links; @@ -61,7 +61,7 @@ TODO: extern int protocol_version; extern int sanitize_paths; extern struct stats stats; -@@ -98,6 +99,8 @@ static int64 tmp_dev, tmp_ino; +@@ -113,6 +114,8 @@ static int64 tmp_dev, tmp_ino; #endif static char tmp_sum[MAX_DIGEST_LEN]; @@ -70,7 +70,7 @@ TODO: static char empty_sum[MAX_DIGEST_LEN]; static int flist_count_offset; /* for --delete --progress */ static int dir_count = 0; -@@ -265,6 +268,45 @@ static int is_excluded(char *fname, int +@@ -281,6 +284,45 @@ static int is_excluded(char *fname, int return 0; } @@ -116,7 +116,7 @@ TODO: static void send_directory(int f, struct file_list *flist, char *fbuf, int len, int flags); -@@ -1929,6 +1971,25 @@ struct file_list *send_file_list(int f, +@@ -1935,6 +1977,25 @@ struct file_list *send_file_list(int f, if (verbose > 2) rprintf(FINFO, "send_file_list done\n"); @@ -144,15 +144,15 @@ TODO: flist_done_allocating(flist); --- old/generator.c +++ new/generator.c -@@ -80,6 +80,7 @@ extern char *basis_dir[]; +@@ -79,6 +79,7 @@ extern char *basis_dir[]; extern int compare_dest; extern int copy_dest; extern int link_dest; +extern int detect_renamed; extern int whole_file; extern int list_only; - extern int new_root_dir; -@@ -97,6 +98,7 @@ extern char *backup_suffix; + extern int read_batch; +@@ -95,6 +96,7 @@ extern char *backup_suffix; extern int backup_suffix_len; extern struct file_list *cur_flist, *first_flist, *dir_flist; extern struct filter_list_struct server_filter_list; @@ -160,7 +160,7 @@ TODO: #ifdef ICONV_OPTION extern int ic_ndx; #endif -@@ -107,6 +109,7 @@ int maybe_ATTRS_REPORT = 0; +@@ -105,6 +107,7 @@ int maybe_ATTRS_REPORT = 0; static dev_t dev_zero; static int deletion_count = 0; /* used to implement --max-delete */ @@ -168,7 +168,7 @@ TODO: static int deldelay_size = 0, deldelay_cnt = 0; static char *deldelay_buf = NULL; static int deldelay_fd = -1; -@@ -116,7 +119,8 @@ static int need_retouch_dir_times; +@@ -114,7 +117,8 @@ static int need_retouch_dir_times; static int need_retouch_dir_perms; static const char *solo_file = NULL; @@ -178,7 +178,7 @@ TODO: #define DEL_RECURSE (1<<1) /* recurse */ #define DEL_DIR_IS_EMPTY (1<<2) /* internal delete_FUNCTIONS use only */ -@@ -138,11 +142,120 @@ static int is_backup_file(char *fn) +@@ -136,11 +140,120 @@ static int is_backup_file(char *fn) return k > 0 && strcmp(fn+k, backup_suffix) == 0; } @@ -299,7 +299,7 @@ TODO: */ static enum delret delete_item(char *fbuf, int mode, char *replace, int flags) { -@@ -164,6 +277,8 @@ static enum delret delete_item(char *fbu +@@ -162,6 +275,8 @@ static enum delret delete_item(char *fbu goto check_ret; /* OK: try to delete the directory. */ } @@ -308,7 +308,7 @@ TODO: if (!replace && max_delete >= 0 && ++deletion_count > max_delete) return DR_AT_LIMIT; -@@ -210,6 +325,8 @@ static enum delret delete_item(char *fbu +@@ -208,6 +323,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.) @@ -317,7 +317,7 @@ TODO: */ static enum delret delete_dir_contents(char *fname, int flags) { -@@ -229,7 +346,9 @@ static enum delret delete_dir_contents(c +@@ -227,7 +344,9 @@ static enum delret delete_dir_contents(c save_filters = push_local_filters(fname, dlen); non_perishable_cnt = 0; @@ -327,7 +327,7 @@ TODO: ret = non_perishable_cnt ? DR_NOT_EMPTY : DR_SUCCESS; if (!dirlist->used) -@@ -266,6 +385,8 @@ static enum delret delete_dir_contents(c +@@ -264,6 +383,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; @@ -336,7 +336,7 @@ TODO: if (delete_item(fname, fp->mode, NULL, flags) != DR_SUCCESS) ret = DR_NOT_EMPTY; } -@@ -418,12 +539,17 @@ static void do_delayed_deletions(char *d +@@ -416,12 +537,17 @@ 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 @@ -357,7 +357,7 @@ TODO: int dlen, i; if (!fbuf) { -@@ -434,21 +560,28 @@ static void delete_in_dir(char *fbuf, st +@@ -432,21 +558,28 @@ static void delete_in_dir(char *fbuf, st if (verbose > 2) rprintf(FINFO, "delete_in_dir(%s)\n", fbuf); @@ -391,7 +391,7 @@ TODO: if (one_file_system) { if (file->flags & FLAG_TOP_DIR) filesystem_dev = *fs_dev; -@@ -458,6 +591,11 @@ static void delete_in_dir(char *fbuf, st +@@ -456,6 +589,11 @@ static void delete_in_dir(char *fbuf, st dirlist = get_dirlist(fbuf, dlen, 0); @@ -403,7 +403,7 @@ TODO: /* If an item in dirlist is not found in flist, delete it * from the filesystem. */ for (i = dirlist->used; i--; ) { -@@ -470,16 +608,23 @@ static void delete_in_dir(char *fbuf, st +@@ -468,16 +606,23 @@ static void delete_in_dir(char *fbuf, st f_name(fp, NULL)); continue; } @@ -430,7 +430,7 @@ TODO: flist_free(dirlist); } -@@ -509,9 +654,9 @@ static void do_delete_pass(void) +@@ -507,9 +652,9 @@ static void do_delete_pass(void) || !S_ISDIR(st.st_mode)) continue; @@ -442,7 +442,7 @@ TODO: if (do_progress && !am_server) rprintf(FINFO, " \r"); -@@ -1074,6 +1219,7 @@ static int try_dests_non(struct file_str +@@ -1072,6 +1217,7 @@ static int try_dests_non(struct file_str return j; } @@ -450,7 +450,7 @@ TODO: static int phase = 0; static int dflt_perms; -@@ -1298,8 +1444,12 @@ static void recv_generator(char *fname, +@@ -1308,8 +1454,12 @@ static void recv_generator(char *fname, } } else if (delete_during && f_out != -1 && !phase && dry_run < 2 @@ -465,9 +465,9 @@ TODO: goto cleanup; } -@@ -1571,8 +1721,14 @@ static void recv_generator(char *fname, - if (preserve_hard_links && F_HLINK_NOT_LAST(file)) +@@ -1587,8 +1737,14 @@ static void recv_generator(char *fname, goto cleanup; + } #endif - if (stat_errno == ENOENT) + if (stat_errno == ENOENT) { @@ -481,7 +481,7 @@ TODO: rsyserr(FERROR, stat_errno, "recv_generator: failed to stat %s", full_fname(fname)); goto cleanup; -@@ -1885,6 +2041,12 @@ void generate_files(int f_out, const cha +@@ -1910,6 +2066,12 @@ void generate_files(int f_out, const cha if (verbose > 2) rprintf(FINFO, "generator starting pid=%ld\n", (long)getpid()); @@ -494,7 +494,7 @@ TODO: if (delete_before && !solo_file && cur_flist->used > 0) do_delete_pass(); if (delete_during == 2) { -@@ -1895,7 +2057,7 @@ void generate_files(int f_out, const cha +@@ -1920,7 +2082,7 @@ void generate_files(int f_out, const cha } do_progress = 0; @@ -503,7 +503,7 @@ TODO: whole_file = 0; if (verbose >= 2) { rprintf(FINFO, "delta-transmission %s\n", -@@ -1926,7 +2088,7 @@ void generate_files(int f_out, const cha +@@ -1958,7 +2120,7 @@ void generate_files(int f_out, const cha dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp)); } else dirdev = MAKEDEV(0, 0); @@ -512,7 +512,7 @@ TODO: } } } -@@ -1979,7 +2141,21 @@ void generate_files(int f_out, const cha +@@ -2003,7 +2165,21 @@ void generate_files(int f_out, const cha } while ((cur_flist = cur_flist->next) != NULL); if (delete_during) @@ -537,7 +537,7 @@ TODO: rprintf(FINFO, "generate_files phase=%d\n", phase); --- old/options.c +++ new/options.c -@@ -80,6 +80,7 @@ int am_generator = 0; +@@ -79,6 +79,7 @@ int am_generator = 0; int am_starting_up = 1; int relative_paths = -1; int implied_dirs = 1; @@ -545,7 +545,7 @@ TODO: int numeric_ids = 0; int allow_8bit_chars = 0; int force_delete = 0; -@@ -375,6 +376,7 @@ void usage(enum logcode F) +@@ -382,6 +383,7 @@ void usage(enum logcode F) rprintf(F," --modify-window=NUM compare mod-times with reduced accuracy\n"); rprintf(F," -T, --temp-dir=DIR create temporary files in directory DIR\n"); rprintf(F," -y, --fuzzy find similar file for basis if no dest file\n"); @@ -553,7 +553,7 @@ TODO: rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n"); rprintf(F," --copy-dest=DIR ... and include copies of unchanged files\n"); rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n"); -@@ -548,6 +550,7 @@ static struct poptOption long_options[] +@@ -561,6 +563,7 @@ static struct poptOption long_options[] {"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 }, {"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 }, {"link-dest", 0, POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 }, @@ -561,7 +561,7 @@ TODO: {"fuzzy", 'y', POPT_ARG_NONE, &fuzzy_basis, 0, 0, 0 }, {"compress", 'z', POPT_ARG_NONE, 0, 'z', 0, 0 }, {"no-compress", 0, POPT_ARG_VAL, &do_compression, 0, 0, 0 }, -@@ -1495,7 +1498,7 @@ int parse_arguments(int *argc, const cha +@@ -1531,7 +1534,7 @@ int parse_arguments(int *argc_p, const c inplace = 1; } @@ -570,7 +570,7 @@ TODO: partial_dir = tmp_partialdir; if (inplace) { -@@ -1504,6 +1507,7 @@ int parse_arguments(int *argc, const cha +@@ -1540,6 +1543,7 @@ int parse_arguments(int *argc_p, const c snprintf(err_buf, sizeof err_buf, "--%s cannot be used with --%s\n", append_mode ? "append" : "inplace", @@ -578,7 +578,7 @@ TODO: delay_updates ? "delay-updates" : "partial-dir"); return 0; } -@@ -1844,6 +1848,8 @@ void server_options(char **args,int *arg +@@ -1887,6 +1891,8 @@ void server_options(char **args, int *ar args[ac++] = "--super"; if (size_only) args[ac++] = "--size-only"; @@ -589,7 +589,7 @@ TODO: if (asprintf(&arg, "--skip-compress=%s", skip_compress) < 0) --- old/rsync.yo +++ new/rsync.yo -@@ -388,6 +388,7 @@ to the detailed description below for a +@@ -389,6 +389,7 @@ to the detailed description below for a --modify-window=NUM compare mod-times with reduced accuracy -T, --temp-dir=DIR create temporary files in directory DIR -y, --fuzzy find similar file for basis if no dest file @@ -597,7 +597,7 @@ TODO: --compare-dest=DIR also compare received files relative to DIR --copy-dest=DIR ... and include copies of unchanged files --link-dest=DIR hardlink to files in DIR when unchanged -@@ -1376,6 +1377,15 @@ Note that the use of the bf(--delete) op +@@ -1394,6 +1395,15 @@ Note that the use of the bf(--delete) op fuzzy-match files, so either use bf(--delete-after) or specify some filename exclusions if you need to prevent this. diff --git a/flags.diff b/flags.diff index 69072ef..80ac3d7 100644 --- a/flags.diff +++ b/flags.diff @@ -12,24 +12,24 @@ TODO: fix --delete-delay to work with --flags option. --- old/compat.c +++ new/compat.c -@@ -45,6 +45,7 @@ extern int prune_empty_dirs; - extern int protocol_version; +@@ -44,6 +44,7 @@ extern int protocol_version; + extern int protect_args; extern int preserve_uid; extern int preserve_gid; +extern int preserve_fileflags; extern int preserve_acls; extern int preserve_xattrs; extern int need_messages_from_generator; -@@ -58,7 +59,7 @@ extern char *dest_option; - extern struct filter_list_struct filter_list; +@@ -63,7 +64,7 @@ extern iconv_t ic_send, ic_recv; + #endif /* These index values are for the file-list's extra-attribute array. */ -int uid_ndx, gid_ndx, acls_ndx, xattrs_ndx; +int uid_ndx, gid_ndx, fileflags_ndx, acls_ndx, xattrs_ndx; + #ifdef ICONV_OPTION + int ic_ndx; - /* The server makes sure that if either side only supports a pre-release - * version of a protocol, that both sides must speak a compatible version -@@ -105,6 +106,8 @@ void setup_protocol(int f_out,int f_in) +@@ -115,6 +116,8 @@ void setup_protocol(int f_out,int f_in) uid_ndx = ++file_extra_cnt; if (preserve_gid) gid_ndx = ++file_extra_cnt; @@ -59,7 +59,7 @@ TODO: fix --delete-delay to work with --flags option. extern int uid_ndx; extern int gid_ndx; extern int eol_nulls; -@@ -362,6 +363,9 @@ static void send_file_entry(int f, struc +@@ -364,6 +365,9 @@ static void send_file_entry(int f, struc { static time_t modtime; static mode_t mode; @@ -69,7 +69,7 @@ TODO: fix --delete-delay to work with --flags option. static int64 dev; static dev_t rdev; static uint32 rdev_major; -@@ -410,6 +414,12 @@ static void send_file_entry(int f, struc +@@ -411,6 +415,12 @@ static void send_file_entry(int f, struc xflags |= XMIT_SAME_MODE; else mode = file->mode; @@ -82,7 +82,7 @@ TODO: fix --delete-delay to work with --flags option. if (protocol_version >= 30 && S_ISDIR(mode) && !(file->flags & FLAG_XFER_DIR)) xflags |= XMIT_NON_XFER_DIR; -@@ -532,6 +542,10 @@ static void send_file_entry(int f, struc +@@ -534,6 +544,10 @@ static void send_file_entry(int f, struc } if (!(xflags & XMIT_SAME_MODE)) write_int(f, to_wire_mode(mode)); @@ -93,7 +93,7 @@ TODO: fix --delete-delay to work with --flags option. if (uid_ndx && !(xflags & XMIT_SAME_UID)) { if (protocol_version < 30) write_int(f, uid); -@@ -620,6 +634,9 @@ static struct file_struct *recv_file_ent +@@ -622,6 +636,9 @@ static struct file_struct *recv_file_ent { static int64 modtime; static mode_t mode; @@ -103,7 +103,7 @@ TODO: fix --delete-delay to work with --flags option. static int64 dev; static dev_t rdev; static uint32 rdev_major; -@@ -755,9 +772,12 @@ static struct file_struct *recv_file_ent +@@ -751,9 +768,12 @@ static struct file_struct *recv_file_ent } if (!(xflags & XMIT_SAME_MODE)) mode = from_wire_mode(read_int(f)); @@ -117,7 +117,7 @@ TODO: fix --delete-delay to work with --flags option. if (uid_ndx && !(xflags & XMIT_SAME_UID)) { if (protocol_version < 30) -@@ -877,6 +897,10 @@ static struct file_struct *recv_file_ent +@@ -873,6 +893,10 @@ static struct file_struct *recv_file_ent OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32); } file->mode = mode; @@ -128,7 +128,7 @@ TODO: fix --delete-delay to work with --flags option. if (uid_ndx) F_OWNER(file) = uid; if (gid_ndx) { -@@ -1194,6 +1218,10 @@ struct file_struct *make_file(const char +@@ -1192,6 +1216,10 @@ struct file_struct *make_file(const char OPT_EXTRA(file, 0)->unum = (uint32)(st.st_size >> 32); } file->mode = st.st_mode; @@ -141,7 +141,7 @@ TODO: fix --delete-delay to work with --flags option. if (gid_ndx) --- old/generator.c +++ new/generator.c -@@ -115,6 +115,14 @@ static int need_retouch_dir_times; +@@ -114,6 +114,14 @@ static int need_retouch_dir_times; static int need_retouch_dir_perms; static const char *solo_file = NULL; @@ -156,7 +156,7 @@ TODO: fix --delete-delay to work with --flags option. /* For calling delete_item() and delete_dir_contents(). */ #define DEL_RECURSE (1<<1) /* recurse */ #define DEL_DIR_IS_EMPTY (1<<2) /* internal delete_FUNCTIONS use only */ -@@ -130,7 +138,6 @@ enum delret { +@@ -129,7 +137,6 @@ enum delret { /* Forward declaration for delete_item(). */ static enum delret delete_dir_contents(char *fname, int flags); @@ -164,7 +164,7 @@ TODO: fix --delete-delay to work with --flags option. static int is_backup_file(char *fn) { int k = strlen(fn) - backup_suffix_len; -@@ -143,17 +150,20 @@ static int is_backup_file(char *fn) +@@ -142,17 +149,20 @@ static int is_backup_file(char *fn) * Note that fbuf must point to a MAXPATHLEN buffer if the mode indicates it's * a directory! (The buffer is used for recursion, but returned unchanged.) */ @@ -188,7 +188,7 @@ TODO: fix --delete-delay to work with --flags option. if (S_ISDIR(mode) && !(flags & DEL_DIR_IS_EMPTY)) { ignore_perishable = 1; /* If DEL_RECURSE is not set, this just reports emptiness. */ -@@ -265,7 +275,7 @@ static enum delret delete_dir_contents(c +@@ -264,7 +274,7 @@ 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; @@ -197,7 +197,7 @@ TODO: fix --delete-delay to work with --flags option. ret = DR_NOT_EMPTY; } -@@ -321,8 +331,9 @@ static int remember_delete(struct file_s +@@ -320,8 +330,9 @@ static int remember_delete(struct file_s while (1) { len = snprintf(deldelay_buf + deldelay_cnt, @@ -209,7 +209,7 @@ TODO: fix --delete-delay to work with --flags option. if ((deldelay_cnt += len) <= deldelay_size) break; if (deldelay_fd < 0 && !start_delete_delay_temp()) -@@ -335,7 +346,7 @@ static int remember_delete(struct file_s +@@ -334,7 +345,7 @@ static int remember_delete(struct file_s return 1; } @@ -218,7 +218,7 @@ TODO: fix --delete-delay to work with --flags option. { static int read_pos = 0; int j, len, mode; -@@ -377,7 +388,7 @@ static int read_delay_line(char *buf) +@@ -376,7 +387,7 @@ static int read_delay_line(char *buf) bp = deldelay_buf + read_pos; @@ -227,7 +227,7 @@ TODO: fix --delete-delay to work with --flags option. invalid_data: rprintf(FERROR, "ERROR: invalid data in delete-delay file.\n"); return -1; -@@ -400,15 +411,15 @@ static int read_delay_line(char *buf) +@@ -399,15 +410,15 @@ static int read_delay_line(char *buf) static void do_delayed_deletions(char *delbuf) { @@ -246,7 +246,7 @@ TODO: fix --delete-delay to work with --flags option. if (deldelay_fd >= 0) close(deldelay_fd); } -@@ -475,7 +486,7 @@ static void delete_in_dir(char *fbuf, st +@@ -474,7 +485,7 @@ static void delete_in_dir(char *fbuf, st if (!remember_delete(fp, delbuf)) break; } else @@ -255,7 +255,7 @@ TODO: fix --delete-delay to work with --flags option. } } -@@ -1219,7 +1230,7 @@ static void recv_generator(char *fname, +@@ -1233,7 +1244,7 @@ static void recv_generator(char *fname, * we need to delete it. If it doesn't exist, then * (perhaps recursively) create it. */ if (statret == 0 && !S_ISDIR(sx.st.st_mode)) { @@ -264,7 +264,7 @@ TODO: fix --delete-delay to work with --flags option. goto skipping_dir_contents; statret = -1; } -@@ -1351,7 +1362,7 @@ static void recv_generator(char *fname, +@@ -1362,7 +1373,7 @@ static void recv_generator(char *fname, } /* Not the right symlink (or not a symlink), so * delete it. */ @@ -273,7 +273,7 @@ TODO: fix --delete-delay to work with --flags option. goto cleanup; } else if (basis_dir[0] != NULL) { int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx, -@@ -1430,7 +1441,7 @@ static void recv_generator(char *fname, +@@ -1441,7 +1452,7 @@ static void recv_generator(char *fname, goto return_with_success; goto cleanup; } @@ -282,7 +282,7 @@ TODO: fix --delete-delay to work with --flags option. goto cleanup; } else if (basis_dir[0] != NULL) { int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx, -@@ -1521,7 +1532,7 @@ static void recv_generator(char *fname, +@@ -1532,7 +1543,7 @@ static void recv_generator(char *fname, fnamecmp_type = FNAMECMP_FNAME; if (statret == 0 && !S_ISREG(sx.st.st_mode)) { @@ -338,7 +338,7 @@ TODO: fix --delete-delay to work with --flags option. rprintf(F," -E, --executability preserve the file's executability\n"); rprintf(F," --chmod=CHMOD affect file and/or directory permissions\n"); #ifdef SUPPORT_ACLS -@@ -469,6 +475,8 @@ static struct poptOption long_options[] +@@ -470,6 +476,8 @@ static struct poptOption long_options[] {"perms", 'p', POPT_ARG_VAL, &preserve_perms, 1, 0, 0 }, {"no-perms", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 }, {"no-p", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 }, @@ -347,7 +347,7 @@ TODO: fix --delete-delay to work with --flags option. {"executability", 'E', POPT_ARG_NONE, &preserve_executability, 0, 0, 0 }, {"acls", 'A', POPT_ARG_NONE, 0, 'A', 0, 0 }, {"no-acls", 0, POPT_ARG_VAL, &preserve_acls, 0, 0, 0 }, -@@ -1279,6 +1287,15 @@ int parse_arguments(int *argc_p, const c +@@ -1283,6 +1291,15 @@ int parse_arguments(int *argc_p, const c } #endif @@ -363,7 +363,7 @@ TODO: fix --delete-delay to work with --flags option. if (write_batch && read_batch) { snprintf(err_buf, sizeof err_buf, "--write-batch and --read-batch can not be used together\n"); -@@ -1770,6 +1787,9 @@ void server_options(char **args, int *ar +@@ -1794,6 +1811,9 @@ void server_options(char **args, int *ar if (xfer_dirs && !recurse && delete_mode && am_sender) args[ac++] = "--no-r"; @@ -383,9 +383,9 @@ TODO: fix --delete-delay to work with --flags option. extern int preserve_executability; extern int preserve_times; extern int am_root; -@@ -60,6 +61,16 @@ iconv_t ic_send = (iconv_t)-1, ic_recv = - int ic_ndx; - #endif +@@ -59,6 +60,16 @@ iconv_t ic_chck = (iconv_t)-1; + iconv_t ic_send = (iconv_t)-1, ic_recv = (iconv_t)-1; + # endif +#ifdef SUPPORT_FLAGS +#ifndef UF_NOUNLINK @@ -399,8 +399,8 @@ TODO: fix --delete-delay to work with --flags option. + static const char *default_charset(void) { - #if defined HAVE_LIBCHARSET_H && defined HAVE_LOCALE_CHARSET -@@ -267,6 +278,41 @@ mode_t dest_mode(mode_t flist_mode, mode + # if defined HAVE_LIBCHARSET_H && defined HAVE_LOCALE_CHARSET +@@ -336,6 +347,41 @@ mode_t dest_mode(mode_t flist_mode, mode return new_mode; } @@ -442,7 +442,7 @@ TODO: fix --delete-delay to work with --flags option. int set_file_attrs(const char *fname, struct file_struct *file, statx *sxp, const char *fnamecmp, int flags) { -@@ -395,6 +441,15 @@ int set_file_attrs(const char *fname, st +@@ -467,6 +513,15 @@ int set_file_attrs(const char *fname, st } #endif @@ -458,7 +458,7 @@ TODO: fix --delete-delay to work with --flags option. if (verbose > 1 && flags & ATTRS_REPORT) { if (updated) rprintf(FCLIENT, "%s\n", fname); -@@ -454,6 +509,9 @@ void finish_transfer(const char *fname, +@@ -526,6 +581,9 @@ void finish_transfer(const char *fname, set_file_attrs(fnametmp, file, NULL, fnamecmp, ok_to_set_time ? 0 : ATTRS_SKIP_MTIME); @@ -468,7 +468,7 @@ TODO: fix --delete-delay to work with --flags option. /* move tmp file over real file */ if (verbose > 2) rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname); -@@ -468,6 +526,9 @@ void finish_transfer(const char *fname, +@@ -540,6 +598,9 @@ void finish_transfer(const char *fname, } if (ret == 0) { /* The file was moved into place (not copied), so it's done. */ -- 2.34.1