+#endif /* SUPPORT_ACLS */
--- old/backup.c
+++ new/backup.c
-@@ -135,6 +135,7 @@ static int make_bak_dir(char *fullpath)
+@@ -132,6 +132,7 @@ static int make_bak_dir(char *fullpath)
} else {
do_lchown(fullpath, st.st_uid, st.st_gid);
do_chmod(fullpath, st.st_mode);
}
}
*p = '/';
-@@ -188,6 +189,8 @@ static int keep_backup(char *fname)
+@@ -185,6 +186,8 @@ static int keep_backup(char *fname)
if (!(buf = get_backup_name(fname)))
return 0;
/* Check to see if this is a device file, or link */
if ((am_root && preserve_devices && IS_DEVICE(file->mode))
|| (preserve_specials && IS_SPECIAL(file->mode))) {
-@@ -263,6 +266,7 @@ static int keep_backup(char *fname)
+@@ -260,6 +263,7 @@ static int keep_backup(char *fname)
}
}
set_file_attrs(buf, file, NULL, 0);
--- old/flist.c
+++ new/flist.c
-@@ -967,6 +967,8 @@ static struct file_struct *send_file_nam
+@@ -966,6 +966,8 @@ static struct file_struct *send_file_nam
f == -2 ? SERVER_FILTERS : ALL_FILTERS);
if (!file)
return NULL;
if (chmod_modes && !S_ISLNK(file->mode))
file->mode = tweak_mode(file->mode, chmod_modes);
-@@ -978,6 +980,10 @@ static struct file_struct *send_file_nam
+@@ -977,6 +979,10 @@ static struct file_struct *send_file_nam
if (file->basename[0]) {
flist->files[flist->count++] = file;
send_file_entry(file, f);
}
return file;
}
-@@ -1366,6 +1372,8 @@ struct file_list *recv_file_list(int f)
+@@ -1365,6 +1371,8 @@ struct file_list *recv_file_list(int f)
flags |= read_byte(f) << 8;
file = receive_file_entry(flist, flags, f);
if (S_ISREG(file->mode) || S_ISLNK(file->mode))
stats.total_size += file->length;
-@@ -1388,6 +1396,8 @@ struct file_list *recv_file_list(int f)
+@@ -1387,6 +1395,8 @@ struct file_list *recv_file_list(int f)
clean_flist(flist, relative_paths, 1);
--- old/generator.c
+++ new/generator.c
-@@ -755,6 +755,7 @@ static int try_dests_non(struct file_str
+@@ -85,6 +85,7 @@ extern long block_size; /* "long" becaus
+ extern int max_delete;
+ extern int force_delete;
+ extern int one_file_system;
++extern mode_t orig_umask;
+ extern struct stats stats;
+ extern dev_t filesystem_dev;
+ extern char *backup_dir;
+@@ -753,6 +754,7 @@ static int try_dests_non(struct file_str
}
static int phase = 0;
/* 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
-@@ -773,6 +774,7 @@ static void recv_generator(char *fname,
- static int missing_below = -1, excluded_below = -1;
- static char *parent_dirname = "";
- static struct file_list *fuzzy_dirlist = NULL;
-+ static struct file_list *need_dirlist = (struct file_list *)"";
- struct file_struct *fuzzy_file = NULL;
- int fd = -1, f_copy = -1;
- STRUCT_STAT st, real_st, partial_st;
-@@ -790,12 +792,12 @@ static void recv_generator(char *fname,
- if (fuzzy_dirlist) {
- flist_free(fuzzy_dirlist);
- fuzzy_dirlist = NULL;
-- parent_dirname = "";
- }
- if (missing_below >= 0) {
- dry_run--;
- missing_below = -1;
- }
-+ parent_dirname = "";
- return;
- }
-
-@@ -830,18 +832,31 @@ static void recv_generator(char *fname,
- statret = -1;
- stat_errno = ENOENT;
- } else {
-- if (fuzzy_basis && S_ISREG(file->mode)) {
-+ if (fuzzy_basis
-+#ifdef SUPPORT_ACLS
-+ || !preserve_perms
-+#endif
-+ ) {
- char *dn = file->dirname ? file->dirname : ".";
- if (parent_dirname != dn
- && strcmp(parent_dirname, dn) != 0) {
- if (fuzzy_dirlist)
- flist_free(fuzzy_dirlist);
-- if (implied_dirs || stat(dn, &st) == 0)
-- fuzzy_dirlist = get_dirlist(dn, -1, 1);
-- else
-+ if (implied_dirs || stat(dn, &st) == 0) {
-+ if (fuzzy_basis)
-+ fuzzy_dirlist = need_dirlist;
+@@ -844,6 +846,10 @@ static void recv_generator(char *fname,
+ }
+ if (fuzzy_basis)
+ need_fuzzy_dirlist = 1;
+#ifdef SUPPORT_ACLS
-+ if (!preserve_perms)
-+ dflt_perms = default_perms_for_dir(dn);
++ if (!preserve_perms)
++ dflt_perms = default_perms_for_dir(dn);
+#endif
-+ } else {
- fuzzy_dirlist = NULL;
-+ dflt_perms = ~orig_umask;
-+ }
- }
- parent_dirname = dn;
-+ if (fuzzy_dirlist == need_dirlist && S_ISREG(file->mode))
-+ fuzzy_dirlist = get_dirlist(dn, -1, 1);
}
+ parent_dirname = dn;
- statret = link_stat(fname, &st,
-@@ -863,7 +878,8 @@ static void recv_generator(char *fname,
+@@ -871,7 +877,8 @@ static void recv_generator(char *fname,
if (!preserve_perms) {
int exists = statret == 0
&& S_ISDIR(st.st_mode) == S_ISDIR(file->mode);
}
if (S_ISDIR(file->mode)) {
-@@ -897,6 +913,10 @@ static void recv_generator(char *fname,
+@@ -905,6 +912,10 @@ static void recv_generator(char *fname,
if (set_file_attrs(fname, file, statret ? NULL : &st, 0)
&& verbose && code && f_out != -1)
rprintf(code, "%s/\n", fname);
if (delete_during && f_out != -1 && !phase && dry_run < 2
&& (file->flags & FLAG_DEL_HERE))
delete_in_dir(the_file_list, fname, file, &st);
-@@ -1334,6 +1354,8 @@ void generate_files(int f_out, struct fi
+@@ -1342,6 +1353,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;
--- old/options.c
+++ new/options.c
-@@ -44,6 +44,7 @@ int keep_dirlinks = 0;
+@@ -45,6 +45,7 @@ int copy_dirlinks = 0;
int copy_links = 0;
int preserve_links = 0;
int preserve_hard_links = 0;
/* Note that this field may not have type ino_t. It depends
* on the complicated interaction between largefile feature
-@@ -294,6 +300,9 @@ void usage(enum logcode F)
- rprintf(F," -K, --keep-dirlinks treat symlinked dir on receiver as dir\n");
+@@ -295,6 +301,9 @@ void usage(enum logcode F)
+ rprintf(F," -H, --hard-links preserve hard links\n");
rprintf(F," -p, --perms preserve permissions\n");
rprintf(F," -E, --executability preserve the file's executability\n");
+#ifdef SUPPORT_ACLS
rprintf(F," --chmod=CHMOD change destination permissions\n");
rprintf(F," -o, --owner preserve owner (super-user only)\n");
rprintf(F," -g, --group preserve group\n");
-@@ -409,6 +418,9 @@ static struct poptOption long_options[]
+@@ -410,6 +419,9 @@ static struct poptOption long_options[]
{"no-perms", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
{"no-p", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
{"executability", 'E', POPT_ARG_NONE, &preserve_executability, 0, 0, 0 },
{"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 },
{"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
{"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
-@@ -1063,6 +1075,23 @@ int parse_arguments(int *argc, const cha
+@@ -1068,6 +1080,23 @@ int parse_arguments(int *argc, const cha
usage(FINFO);
exit_cleanup(0);
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1503,6 +1532,10 @@ void server_options(char **args,int *arg
+@@ -1511,6 +1540,10 @@ void server_options(char **args,int *arg
if (preserve_hard_links)
argstr[x++] = 'H';
if (preserve_gid)
--- old/receiver.c
+++ new/receiver.c
-@@ -349,6 +349,10 @@ int recv_files(int f_in, struct file_lis
+@@ -46,6 +46,7 @@ extern int keep_partial;
+ extern int checksum_seed;
+ extern int inplace;
+ extern int delay_updates;
++extern mode_t orig_umask;
+ extern struct stats stats;
+ extern char *log_format;
+ extern char *tmpdir;
+@@ -344,6 +345,10 @@ int recv_files(int f_in, struct file_lis
int itemizing = am_daemon ? daemon_log_format_has_i
: !am_server && log_format_has_i;
int max_phase = protocol_version >= 29 ? 2 : 1;
int i, recv_ok;
if (verbose > 2)
-@@ -546,7 +550,16 @@ int recv_files(int f_in, struct file_lis
+@@ -541,7 +546,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;
? FCLIENT : FINFO;
--- old/rsync.h
+++ new/rsync.h
-@@ -657,6 +657,44 @@ struct chmod_mode_struct;
+@@ -658,6 +658,44 @@ struct chmod_mode_struct;
#define UNUSED(x) x __attribute__((__unused__))
/* We have replacement versions of these if they're missing. */
--- old/rsync.yo
+++ new/rsync.yo
-@@ -319,6 +319,7 @@ to the detailed description below for a
- -K, --keep-dirlinks treat symlinked dir on receiver as dir
+@@ -321,6 +321,7 @@ to the detailed description below for a
+ -H, --hard-links preserve hard links
-p, --perms preserve permissions
-E, --executability preserve executability
+ -A, --acls preserve ACLs (implies -p) [non-standard]
--chmod=CHMOD change destination permissions
-o, --owner preserve owner (super-user only)
-g, --group preserve group
-@@ -705,7 +706,9 @@ quote(itemize(
+@@ -742,7 +743,9 @@ quote(itemize(
permissions, though the bf(--executability) option might change just
the execute permission for the file.
it() New files get their "normal" permission bits set to the source
their special permission bits disabled except in the case where a new
directory inherits a setgid bit from its parent directory.
))
-@@ -736,9 +739,11 @@ The preservation of the destination's se
+@@ -773,9 +776,11 @@ The preservation of the destination's se
directories when bf(--perms) is off was added in rsync 2.6.7. Older rsync
versions erroneously preserved the three special permission bits for
newly-created files when bf(--perms) was off, while overriding the
dit(bf(-E, --executability)) This option causes rsync to preserve the
executability (or non-executability) of regular files when bf(--perms) is
-@@ -756,6 +761,10 @@ quote(itemize(
+@@ -793,6 +798,10 @@ quote(itemize(
If bf(--perms) is enabled, this option is ignored.
+ $RSYNC -rvv "$scratchdir/file" "$todir/to/anotherfile"
+ check_perms "$todir/to/anotherfile" $3 "Target $1"
+ # Make sure we obey default ACLs when not transferring a regular file
-+ $RSYNC -rvv "$scratchdir/dir" "$todir/to/anotherdir"
++ $RSYNC -rvv "$scratchdir/dir/" "$todir/to/anotherdir/"
+ check_perms "$todir/to/anotherdir" $4 "Target $1"
+}
+