extern int preserve_devices;
extern int preserve_specials;
extern int preserve_hard_links;
+extern int preserve_executability;
extern int preserve_perms;
extern int preserve_times;
extern int uid_ndx;
if (preserve_perms && !BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
return 0;
+ if (preserve_executability && ((sxp->st.st_mode & 0111) != 0) ^ ((file->mode & 0111) != 0))
+ return 0;
+
if (am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file))
return 0;
;
} else
#endif
- if (!BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
+ if ((preserve_perms || preserve_executability)
+ && !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)
iflags |= ITEM_REPORT_OWNER;
goto try_a_copy;
if (preserve_hard_links && F_IS_HLINKED(file))
finish_hard_link(file, fname, ndx, &sxp->st, itemizing, code, j);
- if (itemizing && (verbose > 1 || stdout_format_has_i > 1)) {
+ if (!maybe_ATTRS_REPORT && (verbose > 1 || stdout_format_has_i > 1)) {
itemize(cmpbuf, file, ndx, 1, sxp,
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
0, "");
uchar fnamecmp_type;
int implied_dirs_are_missing = relative_paths && !implied_dirs && protocol_version < 30;
int del_opts = delete_mode || force_delete ? DEL_RECURSE : 0;
+ int is_dir = !S_ISDIR(file->mode) ? 0
+ : inc_recurse && ndx != cur_flist->ndx_start - 1 ? -1
+ : 1;
if (verbose > 2)
rprintf(FINFO, "recv_generator(%s,%d)\n", fname, ndx);
if (list_only) {
- if (S_ISDIR(file->mode)
- && ((!implied_dirs && file->flags & FLAG_IMPLIED_DIR)
- || (inc_recurse && ndx != cur_flist->ndx_start - 1)))
+ if (is_dir < 0
+ || (is_dir && !implied_dirs && file->flags & FLAG_IMPLIED_DIR))
return;
list_file_entry(file);
return;
}
if (server_filter_list.head) {
+ int filtered = check_filter(&server_filter_list, fname, is_dir) < 0;
+ if (is_dir < 0 && filtered)
+ return;
if (excluded_below >= 0) {
if (F_DEPTH(file) > excluded_below
&& (!implied_dirs_are_missing || f_name_has_prefix(file, excluded_dir)))
goto skipping;
excluded_below = -1;
}
- if (check_filter(&server_filter_list, fname,
- S_ISDIR(file->mode)) < 0) {
- if (S_ISDIR(file->mode)) {
+ if (filtered) {
+ if (is_dir) {
excluded_below = F_DEPTH(file);
excluded_dir = file;
}
dry_run--;
missing_below = -1;
} else if (!dry_run) {
- if (S_ISDIR(file->mode))
+ if (is_dir)
file->flags |= FLAG_MISSING_DIR;
return;
}
need_fuzzy_dirlist = 0;
}
- statret = link_stat(fname, &sx.st,
- keep_dirlinks && S_ISDIR(file->mode));
+ statret = link_stat(fname, &sx.st, keep_dirlinks && is_dir);
stat_errno = errno;
}
if (ignore_non_existing > 0 && statret == -1 && stat_errno == ENOENT) {
- if (verbose > 1) {
- rprintf(FINFO, "not creating new %s \"%s\"\n",
- S_ISDIR(file->mode) ? "directory" : "file",
- fname);
- }
- if (S_ISDIR(file->mode)) {
+ if (is_dir) {
+ if (is_dir < 0)
+ return;
if (missing_below < 0) {
if (dry_run)
dry_run++;
}
file->flags |= FLAG_MISSING_DIR;
}
+ if (verbose > 1) {
+ rprintf(FINFO, "not creating new %s \"%s\"\n",
+ is_dir ? "directory" : "file", fname);
+ }
return;
}
if (statret == 0 && sx.st.st_uid == our_uid)
del_opts |= DEL_OWNED_BY_US;
- if (S_ISDIR(file->mode)) {
+ if (is_dir) {
if (!implied_dirs && file->flags & FLAG_IMPLIED_DIR)
goto cleanup;
- if (inc_recurse && ndx != cur_flist->ndx_start - 1) {
+ if (is_dir < 0) {
/* In inc_recurse mode we want to make sure any missing
* directories get created while we're still processing
* the parent dir (which allows us to touch the parent