--- old/compat.c
+++ new/compat.c
-@@ -44,6 +44,7 @@ extern int prune_empty_dirs;
+@@ -45,6 +45,7 @@ extern int prune_empty_dirs;
extern int protocol_version;
extern int preserve_uid;
extern int preserve_gid;
extern int preserve_acls;
extern int preserve_xattrs;
extern int preserve_hard_links;
-@@ -58,7 +59,7 @@ extern char *dest_option;
+@@ -59,7 +60,7 @@ extern char *dest_option;
extern struct filter_list_struct filter_list;
/* These index values are for the file-list's extra-attribute array. */
/* 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
-@@ -99,6 +100,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -100,6 +101,8 @@ void setup_protocol(int f_out,int f_in)
uid_ndx = ++file_extra_cnt;
if (preserve_gid)
gid_ndx = ++file_extra_cnt;
#ifdef ICONV_OPTION
if (ic_ndx)
F_NDX(file) = flist->used + flist->ndx_start;
-@@ -1191,6 +1217,8 @@ struct file_struct *make_file(const char
+@@ -1181,6 +1207,8 @@ struct file_struct *make_file(const char
F_OWNER(file) = st.st_uid;
if (gid_ndx)
F_GROUP(file) = st.st_gid;
extern int preserve_perms;
extern int preserve_times;
+extern int preserve_atimes;
- extern int omit_dir_times;
extern int uid_ndx;
extern int gid_ndx;
-@@ -564,6 +565,9 @@ void itemize(const char *fnamecmp, struc
+ extern int delete_mode;
+@@ -563,6 +564,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;
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)
-@@ -881,6 +885,8 @@ static int try_dests_reg(struct file_str
+@@ -880,6 +884,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_hard_links && F_IS_HLINKED(file))
finish_hard_link(file, fname, &sxp->st, itemizing, code, j);
if (itemizing && (verbose > 1 || stdout_format_has_i > 1)) {
-@@ -1775,7 +1781,7 @@ static void touch_up_dirs(struct file_li
+@@ -1774,7 +1780,7 @@ static void touch_up_dirs(struct file_li
if (!(file->mode & S_IWUSR))
do_chmod(fname, file->mode);
if (need_retouch_dir_times)
c[11] = '\0';
--- old/options.c
+++ new/options.c
-@@ -57,6 +57,7 @@ int preserve_uid = 0;
+@@ -56,6 +56,7 @@ int preserve_specials = 0;
+ int preserve_uid = 0;
int preserve_gid = 0;
int preserve_times = 0;
- int omit_dir_times = 0;
+int preserve_atimes = 0;
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -338,6 +339,7 @@ void usage(enum logcode F)
+@@ -344,6 +345,7 @@ void usage(enum logcode F)
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve modification times\n");
rprintf(F," -O, --omit-dir-times omit directories from --times\n");
rprintf(F," --super receiver attempts super-user activities\n");
#ifdef SUPPORT_XATTRS
rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
-@@ -473,6 +475,9 @@ static struct poptOption long_options[]
- {"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 },
+@@ -477,6 +479,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 },
+ {"atimes", 'U', POPT_ARG_VAL, &preserve_atimes, 1, 0, 0 },
+ {"no-atimes", 0, POPT_ARG_VAL, &preserve_atimes, 0, 0, 0 },
+ {"no-U", 0, POPT_ARG_VAL, &preserve_atimes, 0, 0, 0 },
- {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 2, 0, 0 },
- {"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
- {"super", 0, POPT_ARG_VAL, &am_root, 2, 0, 0 },
-@@ -1675,6 +1680,8 @@ void server_options(char **args,int *arg
+ {"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 },
+@@ -1691,6 +1696,8 @@ void server_options(char **args,int *arg
argstr[x++] = 'D';
if (preserve_times)
argstr[x++] = 't';
extern int preserve_executability;
+extern int preserve_atimes;
extern int preserve_times;
- extern int omit_dir_times;
extern int am_root;
-@@ -274,6 +275,7 @@ int set_file_attrs(const char *fname, st
+ extern int am_server;
+@@ -273,6 +274,7 @@ int set_file_attrs(const char *fname, st
int updated = 0;
statx sx2;
int change_uid, change_gid;
mode_t new_mode = file->mode;
if (!sxp) {
-@@ -311,18 +313,36 @@ int set_file_attrs(const char *fname, st
+@@ -310,18 +312,36 @@ int set_file_attrs(const char *fname, st
set_stat_xattr(fname, file);
#endif
+ /* This code must be the first update in the function due to
+ * how it uses the "updated" variable. */
- if (!preserve_times || (S_ISDIR(sxp->st.st_mode) && omit_dir_times))
+ if (!preserve_times || (S_ISDIR(sxp->st.st_mode) && preserve_times == 1))
flags |= ATTRS_SKIP_MTIME;
+ if (!preserve_atimes || S_ISDIR(sxp->st.st_mode))
+ flags |= ATTRS_SKIP_ATIME;
#define F_NDX(f) REQ_EXTRA(f, ic_ndx)->num
--- old/rsync.yo
+++ new/rsync.yo
-@@ -353,6 +353,7 @@ to the detailed description below for a
+@@ -354,6 +354,7 @@ to the detailed description below for a
-D same as --devices --specials
-t, --times preserve modification times
-O, --omit-dir-times omit directories from --times
--super receiver attempts super-user activities
--fake-super store/recover privileged attrs using xattrs
-S, --sparse handle sparse files efficiently
-@@ -930,6 +931,12 @@ it is preserving modification times (see
+@@ -940,6 +941,12 @@ it is preserving modification times (see
the directories on the receiving side, it is a good idea to use bf(-O).
This option is inferred if you use bf(--backup) without bf(--backup-dir).
dit(bf(--super)) This tells the receiving side to attempt super-user
activities even if the receiving rsync wasn't run by the super-user. These
activities include: preserving users via the bf(--owner) option, preserving
-@@ -1592,8 +1599,10 @@ quote(itemization(
+@@ -1602,8 +1609,10 @@ quote(itemization(
sender's value (requires bf(--owner) and super-user privileges).
it() A bf(g) means the group is different and is being updated to the
sender's value (requires bf(--group) and the authority to set the group).
--- old/backup.c
+++ new/backup.c
-@@ -28,10 +28,17 @@ extern int preserve_specials;
+@@ -29,10 +29,17 @@ extern int preserve_specials;
extern int preserve_links;
extern int safe_symlinks;
extern int backup_dir_len;
/* make a complete pathname for backup file */
char *get_backup_name(const char *fname)
-@@ -50,11 +57,28 @@ char *get_backup_name(const char *fname)
+@@ -51,11 +58,28 @@ char *get_backup_name(const char *fname)
return NULL;
}
if (!fnamebak)
return 0;
-@@ -95,7 +119,8 @@ static int make_bak_dir(char *fullpath)
+@@ -96,7 +120,8 @@ static int make_bak_dir(char *fullpath)
{
statx sx;
struct file_struct *file;
char *end = rel + strlen(rel);
char *p = end;
-@@ -198,7 +223,8 @@ static int keep_backup(const char *fname
+@@ -212,7 +237,8 @@ static int keep_backup(const char *fname
if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
return 1; /* the file could have disappeared */
unmake_file(file);
return 0;
}
-@@ -306,3 +332,13 @@ int make_backup(const char *fname)
+@@ -327,3 +353,13 @@ int make_backup(const char *fname)
return keep_backup(fname);
return make_simple_backup(fname);
}
+extern int backup_suffix_dels_len;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct filter_list_struct server_filter_list;
-
-@@ -127,10 +130,14 @@ enum delret {
+ #ifdef ICONV_OPTION
+@@ -131,10 +134,14 @@ enum delret {
static enum delret delete_dir_contents(char *fname, int flags);
}
/* Delete a file or directory. If DEL_RECURSE is set in the flags, this will
-@@ -166,9 +173,9 @@ static enum delret delete_item(char *fbu
+@@ -170,9 +177,9 @@ static enum delret delete_item(char *fbu
if (S_ISDIR(mode)) {
what = "rmdir";
ok = do_rmdir(fbuf) == 0;
ok = robust_unlink(fbuf) == 0;
--- old/options.c
+++ new/options.c
-@@ -137,10 +137,14 @@ int no_detach
+@@ -145,10 +145,14 @@ int no_detach
int write_batch = 0;
int read_batch = 0;
int backup_dir_len = 0;
char *tmpdir = NULL;
char *partial_dir = NULL;
char *basis_dir[MAX_BASIS_DIRS+1];
-@@ -152,7 +156,9 @@ char *stdout_format = NULL;
+@@ -160,7 +164,9 @@ char *stdout_format = NULL;
char *password_file = NULL;
char *rsync_path = RSYNC_PATH;
char *backup_dir = NULL;
char *sockopts = NULL;
int rsync_port = 0;
int compare_dest = 0;
-@@ -293,6 +299,8 @@ void usage(enum logcode F)
+@@ -316,6 +322,8 @@ void usage(enum logcode F)
rprintf(F," -b, --backup make backups (see --suffix & --backup-dir)\n");
rprintf(F," --backup-dir=DIR make backups into hierarchy based in DIR\n");
rprintf(F," --suffix=SUFFIX set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
rprintf(F," -u, --update skip files that are newer on the receiver\n");
rprintf(F," --inplace update destination files in-place (SEE MAN PAGE)\n");
rprintf(F," --append append data onto shorter files\n");
-@@ -527,7 +535,9 @@ static struct poptOption long_options[]
- {"bwlimit", 0, POPT_ARG_INT, &bwlimit, 0, 0, 0 },
- {"backup", 'b', POPT_ARG_NONE, &make_backups, 0, 0, 0 },
+@@ -583,7 +591,9 @@ static struct poptOption long_options[]
+ {"backup", 'b', POPT_ARG_VAL, &make_backups, 1, 0, 0 },
+ {"no-backup", 0, POPT_ARG_VAL, &make_backups, 0, 0, 0 },
{"backup-dir", 0, POPT_ARG_STRING, &backup_dir, 0, 0, 0 },
+ {"backup-dir-dels", 0, POPT_ARG_STRING, &backup_dir_dels, 0, 0, 0 },
{"suffix", 0, POPT_ARG_STRING, &backup_suffix, 0, 0, 0 },
{"list-only", 0, POPT_ARG_VAL, &list_only, 2, 0, 0 },
{"read-batch", 0, POPT_ARG_STRING, &batch_name, OPT_READ_BATCH, 0, 0 },
{"write-batch", 0, POPT_ARG_STRING, &batch_name, OPT_WRITE_BATCH, 0, 0 },
-@@ -1271,6 +1281,8 @@ int parse_arguments(int *argc, const cha
+@@ -1378,6 +1388,8 @@ int parse_arguments(int *argc, const cha
tmpdir = sanitize_path(NULL, tmpdir, NULL, 0, NULL);
if (backup_dir)
backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, NULL);
}
if (server_filter_list.head && !am_sender) {
struct filter_list_struct *elp = &server_filter_list;
-@@ -1288,6 +1300,14 @@ int parse_arguments(int *argc, const cha
+@@ -1395,6 +1407,14 @@ int parse_arguments(int *argc, const cha
if (check_filter(elp, backup_dir, 1) < 0)
goto options_rejected;
}
}
if (!backup_suffix)
-@@ -1299,6 +1319,16 @@ int parse_arguments(int *argc, const cha
+@@ -1406,6 +1426,16 @@ int parse_arguments(int *argc, const cha
backup_suffix);
return 0;
}
if (backup_dir) {
backup_dir_len = strlcpy(backup_dir_buf, backup_dir, sizeof backup_dir_buf);
backup_dir_remainder = sizeof backup_dir_buf - backup_dir_len;
-@@ -1322,6 +1352,31 @@ int parse_arguments(int *argc, const cha
+@@ -1429,6 +1459,31 @@ int parse_arguments(int *argc, const cha
"P *%s", backup_suffix);
parse_rule(&filter_list, backup_dir_buf, 0, 0);
}
+ "--suffix-dels cannot be a null string without --backup-dir-dels\n");
+ return 0;
+ }
- if (make_backups && !backup_dir)
- omit_dir_times = 1;
-@@ -1689,6 +1744,10 @@ void server_options(char **args,int *arg
+ if (make_backups && !backup_dir) {
+ omit_dir_times = 0; /* Implied, so avoid -O to sender. */
+@@ -1816,6 +1871,10 @@ void server_options(char **args,int *arg
args[ac++] = "--backup-dir";
args[ac++] = backup_dir;
}
/* Only send --suffix if it specifies a non-default value. */
if (strcmp(backup_suffix, backup_dir ? "" : BACKUP_SUFFIX) != 0) {
-@@ -1697,7 +1756,13 @@ void server_options(char **args,int *arg
+@@ -1824,7 +1883,13 @@ void server_options(char **args,int *arg
goto oom;
args[ac++] = arg;
}
+ args[ac++] = arg;
+ }
if (am_sender) {
- if (delete_before)
- args[ac++] = "--delete-before";
+ if (max_delete > 0) {
+ if (asprintf(&arg, "--max-delete=%d", max_delete) < 0)
extern int preserve_specials;
extern int preserve_hard_links;
extern int preserve_perms;
-@@ -1477,7 +1478,7 @@ static void recv_generator(char *fname,
+@@ -1476,7 +1477,7 @@ static void recv_generator(char *fname,
goto cleanup;
}
int preserve_links = 0;
int preserve_hard_links = 0;
int preserve_acls = 0;
-@@ -334,6 +335,7 @@ void usage(enum logcode F)
+@@ -340,6 +341,7 @@ void usage(enum logcode F)
rprintf(F," -o, --owner preserve owner (super-user only)\n");
rprintf(F," -g, --group preserve group\n");
rprintf(F," --devices preserve device files (super-user only)\n");
rprintf(F," --specials preserve special files\n");
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve modification times\n");
-@@ -488,6 +490,7 @@ static struct poptOption long_options[]
+@@ -494,6 +496,7 @@ static struct poptOption long_options[]
{"no-D", 0, POPT_ARG_NONE, 0, OPT_NO_D, 0, 0 },
{"devices", 0, POPT_ARG_VAL, &preserve_devices, 1, 0, 0 },
{"no-devices", 0, POPT_ARG_VAL, &preserve_devices, 0, 0, 0 },
{"specials", 0, POPT_ARG_VAL, &preserve_specials, 1, 0, 0 },
{"no-specials", 0, POPT_ARG_VAL, &preserve_specials, 0, 0, 0 },
{"links", 'l', POPT_ARG_VAL, &preserve_links, 1, 0, 0 },
-@@ -1944,6 +1947,9 @@ void server_options(char **args,int *arg
+@@ -1962,6 +1965,9 @@ void server_options(char **args,int *arg
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
--- old/rsync.c
+++ new/rsync.c
-@@ -34,6 +34,7 @@ extern int preserve_perms;
+@@ -33,6 +33,7 @@ extern int preserve_xattrs;
+ extern int preserve_perms;
extern int preserve_executability;
extern int preserve_times;
- extern int omit_dir_times;
+extern int copy_devices;
extern int am_root;
extern int am_server;
extern int am_sender;
-@@ -220,7 +221,8 @@ int read_ndx_and_attrs(int f_in, int *if
+@@ -219,7 +220,8 @@ int read_ndx_and_attrs(int f_in, int *if
if (iflags & ITEM_TRANSFER) {
int i = ndx - cur_flist->ndx_start;
--- old/generator.c
+++ new/generator.c
-@@ -44,6 +44,7 @@ extern int preserve_hard_links;
+@@ -43,6 +43,7 @@ extern int preserve_specials;
+ extern int preserve_hard_links;
extern int preserve_perms;
extern int preserve_times;
- extern int omit_dir_times;
+extern int omit_dir_changes;
extern int uid_ndx;
extern int gid_ndx;
extern int delete_mode;
-@@ -556,6 +557,7 @@ void itemize(const char *fnamecmp, struc
+@@ -555,6 +556,7 @@ void itemize(const char *fnamecmp, struc
int keep_time = !preserve_times ? 0
- : S_ISDIR(file->mode) ? !omit_dir_times
+ : S_ISDIR(file->mode) ? preserve_times > 1
: !S_ISLNK(file->mode);
+ int omit_changes = omit_dir_changes && S_ISDIR(sxp->st.st_mode);
if (S_ISREG(file->mode) && F_LENGTH(file) != sxp->st.st_size)
iflags |= ITEM_REPORT_SIZE;
-@@ -566,10 +568,11 @@ void itemize(const char *fnamecmp, struc
+@@ -565,10 +567,11 @@ void itemize(const char *fnamecmp, struc
iflags |= ITEM_REPORT_TIME;
if (!BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
iflags |= ITEM_REPORT_PERMS;
iflags |= ITEM_REPORT_GROUP;
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
-@@ -1229,7 +1232,7 @@ static void recv_generator(char *fname,
+@@ -1235,7 +1238,7 @@ static void recv_generator(char *fname,
statret = -1;
new_root_dir = 0;
}
}
--- old/options.c
+++ new/options.c
-@@ -56,6 +56,7 @@ int preserve_uid = 0;
+@@ -56,6 +56,7 @@ int preserve_specials = 0;
+ int preserve_uid = 0;
int preserve_gid = 0;
int preserve_times = 0;
- int omit_dir_times = 0;
+int omit_dir_changes = 0;
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -337,6 +338,7 @@ void usage(enum logcode F)
+@@ -344,6 +345,7 @@ void usage(enum logcode F)
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve modification times\n");
rprintf(F," -O, --omit-dir-times omit directories from --times\n");
rprintf(F," --super receiver attempts super-user activities\n");
#ifdef SUPPORT_XATTRS
rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
-@@ -472,6 +474,7 @@ static struct poptOption long_options[]
- {"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
- {"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
- {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 2, 0, 0 },
+@@ -480,6 +482,7 @@ static struct poptOption long_options[]
+ {"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 },
+ {"omit-dir-changes", 0, POPT_ARG_NONE, &omit_dir_changes, 0, 0, 0 },
{"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
{"super", 0, POPT_ARG_VAL, &am_root, 2, 0, 0 },
{"no-super", 0, POPT_ARG_VAL, &am_root, 0, 0, 0 },
-@@ -1413,6 +1416,9 @@ int parse_arguments(int *argc, const cha
- "P *%s", backup_suffix);
+@@ -1430,6 +1433,8 @@ int parse_arguments(int *argc, const cha
parse_rule(&filter_list, backup_dir_buf, 0, 0);
}
-+
-+ if (omit_dir_changes)
-+ omit_dir_times = 2;
- if (make_backups && !backup_dir)
- omit_dir_times = 1;
-@@ -1642,6 +1648,8 @@ void server_options(char **args,int *arg
++ if (omit_dir_changes)
++ omit_dir_times = 1;
+ if (make_backups && !backup_dir) {
+ omit_dir_times = 0; /* Implied, so avoid -O to sender. */
+ if (preserve_times > 1)
+@@ -1665,6 +1670,8 @@ void server_options(char **args,int *arg
argstr[x++] = 'm';
- if (omit_dir_times == 2)
+ if (omit_dir_times)
argstr[x++] = 'O';
+ if (omit_dir_changes == 1)
+ args[ac++] = "--omit-dir-changes";
argstr[x++] = 'L';
--- old/rsync.c
+++ new/rsync.c
-@@ -34,6 +34,7 @@ extern int preserve_perms;
+@@ -33,6 +33,7 @@ extern int preserve_xattrs;
+ extern int preserve_perms;
extern int preserve_executability;
extern int preserve_times;
- extern int omit_dir_times;
+extern int omit_dir_changes;
extern int am_root;
extern int am_server;
extern int am_sender;
-@@ -325,9 +326,11 @@ int set_file_attrs(const char *fname, st
+@@ -324,9 +325,11 @@ int set_file_attrs(const char *fname, st
updated = 1;
}