--- old/flist.c
+++ new/flist.c
-@@ -33,6 +33,7 @@ extern int am_sender;
+@@ -34,6 +34,7 @@ extern int am_generator;
extern int inc_recurse;
extern int do_progress;
extern int always_checksum;
extern int module_id;
extern int ignore_errors;
extern int numeric_ids;
-@@ -882,6 +883,15 @@ static struct file_struct *recv_file_ent
+@@ -948,6 +949,15 @@ static struct file_struct *recv_file_ent
memcpy(bp, F_SUM(first), checksum_len);
} else
read_buf(f, bp, checksum_len);
#ifdef SUPPORT_ACLS
--- old/generator.c
+++ new/generator.c
-@@ -73,6 +73,7 @@ extern int protocol_version;
+@@ -74,6 +74,7 @@ extern int protocol_version;
extern int file_total;
extern int fuzzy_basis;
extern int always_checksum;
extern int checksum_len;
extern char *partial_dir;
extern char *basis_dir[];
-@@ -590,7 +591,8 @@ void itemize(const char *fname, struct f
+@@ -618,7 +619,8 @@ void itemize(const char *fnamecmp, struc
/* Perform our quick-check heuristic for determining if a file is unchanged. */
{
if (st->st_size != F_LENGTH(file))
return 0;
-@@ -599,6 +601,8 @@ int unchanged_file(char *fn, struct file
+@@ -627,6 +629,8 @@ int unchanged_file(char *fn, struct file
of the file time to determine whether to sync */
if (always_checksum > 0 && S_ISREG(st->st_mode)) {
char sum[MAX_DIGEST_LEN];
file_checksum(fn, sum, st->st_size);
return memcmp(sum, F_SUM(file), checksum_len) == 0;
}
-@@ -819,7 +823,7 @@ static int try_dests_reg(struct file_str
+@@ -847,7 +851,7 @@ static int try_dests_reg(struct file_str
match_level = 1;
/* FALL THROUGH */
case 1:
continue;
best_match = j;
match_level = 2;
-@@ -1524,7 +1528,7 @@ static void recv_generator(char *fname,
+@@ -1559,7 +1563,7 @@ static void recv_generator(char *fname,
;
else if (fnamecmp_type == FNAMECMP_FUZZY)
;
handle_partial_dir(partialptr, PDIR_DELETE);
--- old/hlink.c
+++ new/hlink.c
-@@ -384,7 +384,7 @@ int hard_link_check(struct file_struct *
+@@ -393,7 +393,7 @@ int hard_link_check(struct file_struct *
}
break;
}
if (unchanged_attrs(cmpbuf, file, &alt_sx))
--- old/main.c
+++ new/main.c
-@@ -45,6 +45,7 @@ extern int module_id;
+@@ -46,6 +46,7 @@ extern int module_id;
extern int copy_links;
extern int copy_dirlinks;
extern int keep_dirlinks;
extern int preserve_hard_links;
extern int protocol_version;
extern int file_total;
-@@ -72,6 +73,9 @@ extern char *password_file;
+@@ -73,6 +74,9 @@ extern char *password_file;
extern char curr_dir[MAXPATHLEN];
extern struct filter_list_struct server_filter_list;
int local_server = 0;
int new_root_dir = 0;
mode_t orig_umask = 0;
-@@ -792,6 +796,7 @@ static void do_server_recv(int f_in, int
+@@ -793,6 +797,7 @@ static void do_server_recv(int f_in, int
struct file_list *flist;
char *local_name = NULL;
char *dir = NULL;
int save_verbose = verbose;
if (filesfrom_fd >= 0) {
-@@ -838,6 +843,10 @@ static void do_server_recv(int f_in, int
+@@ -839,6 +844,10 @@ static void do_server_recv(int f_in, int
filesfrom_fd = -1;
}
flist = recv_file_list(f_in);
if (!flist) {
rprintf(FERROR,"server_recv: recv_file_list error\n");
-@@ -847,6 +856,9 @@ static void do_server_recv(int f_in, int
+@@ -848,6 +857,9 @@ static void do_server_recv(int f_in, int
recv_additional_file_list(f_in);
verbose = save_verbose;
if (argc > 0)
local_name = get_local_name(flist,argv[0]);
-@@ -926,6 +938,7 @@ int client_run(int f_in, int f_out, pid_
+@@ -927,6 +939,7 @@ int client_run(int f_in, int f_out, pid_
{
struct file_list *flist = NULL;
int exit_code = 0, exit_code2 = 0;
char *local_name = NULL;
cleanup_child_pid = pid;
-@@ -1006,12 +1019,19 @@ int client_run(int f_in, int f_out, pid_
+@@ -1007,12 +1020,19 @@ int client_run(int f_in, int f_out, pid_
filesfrom_fd = -1;
}
--- old/rsync.h
+++ new/rsync.h
-@@ -70,6 +70,7 @@
- #define FLAG_HLINK_LAST (1<<7) /* receiver/generator */
+@@ -72,6 +72,7 @@
#define FLAG_HLINK_DONE (1<<8) /* receiver/generator */
#define FLAG_LENGTH64 (1<<9) /* sender/receiver/generator */
-+#define FLAG_SUM_DIFFERS (1<<10)/* receiver/generator */
+ #define FLAG_SKIP_GROUP (1<<10) /* receiver/generator */
++#define FLAG_SUM_DIFFERS (1<<11)/* receiver/generator */
/* These flags are passed to functions but not stored. */
--- old/generator.c
+++ new/generator.c
-@@ -45,6 +45,7 @@ extern int preserve_uid;
+@@ -46,6 +46,7 @@ extern int preserve_uid;
extern int preserve_gid;
extern int preserve_times;
extern int omit_dir_times;
extern int delete_mode;
extern int delete_before;
extern int delete_during;
-@@ -544,6 +545,7 @@ void itemize(const char *fname, struct f
+@@ -555,6 +556,7 @@ void itemize(const char *fnamecmp, struc
int keep_time = !preserve_times ? 0
: S_ISDIR(file->mode) ? !omit_dir_times
: !S_ISLNK(file->mode);
if (S_ISREG(file->mode) && F_LENGTH(file) != sxp->st.st_size)
iflags |= ITEM_REPORT_SIZE;
-@@ -554,10 +556,11 @@ void itemize(const char *fname, struct f
+@@ -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;
-- if (preserve_uid && am_root && F_UID(file) != sxp->st.st_uid)
+- if (preserve_uid && am_root && F_OWNER(file) != sxp->st.st_uid)
+ if (preserve_uid && am_root && !omit_changes
-+ && F_UID(file) != sxp->st.st_uid)
++ && F_OWNER(file) != sxp->st.st_uid)
iflags |= ITEM_REPORT_OWNER;
-- if (preserve_gid && F_GID(file) != GID_NONE
-- && sxp->st.st_gid != F_GID(file))
+- if (preserve_gid && !(file->flags & FLAG_SKIP_GROUP)
+- && sxp->st.st_gid != F_GROUP(file))
+ if (preserve_gid && !omit_changes
-+ && F_GID(file) != GID_NONE && sxp->st.st_gid != F_GID(file))
++ && !(file->FLAG_SKIP_GROUP) && sxp->st.st_gid != F_GROUP(file))
iflags |= ITEM_REPORT_GROUP;
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
-@@ -1193,7 +1196,7 @@ static void recv_generator(char *fname,
+@@ -1228,7 +1231,7 @@ static void recv_generator(char *fname,
statret = -1;
new_root_dir = 0;
}
}
--- old/options.c
+++ new/options.c
-@@ -55,6 +55,7 @@ int preserve_uid = 0;
+@@ -56,6 +56,7 @@ int preserve_uid = 0;
int preserve_gid = 0;
int preserve_times = 0;
int omit_dir_times = 0;
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -317,6 +318,7 @@ void usage(enum logcode F)
+@@ -336,6 +337,7 @@ void usage(enum logcode F)
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve times\n");
rprintf(F," -O, --omit-dir-times omit directories when preserving times\n");
+ rprintf(F," --omit-dir-changes omit directories when preserving any attributes\n");
rprintf(F," --super receiver attempts super-user activities\n");
- rprintf(F," -S, --sparse handle sparse files efficiently\n");
- rprintf(F," -n, --dry-run show what would have been transferred\n");
-@@ -437,6 +439,7 @@ static struct poptOption long_options[]
+ #ifdef SUPPORT_XATTRS
+ rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
+@@ -469,6 +471,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 },
{"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 },
-@@ -1322,6 +1325,9 @@ int parse_arguments(int *argc, const cha
+@@ -1397,6 +1400,9 @@ int parse_arguments(int *argc, const cha
"P *%s", backup_suffix);
parse_rule(&filter_list, backup_dir_buf, 0, 0);
}
if (make_backups && !backup_dir)
omit_dir_times = 1;
-@@ -1551,6 +1557,8 @@ void server_options(char **args,int *arg
+@@ -1626,6 +1632,8 @@ void server_options(char **args,int *arg
argstr[x++] = 'm';
if (omit_dir_times == 2)
argstr[x++] = 'O';
argstr[x++] = 'L';
--- old/rsync.c
+++ new/rsync.c
-@@ -36,6 +36,7 @@ extern int preserve_perms;
+@@ -34,6 +34,7 @@ extern int preserve_perms;
extern int preserve_executability;
extern int preserve_times;
extern int omit_dir_times;
extern int am_root;
extern int am_server;
extern int am_sender;
-@@ -275,9 +276,11 @@ int set_file_attrs(char *fname, struct f
+@@ -322,9 +323,11 @@ int set_file_attrs(const char *fname, st
updated = 1;
}
-- change_uid = am_root && preserve_uid && sxp->st.st_uid != F_UID(file);
-+ change_uid = am_root && preserve_uid && sxp->st.st_uid != F_UID(file)
-+ && !(omit_dir_changes && S_ISDIR(sxp->st.st_mode));
- change_gid = preserve_gid && F_GID(file) != GID_NONE
-- && sxp->st.st_gid != F_GID(file);
-+ && sxp->st.st_gid != F_GID(file)
-+ && !(omit_dir_changes && S_ISDIR(sxp->st.st_mode));
+- change_uid = am_root && preserve_uid && sxp->st.st_uid != F_OWNER(file);
++ change_uid = am_root && preserve_uid && sxp->st.st_uid != F_OWNER(file)
++ && !(omit_dir_changes && S_ISDIR(sxp->st.st_mode));
+ change_gid = preserve_gid && !(file->flags & FLAG_SKIP_GROUP)
+- && sxp->st.st_gid != F_GROUP(file);
++ && sxp->st.st_gid != F_GROUP(file)
++ && !(omit_dir_changes && S_ISDIR(sxp->st.st_mode));
#if !defined HAVE_LCHOWN && !defined CHOWN_MODIFIES_SYMLINK
if (S_ISLNK(sxp->st.st_mode))
;