./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/acls.c b/acls.c
--- a/acls.c
+++ b/acls.c
static int calc_sacl_entries(const rsync_acl *racl)
{
/* A System ACL always gets user/group/other permission entries. */
-@@ -581,6 +594,96 @@ int get_acl(const char *fname, stat_x *sxp)
+@@ -579,6 +592,96 @@ int get_acl(const char *fname, stat_x *sxp)
return 0;
}
/* === Send functions === */
/* Send the ida list over the file descriptor. */
-@@ -656,6 +759,11 @@ static void send_rsync_acl(int f, rsync_acl *racl, SMB_ACL_TYPE_T type,
+@@ -654,6 +757,11 @@ static void send_rsync_acl(int f, rsync_acl *racl, SMB_ACL_TYPE_T type,
* This also frees the ACL data. */
void send_acl(int f, stat_x *sxp)
{
if (!sxp->acc_acl) {
sxp->acc_acl = create_racl();
rsync_acl_fake_perms(sxp->acc_acl, sxp->st.st_mode);
-@@ -673,6 +781,160 @@ void send_acl(int f, stat_x *sxp)
+@@ -671,6 +779,160 @@ void send_acl(int f, stat_x *sxp)
}
}
/* === Receive functions === */
static uint32 recv_acl_access(int f, uchar *name_follows_ptr)
-@@ -794,6 +1056,11 @@ static int recv_rsync_acl(int f, item_list *racl_list, SMB_ACL_TYPE_T type, mode
+@@ -792,6 +1054,11 @@ static int recv_rsync_acl(int f, item_list *racl_list, SMB_ACL_TYPE_T type, mode
/* Receive the ACL info the sender has included for this file-list entry. */
void receive_acl(int f, struct file_struct *file)
{
diff --git a/compat.c b/compat.c
--- a/compat.c
+++ b/compat.c
-@@ -529,13 +529,6 @@ void setup_protocol(int f_out,int f_in)
- if (protocol_version < 30) {
- if (append_mode == 1)
- append_mode = 2;
-- if (preserve_acls && !local_server) {
-- rprintf(FERROR,
-- "--acls requires protocol 30 or higher"
-- " (negotiated %d).\n",
-- protocol_version);
-- exit_cleanup(RERR_PROTOCOL);
-- }
+@@ -536,6 +536,13 @@ void setup_protocol(int f_out,int f_in)
+ protocol_version);
+ exit_cleanup(RERR_PROTOCOL);
+ }
++ if (preserve_acls && !local_server) {
++ rprintf(FERROR,
++ "--acls requires protocol 30 or higher"
++ " (negotiated %d).\n",
++ protocol_version);
++ exit_cleanup(RERR_PROTOCOL);
++ }
if (preserve_xattrs && !local_server) {
rprintf(FERROR,
- "--xattrs requires protocol 30 or higher"
+ "--xattrs requires protocol 30 or higher"
Fix a bug that could lose some bits when stripping some (supposedly)
superfluous ACL info.
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/lib/sysacls.c b/lib/sysacls.c
--- a/lib/sysacls.c
+++ b/lib/sysacls.c
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
-@@ -1819,7 +1819,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1808,7 +1808,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto notify_others;
if (read_batch || whole_file) {
if (!(backupptr = get_backup_name(fname)))
goto cleanup;
if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
-@@ -1855,7 +1855,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1844,7 +1844,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto notify_others;
}
if (!(backupptr = get_backup_name(fname))) {
close(fd);
goto cleanup;
-@@ -1979,7 +1979,7 @@ int atomic_create(struct file_struct *file, char *fname, const char *slnk, const
+@@ -1968,7 +1968,7 @@ int atomic_create(struct file_struct *file, char *fname, const char *slnk, const
skip_atomic = 0;
if (del_for_flag) {
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -923,7 +923,8 @@ static struct poptOption long_options[] = {
+@@ -922,7 +922,8 @@ static struct poptOption long_options[] = {
{"no-i", 0, POPT_ARG_VAL, &itemize_changes, 0, 0, 0 },
{"bwlimit", 0, POPT_ARG_STRING, &bwlimit_arg, OPT_BWLIMIT, 0, 0 },
{"no-bwlimit", 0, POPT_ARG_VAL, &bwlimit, 0, 0, 0 },
{"no-backup", 0, POPT_ARG_VAL, &make_backups, 0, 0, 0 },
{"backup-dir", 0, POPT_ARG_STRING, &backup_dir, 0, 0, 0 },
{"suffix", 0, POPT_ARG_STRING, &backup_suffix, 0, 0, 0 },
-@@ -2677,6 +2678,10 @@ void server_options(char **args, int *argc_p)
+@@ -2672,6 +2673,10 @@ void server_options(char **args, int *argc_p)
}
if (am_sender) {
diff --git a/rsync.c b/rsync.c
--- a/rsync.c
+++ b/rsync.c
-@@ -709,7 +709,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -708,7 +708,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
goto do_set_file_attrs;
}
char *sockopts = NULL;
char *usermap = NULL;
char *groupmap = NULL;
-@@ -927,7 +933,9 @@ static struct poptOption long_options[] = {
+@@ -926,7 +932,9 @@ static struct poptOption long_options[] = {
{"backup-deleted", 0, 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 },
{"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 },
-@@ -2142,6 +2150,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2137,6 +2145,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
tmpdir = sanitize_path(NULL, tmpdir, NULL, 0, SP_DEFAULT);
if (backup_dir)
backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, SP_DEFAULT);
}
if (daemon_filter_list.head && !am_sender) {
filter_rule_list *elp = &daemon_filter_list;
-@@ -2163,6 +2173,14 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2158,6 +2168,14 @@ int parse_arguments(int *argc_p, const char ***argv_p)
if (check_filter(elp, FLOG, dir, 1) < 0)
goto options_rejected;
}
}
if (!backup_suffix)
-@@ -2174,6 +2192,20 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2169,6 +2187,20 @@ int parse_arguments(int *argc_p, const char ***argv_p)
backup_suffix);
return 0;
}
if (backup_dir) {
size_t len;
while (*backup_dir == '.' && backup_dir[1] == '/')
-@@ -2209,6 +2241,34 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2204,6 +2236,34 @@ int parse_arguments(int *argc_p, const char ***argv_p)
"P *%s", backup_suffix);
parse_filter_str(&filter_list, backup_dir_buf, rule_template(0), 0);
}
if (preserve_times) {
preserve_times = PRESERVE_FILE_TIMES;
-@@ -2652,6 +2712,10 @@ void server_options(char **args, int *argc_p)
+@@ -2647,6 +2707,10 @@ void server_options(char **args, int *argc_p)
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) {
-@@ -2660,6 +2724,14 @@ void server_options(char **args, int *argc_p)
+@@ -2655,6 +2719,14 @@ void server_options(char **args, int *argc_p)
goto oom;
args[ac++] = arg;
}
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/errcode.h b/errcode.h
--- a/errcode.h
+++ b/errcode.h
diff --git a/main.c b/main.c
--- a/main.c
+++ b/main.c
-@@ -207,8 +207,11 @@ static void wait_process_with_flush(pid_t pid, int *exit_code_ptr)
+@@ -208,8 +208,11 @@ static void wait_process_with_flush(pid_t pid, int *exit_code_ptr)
*exit_code_ptr = RERR_TERMINATED;
else
*exit_code_ptr = RERR_WAITCHILD;
}
void write_del_stats(int f)
-@@ -1590,6 +1593,14 @@ void remember_children(UNUSED(int val))
+@@ -1592,6 +1595,14 @@ void remember_children(UNUSED(int val))
break;
}
}
}
#endif
#ifndef HAVE_SIGACTION
-@@ -1645,6 +1656,12 @@ static void rsync_panic_handler(UNUSED(int whatsig))
+@@ -1647,6 +1658,12 @@ static void rsync_panic_handler(UNUSED(int whatsig))
}
#endif
int main(int argc,char *argv[])
{
-@@ -1669,6 +1686,11 @@ int main(int argc,char *argv[])
+@@ -1671,6 +1688,11 @@ int main(int argc,char *argv[])
SIGACTMASK(SIGFPE, rsync_panic_handler);
SIGACTMASK(SIGABRT, rsync_panic_handler);
SIGACTMASK(SIGBUS, rsync_panic_handler);
diff --git a/socket.c b/socket.c
--- a/socket.c
+++ b/socket.c
-@@ -532,7 +532,17 @@ int is_a_socket(int fd)
+@@ -526,7 +526,17 @@ int is_a_socket(int fd)
static void sigchld_handler(UNUSED(int val))
{
#ifdef WNOHANG
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/clientserver.c b/clientserver.c
--- a/clientserver.c
+++ b/clientserver.c
extern int io_timeout;
extern int no_detach;
extern int write_batch;
-@@ -975,6 +977,9 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
+@@ -974,6 +976,9 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
} else if (am_root < 0) /* Treat --fake-super from client as --super. */
am_root = 2;
extern int remove_source_files;
extern int delay_updates;
extern int update_only;
-@@ -584,7 +585,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -580,7 +581,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
/* Perform our quick-check heuristic for determining if a file is unchanged. */
{
if (st->st_size != F_LENGTH(file))
return 0;
-@@ -593,7 +594,10 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
+@@ -589,7 +590,10 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
of the file time to determine whether to sync */
if (always_checksum > 0 && S_ISREG(st->st_mode)) {
char sum[MAX_DIGEST_LEN];
return memcmp(sum, F_SUM(file), flist_csum_len) == 0;
}
-@@ -890,7 +894,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
+@@ -886,7 +890,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
best_match = j;
match_level = 1;
}
continue;
if (match_level == 1) {
best_match = j;
-@@ -1201,7 +1205,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1197,7 +1201,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
* --ignore-non-existing, daemon exclude, or mkdir failure. */
static struct file_struct *skip_dir = NULL;
static struct file_list *fuzzy_dirlist[MAX_BASIS_DIRS+1];
struct file_struct *fuzzy_file = NULL;
int fd = -1, f_copy = -1;
stat_x sx, real_sx;
-@@ -1312,8 +1316,9 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1308,8 +1312,9 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
fuzzy_dirlist[i] = NULL;
}
}
#ifdef SUPPORT_ACLS
if (!preserve_perms)
dflt_perms = default_perms_for_dir(dn);
-@@ -1321,6 +1326,24 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1317,6 +1322,24 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
}
parent_dirname = dn;
statret = link_stat(fname, &sx.st, keep_dirlinks && is_dir);
stat_errno = errno;
}
-@@ -1731,22 +1754,6 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1720,22 +1743,6 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
partialptr = NULL;
if (statret != 0 && fuzzy_basis) {
/* Sets fnamecmp_type to FNAMECMP_FUZZY or above. */
fuzzy_file = find_fuzzy(file, fuzzy_dirlist, &fnamecmp_type);
if (fuzzy_file) {
-@@ -1779,7 +1786,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1768,7 +1775,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
;
else if (fnamecmp_type >= FNAMECMP_FUZZY)
;
diff --git a/hlink.c b/hlink.c
--- a/hlink.c
+++ b/hlink.c
-@@ -410,7 +410,7 @@ int hard_link_check(struct file_struct *file, int ndx, char *fname,
+@@ -408,7 +408,7 @@ int hard_link_check(struct file_struct *file, int ndx, char *fname,
}
break;
}
int max_delete = INT_MIN;
OFF_T max_size = -1;
OFF_T min_size = -1;
-@@ -736,7 +737,7 @@ enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+@@ -735,7 +736,7 @@ enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT,
OPT_OLD_COMPRESS, OPT_NEW_COMPRESS, OPT_NO_COMPRESS,
OPT_REFUSED_BASE = 9000};
-@@ -887,6 +888,7 @@ static struct poptOption long_options[] = {
+@@ -886,6 +887,7 @@ static struct poptOption long_options[] = {
{"no-c", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
{"checksum-choice", 0, POPT_ARG_STRING, &checksum_choice, 0, 0, 0 },
{"cc", 0, POPT_ARG_STRING, &checksum_choice, 0, 0, 0 },
{"block-size", 'B', POPT_ARG_LONG, &block_size, 0, 0, 0 },
{"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
{"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
-@@ -1725,6 +1727,23 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1720,6 +1722,23 @@ int parse_arguments(int *argc_p, const char ***argv_p)
}
break;
case OPT_INFO:
arg = poptGetOptArg(pc);
parse_output_words(info_words, info_levels, arg, USER_PRIORITY);
-@@ -1994,6 +2013,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1989,6 +2008,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
}
#endif
static const char *solo_file = NULL;
enum nonregtype {
-@@ -595,7 +596,7 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st, int slot
+@@ -591,7 +592,7 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st, int slot
if (always_checksum > 0 && S_ISREG(st->st_mode)) {
char sum[MAX_DIGEST_LEN];
if (checksum_files && slot >= 0)
else
file_checksum(fn, st, sum);
return memcmp(sum, F_SUM(file), flist_csum_len) == 0;
-@@ -1339,7 +1340,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1335,7 +1336,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
}
}
if (checksum_files) {
}
need_new_dirscan = 0;
}
-@@ -1513,6 +1515,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1506,6 +1508,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
else
change_local_filter_dir(fname, strlen(fname), F_DEPTH(file));
}
prior_dir_file = file;
goto cleanup;
}
-@@ -1792,6 +1795,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1781,6 +1784,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
handle_partial_dir(partialptr, PDIR_DELETE);
}
set_file_attrs(fname, file, &sx, NULL, maybe_ATTRS_REPORT | maybe_ATTRS_ACCURATE_TIME);
if (itemizing)
itemize(fnamecmp, file, ndx, statret, &sx, 0, 0, NULL);
#ifdef SUPPORT_HARD_LINKS
-@@ -2290,6 +2295,7 @@ void generate_files(int f_out, const char *local_name)
+@@ -2279,6 +2284,7 @@ void generate_files(int f_out, const char *local_name)
} else
change_local_filter_dir(fbuf, strlen(fbuf), F_DEPTH(fp));
}
}
for (i = cur_flist->low; i <= cur_flist->high; i++) {
struct file_struct *file = cur_flist->sorted[i];
-@@ -2384,6 +2390,9 @@ void generate_files(int f_out, const char *local_name)
+@@ -2373,6 +2379,9 @@ void generate_files(int f_out, const char *local_name)
wait_for_receiver();
}
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -1729,7 +1729,15 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1724,7 +1724,15 @@ int parse_arguments(int *argc_p, const char ***argv_p)
case OPT_SUMFILES:
arg = poptGetOptArg(pc);
|| (preserve_hard_links && F_IS_HLINKED(file)))
send_msg_int(MSG_SUCCESS, ndx);
handle_partial_dir(partialptr, PDIR_DELETE);
-@@ -908,7 +909,7 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -906,7 +907,7 @@ int recv_files(int f_in, int f_out, char *local_name)
case 2:
break;
case 1:
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
-@@ -593,7 +593,8 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
+@@ -589,7 +589,8 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
of the file time to determine whether to sync */
if (always_checksum > 0 && S_ISREG(st->st_mode)) {
char sum[MAX_DIGEST_LEN];
extern int saw_xattr_filter;
#define RSYNC_XAL_INITIAL 5
-@@ -73,6 +75,10 @@ extern int saw_xattr_filter;
+@@ -72,6 +74,10 @@ extern int saw_xattr_filter;
#define XACC_ACL_ATTR RSYNC_PREFIX "%" XACC_ACL_SUFFIX
#define XDEF_ACL_SUFFIX "dacl"
#define XDEF_ACL_ATTR RSYNC_PREFIX "%" XDEF_ACL_SUFFIX
typedef struct {
char *datum, *name;
-@@ -266,7 +272,9 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
+@@ -264,7 +270,9 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
|| (am_root < 0
&& (strcmp(name+RPRE_LEN+1, XSTAT_SUFFIX) == 0
|| strcmp(name+RPRE_LEN+1, XACC_ACL_SUFFIX) == 0
continue;
}
-@@ -1133,6 +1141,38 @@ int del_def_xattr_acl(const char *fname)
+@@ -1130,6 +1138,38 @@ int del_def_xattr_acl(const char *fname)
}
#endif
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
-@@ -896,7 +896,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
+@@ -892,7 +892,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
best_match = j;
match_level = 2;
}
best_match = j;
match_level = 3;
break;
-@@ -936,7 +936,12 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
+@@ -932,7 +932,12 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
}
} else
#endif
if (itemizing)
itemize(cmpbuf, file, ndx, 0, sxp, 0, 0, NULL);
}
-@@ -1092,7 +1097,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
+@@ -1088,7 +1093,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
if (match_level == 3) {
#ifdef SUPPORT_HARD_LINKS
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -737,7 +737,7 @@ enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+@@ -736,7 +736,7 @@ enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG,
OPT_OLD_COMPRESS, OPT_NEW_COMPRESS, OPT_NO_COMPRESS,
OPT_REFUSED_BASE = 9000};
-@@ -891,6 +891,7 @@ static struct poptOption long_options[] = {
+@@ -890,6 +890,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 },
{"fuzzy", 'y', POPT_ARG_NONE, 0, 'y', 0, 0 },
{"no-fuzzy", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
{"no-y", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
-@@ -1146,6 +1147,9 @@ static void set_refuse_options(void)
+@@ -1145,6 +1146,9 @@ static void set_refuse_options(void)
#ifndef SUPPORT_HARD_LINKS
parse_one_refuse_match(0, "link-dest", list_end);
#endif
#ifndef ICONV_OPTION
parse_one_refuse_match(0, "iconv", list_end);
#endif
-@@ -1309,6 +1313,8 @@ char *alt_dest_opt(int type)
+@@ -1308,6 +1312,8 @@ char *alt_dest_opt(int type)
return "--copy-dest";
case LINK_DEST:
return "--link-dest";
default:
assert(0);
}
-@@ -1688,6 +1694,10 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1683,6 +1689,10 @@ int parse_arguments(int *argc_p, const char ***argv_p)
want_dest_type = LINK_DEST;
goto set_dest_dir;
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/loadparm.c b/loadparm.c
--- a/loadparm.c
+++ b/loadparm.c
int remove_source_files = 0;
int one_file_system = 0;
int protocol_version = PROTOCOL_VERSION;
-@@ -967,6 +969,8 @@ static struct poptOption long_options[] = {
+@@ -966,6 +968,8 @@ static struct poptOption long_options[] = {
{"outbuf", 0, POPT_ARG_STRING, &outbuf_mode, 0, 0, 0 },
{"remote-option", 'M', POPT_ARG_STRING, 0, 'M', 0, 0 },
{"protocol", 0, POPT_ARG_INT, &protocol_version, 0, 0, 0 },
#ifdef HAVE_SIGACTION
static struct sigaction sigact;
-@@ -166,6 +168,37 @@ static void contimeout_handler(UNUSED(int val))
+@@ -165,6 +167,37 @@ static void contimeout_handler(UNUSED(int val))
connect_timeout = -1;
}
/* Open a socket to a tcp remote host with the specified port.
*
* Based on code from Warren. Proxy support by Stephen Rothwell.
-@@ -275,6 +308,7 @@ int open_socket_out(char *host, int port, const char *bind_addr,
+@@ -273,6 +306,7 @@ int open_socket_out(char *host, int port, const char *bind_addr, int af_hint)
alarm(connect_timeout);
}
set_socket_options(s, sockopts);
while (connect(s, res->ai_addr, res->ai_addrlen) < 0) {
if (connect_timeout < 0)
-@@ -449,6 +483,7 @@ static int *open_socket_in(int type, int port, const char *bind_addr,
+@@ -444,6 +478,7 @@ static int *open_socket_in(int type, int port, const char *bind_addr,
continue;
}
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
extern int write_devices;
extern int preserve_specials;
extern int preserve_hard_links;
-@@ -1660,7 +1661,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1650,7 +1651,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
if (solo_file)
fname = f_name(file, NULL);
rprintf(FINFO, "skipping non-regular file \"%s\"\n", fname);
-@@ -1882,6 +1883,9 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1871,6 +1872,9 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
fnamecmp_type = FNAMECMP_BACKUP;
}
int write_devices = 0;
int preserve_links = 0;
int preserve_hard_links = 0;
-@@ -811,6 +812,7 @@ static struct poptOption long_options[] = {
+@@ -810,6 +811,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 },
{"write-devices", 0, POPT_ARG_VAL, &write_devices, 1, 0, 0 },
{"no-write-devices", 0, POPT_ARG_VAL, &write_devices, 0, 0, 0 },
{"specials", 0, POPT_ARG_VAL, &preserve_specials, 1, 0, 0 },
-@@ -1105,6 +1107,7 @@ static void set_refuse_options(void)
+@@ -1104,6 +1106,7 @@ static void set_refuse_options(void)
|| strcmp("iconv", longName) == 0
|| strcmp("no-iconv", longName) == 0
|| strcmp("checksum-seed", longName) == 0
|| strcmp("write-devices", longName) == 0 /* disable wild-match (it gets refused below) */
|| strcmp("log-format", longName) == 0 /* aka out-format (NOT log-file-format) */
|| strcmp("sender", longName) == 0
-@@ -1116,6 +1119,7 @@ static void set_refuse_options(void)
+@@ -1115,6 +1118,7 @@ static void set_refuse_options(void)
assert(list_end != NULL);
if (am_daemon) { /* Refused by default, but can be accepted via a negated exact match. */
parse_one_refuse_match(0, "write-devices", list_end);
}
-@@ -2841,6 +2845,9 @@ void server_options(char **args, int *argc_p)
+@@ -2836,6 +2840,9 @@ void server_options(char **args, int *argc_p)
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
extern int am_root;
extern int am_server;
extern int am_daemon;
-@@ -420,7 +421,8 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr,
+@@ -419,7 +420,8 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr, cha
if (iflags & ITEM_TRANSFER) {
int i = ndx - cur_flist->ndx_start;
diff --git a/sender.c b/sender.c
--- a/sender.c
+++ b/sender.c
-@@ -370,6 +370,9 @@ void send_files(int f_in, int f_out)
+@@ -366,6 +366,9 @@ void send_files(int f_in, int f_out)
exit_cleanup(RERR_FILEIO);
}
extern int preserve_hard_links;
extern int preserve_executability;
extern int preserve_fileflags;
-@@ -401,6 +402,19 @@ static inline int mtime_differs(STRUCT_STAT *stp, struct file_struct *file)
+@@ -398,6 +399,19 @@ static inline int mtime_differs(STRUCT_STAT *stp, struct file_struct *file)
#endif
}
+static inline int any_time_differs(stat_x *sxp, struct file_struct *file, UNUSED(const char *fname))
+{
-+ int differs = time_differs(&sxp->st, file);
++ int differs = mtime_differs(&sxp->st, file);
+#ifdef SUPPORT_CRTIMES
+ if (!differs && crtimes_ndx) {
+ if (sxp->crtime == 0)
static inline int perms_differ(struct file_struct *file, stat_x *sxp)
{
if (preserve_perms)
-@@ -455,7 +469,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
+@@ -452,7 +466,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
{
if (S_ISLNK(file->mode)) {
#ifdef CAN_SET_SYMLINK_TIMES
return 0;
#endif
#ifdef CAN_CHMOD_SYMLINK
-@@ -475,7 +489,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
+@@ -472,7 +486,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
return 0;
#endif
} else {
return 0;
if (perms_differ(file, sxp))
return 0;
-@@ -521,6 +535,14 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -518,6 +532,14 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
if (atimes_ndx && !S_ISDIR(file->mode) && !S_ISLNK(file->mode)
&& !same_time(F_ATIME(file), 0, sxp->st.st_atime, 0))
iflags |= ITEM_REPORT_ATIME;
#if !defined HAVE_LCHMOD && !defined HAVE_SETATTRLIST
if (S_ISLNK(file->mode)) {
;
-@@ -1146,6 +1168,7 @@ static void list_file_entry(struct file_struct *f)
+@@ -1142,6 +1164,7 @@ static void list_file_entry(struct file_struct *f)
int size_width = human_readable ? 14 : 11;
int mtime_width = 1 + strlen(mtime_str);
int atime_width = atimes_ndx ? mtime_width : 0;
if (!F_IS_ACTIVE(f)) {
/* this can happen if duplicate names were removed */
-@@ -1156,10 +1179,11 @@ static void list_file_entry(struct file_struct *f)
+@@ -1152,10 +1175,11 @@ static void list_file_entry(struct file_struct *f)
if (missing_args == 2 && f->mode == 0) {
rprintf(FINFO, "%-*s %s\n",
const char *arrow, *lnk;
permstring(permbuf, f->mode);
-@@ -1172,9 +1196,9 @@ static void list_file_entry(struct file_struct *f)
+@@ -1168,9 +1192,9 @@ static void list_file_entry(struct file_struct *f)
#endif
arrow = lnk = "";
f_name(f, NULL), arrow, lnk);
}
}
-@@ -1270,6 +1294,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1266,6 +1290,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
return;
}
}
int update_only = 0;
int open_noatime = 0;
int cvs_exclude = 0;
-@@ -651,6 +652,11 @@ static void print_capabilities(enum logcode f)
+@@ -650,6 +651,11 @@ static void print_capabilities(enum logcode f)
#endif
"file-flags",
NULL
};
-@@ -800,6 +806,9 @@ static struct poptOption long_options[] = {
+@@ -799,6 +805,9 @@ static struct poptOption long_options[] = {
{"no-U", 0, POPT_ARG_VAL, &preserve_atimes, 0, 0, 0 },
{"open-noatime", 0, POPT_ARG_VAL, &open_noatime, 1, 0, 0 },
{"no-open-noatime", 0, POPT_ARG_VAL, &open_noatime, 0, 0, 0 },
{"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 },
-@@ -1175,6 +1184,9 @@ static void set_refuse_options(void)
+@@ -1174,6 +1183,9 @@ static void set_refuse_options(void)
parse_one_refuse_match(0, "force-uchange", list_end);
parse_one_refuse_match(0, "force-schange", list_end);
#endif
/* Now we use the descrip values to actually mark the options for refusal. */
for (op = long_options; op != list_end; op++) {
-@@ -2520,6 +2532,10 @@ void server_options(char **args, int *argc_p)
+@@ -2515,6 +2527,10 @@ void server_options(char **args, int *argc_p)
if (preserve_atimes > 1)
argstr[x++] = 'U';
}
diff --git a/rsync.c b/rsync.c
--- a/rsync.c
+++ b/rsync.c
-@@ -619,6 +619,9 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -618,6 +618,9 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
memcpy(&sx2.st, &sxp->st, sizeof (sx2.st));
if (!atimes_ndx || S_ISDIR(sxp->st.st_mode))
flags |= ATTRS_SKIP_ATIME;
if (!(flags & ATTRS_SKIP_MTIME) && !same_mtime(file, &sxp->st, flags & ATTRS_ACCURATE_TIME)) {
sx2.st.st_mtime = file->modtime;
#ifdef ST_MTIME_NSEC
-@@ -648,6 +651,16 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -647,6 +650,16 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
file->flags |= FLAG_TIME_FAILED;
}
}
#ifdef SUPPORT_ACLS
/* It's OK to call set_acl() now, even for a dir, as the generator
-@@ -767,7 +780,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -766,7 +779,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
/* Change permissions before putting the file into place. */
set_file_attrs(fnametmp, file, NULL, fnamecmp,
ATTRS_DELAY_IMMUTABLE
/* move tmp file over real file */
if (DEBUG_GTE(RECV, 1))
-@@ -796,7 +809,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -795,7 +808,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
do_set_file_attrs:
set_file_attrs(fnametmp, file, NULL, fnamecmp,
#define ITEM_BASIS_TYPE_FOLLOWS (1<<11)
#define ITEM_XNAME_FOLLOWS (1<<12)
#define ITEM_IS_NEW (1<<13)
-@@ -572,6 +574,10 @@ typedef unsigned int size_t;
+@@ -575,6 +577,10 @@ typedef unsigned int size_t;
#define ST_FLAGS(st) NO_FFLAGS
#endif
/* Find a variable that is either exactly 32-bits or longer.
* If some code depends on 32-bit truncation, it will need to
* take special action in a "#if SIZEOF_INT32 > 4" section. */
-@@ -781,6 +787,7 @@ struct file_struct {
+@@ -784,6 +790,7 @@ struct file_struct {
extern int file_extra_cnt;
extern int inc_recurse;
extern int atimes_ndx;
extern int pathname_ndx;
extern int depth_ndx;
extern int uid_ndx;
-@@ -845,6 +852,7 @@ extern int xattrs_ndx;
+@@ -848,6 +855,7 @@ extern int xattrs_ndx;
#define F_XATTR(f) REQ_EXTRA(f, xattrs_ndx)->num
#define F_NDX(f) REQ_EXTRA(f, unsort_ndx)->num
#define F_ATIME(f) REQ_EXTRA64(f, atimes_ndx)->num
/* These items are per-entry optional: */
#define F_HL_GNUM(f) OPT_EXTRA(f, START_BUMP(f))->num /* non-dirs */
-@@ -1087,6 +1095,7 @@ typedef struct {
+@@ -1090,6 +1098,7 @@ typedef struct {
typedef struct {
STRUCT_STAT st;
#define RETURN_ERROR_IF(x,e) \
do { \
if (x) { \
-@@ -494,6 +501,40 @@ int do_setattrlist_times(const char *fname, STRUCT_STAT *stp)
+@@ -493,6 +500,40 @@ int do_setattrlist_times(const char *fname, STRUCT_STAT *stp)
}
#endif
/* TODO: Perhaps escape special characters in fname? */
printf("%s ", permbuf);
-@@ -206,14 +223,17 @@ static void list_file(const char *fname)
+@@ -204,14 +221,17 @@ static void list_file(const char *fname)
} else
printf("%15s", do_big_num(buf.st_size, 1, NULL));
{"link-times", 'l', POPT_ARG_NONE, &link_times, 0, 0, 0 },
{"link-owner", 'L', POPT_ARG_NONE, &link_owner, 0, 0, 0 },
#ifdef SUPPORT_XATTRS
-@@ -233,6 +253,9 @@ static void NORETURN tls_usage(int ret)
+@@ -231,6 +251,9 @@ static void NORETURN tls_usage(int ret)
fprintf(F,"Trivial file listing program for portably checking rsync\n");
fprintf(F,"\nOptions:\n");
fprintf(F," -U, --atimes display access (last-used) times\n");
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/exclude.c b/exclude.c
--- a/exclude.c
+++ b/exclude.c
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
extern int size_only;
extern OFF_T max_size;
extern OFF_T min_size;
-@@ -586,6 +587,9 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -582,6 +583,9 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
/* Perform our quick-check heuristic for determining if a file is unchanged. */
int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
{
+ if (date_only)
-+ return time_diff(st, file) == 0;
++ return !mtime_differs(st, file);
+
if (st->st_size != F_LENGTH(file))
return 0;
int daemon_bwlimit = 0;
int bwlimit = 0;
int fuzzy_basis = 0;
-@@ -838,6 +839,7 @@ static struct poptOption long_options[] = {
+@@ -837,6 +838,7 @@ static struct poptOption long_options[] = {
{"chmod", 0, POPT_ARG_STRING, 0, OPT_CHMOD, 0, 0 },
{"ignore-times", 'I', POPT_ARG_NONE, &ignore_times, 0, 0, 0 },
{"size-only", 0, POPT_ARG_NONE, &size_only, 0, 0, 0 },
{"one-file-system", 'x', POPT_ARG_NONE, 0, 'x', 0, 0 },
{"no-one-file-system",0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
{"no-x", 0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
-@@ -2728,6 +2730,9 @@ void server_options(char **args, int *argc_p)
+@@ -2723,6 +2725,9 @@ void server_options(char **args, int *argc_p)
else if (missing_args == 1 && !am_sender)
args[ac++] = "--ignore-missing-args";
./configure
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
extern char *bind_address;
extern char *config_file;
extern char *logfile_format;
-@@ -776,6 +779,11 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
+@@ -775,6 +778,11 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
log_init(1);
#ifdef HAVE_PUTENV
if ((*lp_early_exec(i) || *lp_prexfer_exec(i) || *lp_postxfer_exec(i))
&& !getenv("RSYNC_NO_XFER_EXEC")) {
-@@ -963,6 +971,8 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
+@@ -962,6 +970,8 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
am_server = 1; /* Don't let someone try to be tricky. */
quiet = 0;
extern int append_mode;
extern int make_backups;
extern int csum_length;
-@@ -593,7 +594,8 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
+@@ -589,7 +590,8 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
of the file time to determine whether to sync */
if (always_checksum > 0 && S_ISREG(st->st_mode)) {
char sum[MAX_DIGEST_LEN];
return memcmp(sum, F_SUM(file), flist_csum_len) == 0;
}
-@@ -2252,6 +2254,13 @@ void generate_files(int f_out, const char *local_name)
+@@ -2241,6 +2243,13 @@ void generate_files(int f_out, const char *local_name)
: "enabled");
}
dflt_perms = (ACCESSPERMS & ~orig_umask);
do {
-@@ -2377,6 +2386,9 @@ void generate_files(int f_out, const char *local_name)
+@@ -2366,6 +2375,9 @@ void generate_files(int f_out, const char *local_name)
wait_for_receiver();
}
extern int io_error;
extern int batch_fd;
extern int eol_nulls;
-@@ -1490,6 +1492,32 @@ static void read_a_msg(void)
+@@ -1489,6 +1491,32 @@ static void read_a_msg(void)
if (am_sender)
maybe_send_keepalive(time(NULL), MSK_ALLOW_FLUSH);
break;
case MSG_DELETED:
if (msg_bytes >= sizeof data)
goto overflow;
-@@ -1641,6 +1669,7 @@ static void read_a_msg(void)
+@@ -1640,6 +1668,7 @@ static void read_a_msg(void)
* with a duplicate exit message. */
_exit_cleanup(val, __FILE__, 0 - __LINE__);
default:
extern int file_total;
extern int recurse;
extern int xfer_dirs;
-@@ -87,6 +89,7 @@ extern char *logfile_format;
+@@ -88,6 +90,7 @@ extern char *logfile_format;
extern char *filesfrom_host;
extern char *partial_dir;
extern char *rsync_path;
extern char *shell_cmd;
extern char *password_file;
extern char *backup_dir;
-@@ -1200,6 +1203,9 @@ void start_server(int f_in, int f_out, int argc, char *argv[])
+@@ -1205,6 +1208,9 @@ void start_server(int f_in, int f_out, int argc, char *argv[])
if (am_daemon && io_timeout && protocol_version >= 31)
send_msg_int(MSG_IO_TIMEOUT, io_timeout);
if (am_sender) {
keep_dirlinks = 0; /* Must be disabled on the sender. */
if (need_messages_from_generator)
-@@ -1493,6 +1499,9 @@ static int start_client(int argc, char *argv[])
+@@ -1496,6 +1502,9 @@ static int start_client(int argc, char *argv[])
else
env_port = rsync_port;
DEBUG_WORD(DEL, W_REC, "Debug delete actions (levels 1-3)"),
DEBUG_WORD(DELTASUM, W_SND|W_REC, "Debug delta-transfer checksumming (levels 1-4)"),
DEBUG_WORD(DUP, W_REC, "Debug weeding of duplicate names"),
-@@ -644,6 +650,16 @@ static void print_capabilities(enum logcode f)
+@@ -643,6 +649,16 @@ static void print_capabilities(enum logcode f)
#endif
"SIMD",
NULL
};
-@@ -737,6 +753,7 @@ enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+@@ -736,6 +752,7 @@ enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG,
OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT,
OPT_OLD_COMPRESS, OPT_NEW_COMPRESS, OPT_NO_COMPRESS,
OPT_REFUSED_BASE = 9000};
-@@ -887,6 +904,10 @@ static struct poptOption long_options[] = {
+@@ -886,6 +903,10 @@ static struct poptOption long_options[] = {
{"no-c", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
{"checksum-choice", 0, POPT_ARG_STRING, &checksum_choice, 0, 0, 0 },
{"cc", 0, POPT_ARG_STRING, &checksum_choice, 0, 0, 0 },
{"block-size", 'B', POPT_ARG_LONG, &block_size, 0, 0, 0 },
{"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
{"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
-@@ -976,6 +997,9 @@ static struct poptOption long_options[] = {
+@@ -975,6 +996,9 @@ static struct poptOption long_options[] = {
{"dparam", 0, POPT_ARG_STRING, 0, OPT_DAEMON, 0, 0 },
{"detach", 0, POPT_ARG_NONE, 0, OPT_DAEMON, 0, 0 },
{"no-detach", 0, POPT_ARG_NONE, 0, OPT_DAEMON, 0, 0 },
{0,0,0,0, 0, 0, 0}
};
-@@ -1016,6 +1040,39 @@ static struct poptOption long_daemon_options[] = {
+@@ -1015,6 +1039,39 @@ static struct poptOption long_daemon_options[] = {
{0,0,0,0, 0, 0, 0}
};
static char err_buf[200];
-@@ -1141,6 +1198,8 @@ static void set_refuse_options(void)
+@@ -1140,6 +1197,8 @@ static void set_refuse_options(void)
parse_one_refuse_match(0, "iconv", list_end);
#endif
parse_one_refuse_match(0, "log-file*", list_end);
}
#ifndef SUPPORT_HARD_LINKS
-@@ -1279,6 +1338,102 @@ static void create_refuse_error(int which)
+@@ -1278,6 +1337,102 @@ static void create_refuse_error(int which)
snprintf(err_buf + n, sizeof err_buf - n, " (-%c)\n", op->shortName);
}
/* This is used to make sure that --daemon & --server cannot be aliased to
* something else. These options have always disabled popt aliases for the
* parsing of a daemon or server command-line, but we have to make sure that
-@@ -1335,6 +1490,12 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1334,6 +1489,12 @@ int parse_arguments(int *argc_p, const char ***argv_p)
return 0;
}
set_refuse_options();
#ifdef ICONV_OPTION
-@@ -1456,6 +1617,12 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1452,6 +1613,12 @@ int parse_arguments(int *argc_p, const char ***argv_p)
am_daemon = 1;
return 1;
case OPT_MODIFY_WINDOW:
/* The value has already been set by popt, but
* we need to remember that we're using a
-@@ -1530,6 +1697,10 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1526,6 +1693,10 @@ int parse_arguments(int *argc_p, const char ***argv_p)
preserve_devices = preserve_specials = 0;
break;
/**
* Create a child connected to us via its stdin/stdout.
*
-@@ -142,13 +147,22 @@ pid_t local_child(int argc, char **argv, int *f_in, int *f_out,
+@@ -141,13 +146,22 @@ pid_t local_child(int argc, char **argv, int *f_in, int *f_out,
}
if (remote_option_cnt) {
+ } else if (use_db)
+ same_db = 1;
- if (dup2(to_child_pipe[0], STDIN_FILENO) < 0 ||
- close(to_child_pipe[1]) < 0 ||
+ if (dup2(to_child_pipe[0], STDIN_FILENO) < 0
+ || close(to_child_pipe[1]) < 0
diff --git a/receiver.c b/receiver.c
--- a/receiver.c
+++ b/receiver.c
progress_init();
while (1) {
-@@ -880,6 +890,8 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -878,6 +888,8 @@ int recv_files(int f_in, int f_out, char *local_name)
do_unlink(partialptr);
handle_partial_dir(partialptr, PDIR_DELETE);
}
} else if (keep_partial && partialptr && !one_inplace) {
if (!handle_partial_dir(partialptr, PDIR_CREATE)) {
rprintf(FERROR,
-@@ -893,6 +905,8 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -891,6 +903,8 @@ int recv_files(int f_in, int f_out, char *local_name)
recv_ok = -1;
else if (delay_updates && recv_ok) {
bitbag_set_bit(delayed_bits, ndx);
extern int am_starting_up;
extern int allow_8bit_chars;
extern int protocol_version;
-@@ -795,6 +796,8 @@ struct file_list *flist_for_ndx(int ndx, const char *fatal_error_loc)
+@@ -794,6 +795,8 @@ struct file_list *flist_for_ndx(int ndx, const char *fatal_error_loc)
const char *who_am_i(void)
{
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
-@@ -471,7 +471,9 @@ static int fattr_find(struct file_struct *f, char *fname)
+@@ -468,7 +468,9 @@ static int fattr_find(struct file_struct *f, char *fname)
continue;
}
}
diff = u_strcmp(fmid->basename, f->basename);
if (diff == 0) {
good_match = mid;
-@@ -1964,6 +1966,21 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1953,6 +1955,21 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
fnamecmp = partialptr;
fnamecmp_type = FNAMECMP_PARTIAL_DIR;
statret = 0;
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -892,7 +892,9 @@ static struct poptOption long_options[] = {
+@@ -891,7 +891,9 @@ 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 },
{"fuzzy", 'y', POPT_ARG_NONE, 0, 'y', 0, 0 },
{"no-fuzzy", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
{"no-y", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
-@@ -2714,8 +2716,14 @@ void server_options(char **args, int *argc_p)
+@@ -2709,8 +2711,14 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--super";
if (size_only)
args[ac++] = "--size-only";
a file that can't use it, while missing out on giving it to a file
that could use it.
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/backup.c b/backup.c
--- a/backup.c
+++ b/backup.c
static int deldelay_size = 0, deldelay_cnt = 0;
static char *deldelay_buf = NULL;
static int deldelay_fd = -1;
-@@ -272,14 +275,19 @@ static void do_delayed_deletions(char *delbuf)
+@@ -269,14 +272,19 @@ static void do_delayed_deletions(char *delbuf)
* 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
if (!fbuf) {
change_local_filter_dir(NULL, 0, 0);
-@@ -293,17 +301,22 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
+@@ -290,17 +298,22 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
maybe_send_keepalive(time(NULL), MSK_ALLOW_FLUSH);
if (io_error & IOERR_GENERAL && !ignore_errors) {
if (one_file_system) {
if (!dev_tbl)
dev_tbl = hashtable_create(16, HT_KEY64);
-@@ -319,6 +332,14 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
+@@ -316,6 +329,14 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
dirlist = get_dirlist(fbuf, dlen, 0);
/* If an item in dirlist is not found in flist, delete it
* from the filesystem. */
for (i = dirlist->used; i--; ) {
-@@ -331,6 +352,10 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
+@@ -328,6 +349,10 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
f_name(fp, NULL));
continue;
}
/* Here we want to match regardless of file type. Replacement
* of a file with one of another type is handled separately by
* a delete_item call with a DEL_MAKE_ROOM flag. */
-@@ -339,14 +364,19 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
+@@ -336,14 +361,19 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
if (!(fp->mode & S_IWUSR) && !am_root && fp->flags & FLAG_OWNED_BY_US)
flags |= DEL_NO_UID_WRITE;
f_name(fp, delbuf);
flist_free(dirlist);
}
-@@ -382,14 +412,125 @@ static void do_delete_pass(void)
+@@ -379,14 +409,125 @@ static void do_delete_pass(void)
|| !S_ISDIR(st.st_mode))
continue;
static inline int mtime_differs(STRUCT_STAT *stp, struct file_struct *file)
{
#ifdef ST_MTIME_NSEC
-@@ -1168,6 +1309,7 @@ static void list_file_entry(struct file_struct *f)
+@@ -1164,6 +1305,7 @@ static void list_file_entry(struct file_struct *f)
}
}
static int phase = 0;
static int dflt_perms;
-@@ -1298,7 +1440,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1294,7 +1436,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
&& do_stat(dn, &sx.st) < 0) {
if (dry_run)
goto parent_is_dry_missing;
rsyserr(FERROR_XFER, errno,
"recv_generator: mkdir %s failed",
full_fname(dn));
-@@ -1436,7 +1578,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1430,7 +1572,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
}
if (real_ret != 0 && do_mkdir(fname,file->mode|added_perms) < 0 && errno != EEXIST) {
if (!relative_paths || errno != ENOENT
|| (do_mkdir(fname, file->mode|added_perms) < 0 && errno != EEXIST)) {
rsyserr(FERROR_XFER, errno,
"recv_generator: mkdir %s failed",
-@@ -1485,9 +1627,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1478,9 +1620,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
}
else if (delete_during && f_out != -1 && !phase
&& !(file->flags & FLAG_MISSING_DIR)) {
change_local_filter_dir(fname, strlen(fname), F_DEPTH(file));
}
prior_dir_file = file;
-@@ -1768,8 +1913,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1757,8 +1902,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
#endif
rsyserr(FERROR_XFER, stat_errno, "recv_generator: failed to stat %s",
full_fname(fname));
goto cleanup;
-@@ -2233,6 +2384,12 @@ void generate_files(int f_out, const char *local_name)
+@@ -2222,6 +2373,12 @@ void generate_files(int f_out, const char *local_name)
if (DEBUG_GTE(GENR, 1))
rprintf(FINFO, "generator starting pid=%d\n", (int)getpid());
if (delete_before && !solo_file && cur_flist->used > 0)
do_delete_pass();
if (delete_during == 2) {
-@@ -2243,7 +2400,7 @@ void generate_files(int f_out, const char *local_name)
+@@ -2232,7 +2389,7 @@ void generate_files(int f_out, const char *local_name)
}
info_levels[INFO_FLIST] = info_levels[INFO_PROGRESS] = 0;
whole_file = 0;
if (DEBUG_GTE(FLIST, 1)) {
rprintf(FINFO, "delta-transmission %s\n",
-@@ -2279,7 +2436,7 @@ void generate_files(int f_out, const char *local_name)
+@@ -2268,7 +2425,7 @@ void generate_files(int f_out, const char *local_name)
dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
} else
dirdev = MAKEDEV(0, 0);
} else
change_local_filter_dir(fbuf, strlen(fbuf), F_DEPTH(fp));
}
-@@ -2326,7 +2483,21 @@ void generate_files(int f_out, const char *local_name)
+@@ -2315,7 +2472,21 @@ void generate_files(int f_out, const char *local_name)
} while ((cur_flist = cur_flist->next) != NULL);
if (delete_during)
int implied_dirs = 1;
int missing_args = 0; /* 0 = FERROR_XFER, 1 = ignore, 2 = delete */
int numeric_ids = 0;
-@@ -891,6 +892,7 @@ static struct poptOption long_options[] = {
+@@ -890,6 +891,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 },
{"fuzzy", 'y', POPT_ARG_NONE, 0, 'y', 0, 0 },
{"no-fuzzy", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
{"no-y", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
-@@ -2300,7 +2302,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2295,7 +2297,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
inplace = 1;
}
partial_dir = tmp_partialdir;
if (inplace) {
-@@ -2309,6 +2311,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2304,6 +2306,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
snprintf(err_buf, sizeof err_buf,
"--%s cannot be used with --%s\n",
append_mode ? "append" : "inplace",
delay_updates ? "delay-updates" : "partial-dir");
return 0;
}
-@@ -2711,6 +2714,8 @@ void server_options(char **args, int *argc_p)
+@@ -2706,6 +2709,8 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--super";
if (size_only)
args[ac++] = "--size-only";
ret = -ret - 1;
else
ret++;
-@@ -1174,6 +1174,32 @@ char *normalize_path(char *path, BOOL force_newbuf, unsigned int *len_ptr)
+@@ -1171,6 +1171,32 @@ char *normalize_path(char *path, BOOL force_newbuf, unsigned int *len_ptr)
return path;
}
/**
* Return a quoted string with the full pathname of the indicated filename.
* The string " (in MODNAME)" may also be appended. The returned pointer
-@@ -1267,7 +1293,7 @@ int handle_partial_dir(const char *fname, int create)
+@@ -1264,7 +1290,7 @@ int handle_partial_dir(const char *fname, int create)
}
statret = -1;
}
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
extern int module_id;
extern int local_server;
extern int sanitize_paths;
-@@ -911,6 +912,8 @@ static struct poptOption long_options[] = {
+@@ -910,6 +911,8 @@ static struct poptOption long_options[] = {
{"partial-dir", 0, POPT_ARG_STRING, &partial_dir, 0, 0, 0 },
{"delay-updates", 0, POPT_ARG_VAL, &delay_updates, 1, 0, 0 },
{"no-delay-updates", 0, POPT_ARG_VAL, &delay_updates, 0, 0, 0 },
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
extern int human_readable;
extern int ignore_existing;
extern int ignore_non_existing;
-@@ -1694,6 +1695,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1684,6 +1685,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
-+ if (downdate_only && statret == 0 && time_diff(&sx.st, file) < 0) {
++ if (downdate_only > 0 && statret == 0 && file->modtime - sx.st.st_mtime >= modify_window) {
+ if (INFO_GTE(SKIP, 1))
+ rprintf(FINFO, "%s is older\n", fname);
+ return;
fnamecmp_type = FNAMECMP_FNAME;
if (statret == 0 && !(S_ISREG(sx.st.st_mode) || (write_devices && IS_DEVICE(sx.st.st_mode)))) {
-@@ -2139,6 +2146,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
+@@ -2128,6 +2135,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
ignore_existing = -ignore_existing;
ignore_non_existing = -ignore_non_existing;
update_only = -update_only;
always_checksum = -always_checksum;
size_only = -size_only;
append_mode = -append_mode;
-@@ -2164,6 +2172,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
+@@ -2153,6 +2161,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
ignore_existing = -ignore_existing;
ignore_non_existing = -ignore_non_existing;
update_only = -update_only;
int update_only = 0;
int open_noatime = 0;
int cvs_exclude = 0;
-@@ -842,6 +843,7 @@ static struct poptOption long_options[] = {
+@@ -841,6 +842,7 @@ static struct poptOption long_options[] = {
{"no-one-file-system",0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
{"no-x", 0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
{"update", 'u', POPT_ARG_NONE, &update_only, 0, 0, 0 },
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/compat.c b/compat.c
--- a/compat.c
+++ b/compat.c
extern int delete_mode;
extern int delete_before;
extern int delete_during;
-@@ -477,6 +479,10 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
+@@ -474,6 +476,10 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
return 0;
if (perms_differ(file, sxp))
return 0;
if (ownership_differs(file, sxp))
return 0;
#ifdef SUPPORT_ACLS
-@@ -531,6 +537,11 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
- if (gid_ndx && !(file->flags & FLAG_SKIP_GROUP)
- && sxp->st.st_gid != (gid_t)F_GROUP(file))
+@@ -527,6 +533,11 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+ iflags |= ITEM_REPORT_OWNER;
+ if (gid_ndx && !(file->flags & FLAG_SKIP_GROUP) && sxp->st.st_gid != (gid_t)F_GROUP(file))
iflags |= ITEM_REPORT_GROUP;
+#ifdef SUPPORT_FILEFLAGS
+ if (preserve_fileflags && !S_ISLNK(file->mode)
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
if (!ACL_READY(*sxp))
-@@ -1418,6 +1429,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
- file->mode = dest_mode(file->mode, sx.st.st_mode,
- dflt_perms, statret == 0);
+@@ -1413,6 +1424,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+ if (!preserve_perms) { /* See comment in non-dir code below. */
+ file->mode = dest_mode(file->mode, sx.st.st_mode, dflt_perms, statret == 0);
}
+#ifdef SUPPORT_FORCE_CHANGE
+ if (force_change && !preserve_fileflags)
+ F_FFLAGS(file) = sx.st.st_flags;
+#endif
if (statret != 0 && basis_dir[0] != NULL) {
- int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx,
- itemizing, code);
-@@ -1462,10 +1477,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+ int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx, itemizing, code);
+ if (j == -2) {
+@@ -1455,10 +1470,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
* readable and writable permissions during the time we are
* putting files within them. This is then restored to the
* former permissions after the transfer is done. */
rsyserr(FERROR_XFER, errno,
"failed to modify permissions on %s",
full_fname(fname));
-@@ -1501,6 +1521,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
- file->mode = dest_mode(file->mode, sx.st.st_mode, dflt_perms,
- exists);
+@@ -1493,6 +1513,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+ int exists = statret == 0 && !S_ISDIR(sx.st.st_mode);
+ file->mode = dest_mode(file->mode, sx.st.st_mode, dflt_perms, exists);
}
+#ifdef SUPPORT_FORCE_CHANGE
+ if (force_change && !preserve_fileflags)
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_HLINK_NOT_FIRST(file)
-@@ -2084,17 +2108,25 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
+@@ -2073,17 +2097,25 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
continue;
fname = f_name(file, NULL);
if (fix_dir_perms)
extern int file_total;
extern int recurse;
extern int xfer_dirs;
-@@ -945,6 +949,22 @@ static int do_recv(int f_in, int f_out, char *local_name)
+@@ -951,6 +955,22 @@ static int do_recv(int f_in, int f_out, char *local_name)
* points to an identical file won't be replaced by the referent. */
copy_links = copy_dirlinks = copy_unsafe_links = 0;
int io_timeout = 0;
int prune_empty_dirs = 0;
int use_qsort = 0;
-@@ -644,6 +646,11 @@ static void print_capabilities(enum logcode f)
+@@ -643,6 +645,11 @@ static void print_capabilities(enum logcode f)
#endif
"SIMD",
NULL
};
-@@ -776,6 +783,8 @@ static struct poptOption long_options[] = {
+@@ -775,6 +782,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 },
{"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 },
-@@ -869,6 +878,12 @@ static struct poptOption long_options[] = {
+@@ -868,6 +877,12 @@ static struct poptOption long_options[] = {
{"remove-source-files",0,POPT_ARG_VAL, &remove_source_files, 1, 0, 0 },
{"force", 0, POPT_ARG_VAL, &force_delete, 1, 0, 0 },
{"no-force", 0, POPT_ARG_VAL, &force_delete, 0, 0, 0 },
{"ignore-errors", 0, POPT_ARG_VAL, &ignore_errors, 1, 0, 0 },
{"no-ignore-errors", 0, POPT_ARG_VAL, &ignore_errors, 0, 0, 0 },
{"max-delete", 0, POPT_ARG_INT, &max_delete, 0, 0, 0 },
-@@ -1152,6 +1167,14 @@ static void set_refuse_options(void)
+@@ -1151,6 +1166,14 @@ static void set_refuse_options(void)
#ifndef HAVE_SETVBUF
parse_one_refuse_match(0, "outbuf", list_end);
#endif
/* Now we use the descrip values to actually mark the options for refusal. */
for (op = long_options; op != list_end; op++) {
-@@ -2602,6 +2625,9 @@ void server_options(char **args, int *argc_p)
+@@ -2597,6 +2620,9 @@ void server_options(char **args, int *argc_p)
if (xfer_dirs && !recurse && delete_mode && am_sender)
args[ac++] = "--no-r";
if (do_compression && do_compression_level != CLVL_NOT_SPECIFIED) {
if (asprintf(&arg, "--compress-level=%d", do_compression_level) < 0)
goto oom;
-@@ -2705,6 +2731,16 @@ void server_options(char **args, int *argc_p)
+@@ -2700,6 +2726,16 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--delete-excluded";
if (force_delete)
args[ac++] = "--force";
extern int preserve_executability;
extern int preserve_times;
extern int am_root;
-@@ -468,6 +469,39 @@ mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms,
+@@ -467,6 +468,39 @@ mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms,
return new_mode;
}
static int same_mtime(struct file_struct *file, STRUCT_STAT *st, int extra_accuracy)
{
#ifdef ST_MTIME_NSEC
-@@ -544,7 +578,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -543,7 +577,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
if (am_root >= 0) {
uid_t uid = change_uid ? (uid_t)F_OWNER(file) : sxp->st.st_uid;
gid_t gid = change_gid ? (gid_t)F_GROUP(file) : sxp->st.st_gid;
/* We shouldn't have attempted to change uid
* or gid unless have the privilege. */
rsyserr(FERROR_XFER, errno, "%s %s failed",
-@@ -630,7 +664,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -629,7 +663,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
#ifdef HAVE_CHMOD
if (!BITS_EQUAL(sxp->st.st_mode, new_mode, CHMOD_BITS)) {
if (ret < 0) {
rsyserr(FERROR_XFER, errno,
"failed to set permissions on %s",
-@@ -642,6 +676,19 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -641,6 +675,19 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
}
#endif
if (INFO_GTE(NAME, 2) && flags & ATTRS_REPORT) {
if (updated)
rprintf(FCLIENT, "%s\n", fname);
-@@ -719,7 +766,8 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -718,7 +765,8 @@ int finish_transfer(const char *fname, const char *fnametmp,
/* Change permissions before putting the file into place. */
set_file_attrs(fnametmp, file, NULL, fnamecmp,
/* move tmp file over real file */
if (DEBUG_GTE(RECV, 1))
-@@ -736,6 +784,10 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -735,6 +783,10 @@ int finish_transfer(const char *fname, const char *fnametmp,
}
if (ret == 0) {
/* The file was moved into place (not copied), so it's done. */
#define ITEM_BASIS_TYPE_FOLLOWS (1<<11)
#define ITEM_XNAME_FOLLOWS (1<<12)
#define ITEM_IS_NEW (1<<13)
-@@ -548,6 +550,28 @@ typedef unsigned int size_t;
+@@ -548,6 +550,31 @@ typedef unsigned int size_t;
#endif
#endif
+#define ALL_IMMUTABLE (USR_IMMUTABLE|SYS_IMMUTABLE)
+#define ST_FLAGS(st) ((st).st_flags)
+#else
++#define USR_IMMUTABLE 0
++#define SYS_IMMUTABLE 0
++#define ALL_IMMUTABLE 0
+#define ST_FLAGS(st) NO_FFLAGS
+#endif
+
/* Find a variable that is either exactly 32-bits or longer.
* If some code depends on 32-bit truncation, it will need to
* take special action in a "#if SIZEOF_INT32 > 4" section. */
-@@ -761,6 +785,7 @@ extern int pathname_ndx;
+@@ -761,6 +788,7 @@ extern int pathname_ndx;
extern int depth_ndx;
extern int uid_ndx;
extern int gid_ndx;
extern int acls_ndx;
extern int xattrs_ndx;
-@@ -811,6 +836,11 @@ extern int xattrs_ndx;
+@@ -811,6 +839,11 @@ extern int xattrs_ndx;
/* When the associated option is on, all entries will have these present: */
#define F_OWNER(f) REQ_EXTRA(f, uid_ndx)->unum
#define F_GROUP(f) REQ_EXTRA(f, gid_ndx)->unum
{
int code;
if (dry_run) return 0;
-@@ -235,17 +288,73 @@ int do_chmod(const char *path, mode_t mode)
+@@ -235,17 +288,72 @@ int do_chmod(const char *path, mode_t mode)
} else
code = chmod(path, mode & CHMOD_BITS); /* DISCOURAGED FUNCTION */
#endif /* !HAVE_LCHMOD */
+}
+#endif
+
-+int do_rename(const char *old_path, const char *new_path)
int do_rename(const char *old_path, const char *new_path)
{
if (dry_run) return 0;
diff --git a/xattrs.c b/xattrs.c
--- a/xattrs.c
+++ b/xattrs.c
-@@ -1219,7 +1219,7 @@ int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode)
+@@ -1216,7 +1216,7 @@ int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode)
mode = (fst.st_mode & _S_IFMT) | (fmode & ACCESSPERMS)
| (S_ISDIR(fst.st_mode) ? 0700 : 0600);
if (fst.st_mode != mode)
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/exclude.c b/exclude.c
--- a/exclude.c
+++ b/exclude.c
0. `--timeout=TIMEOUT`
This option allows you to set a maximum I/O timeout in seconds. If no data
-@@ -3367,6 +3373,15 @@ The following modifiers are accepted after a "`+`" or "`-`":
+@@ -3378,6 +3384,15 @@ The following modifiers are accepted after a "`+`" or "`-`":
rules that exclude things like "CVS" and "`*.o`" are marked as perishable,
and will not prevent a directory that was removed on the source from being
deleted on the destination.
- An `x` indicates that a rule affects xattr names in xattr copy/delete
operations (and is thus ignored when matching file/dir names). If no
xattr-matching rules are specified, a default xattr filtering rule is used
-@@ -3424,6 +3439,12 @@ The following modifiers are accepted after a merge or dir-merge rule:
+@@ -3435,6 +3450,12 @@ The following modifiers are accepted after a merge or dir-merge rule:
rules in the file must not specify sides (via a modifier or a rule prefix
such as `hide`).
diff --git a/util.c b/util.c
--- a/util.c
+++ b/util.c
-@@ -891,6 +891,25 @@ size_t stringjoin(char *dest, size_t destsize, ...)
+@@ -889,6 +889,25 @@ size_t stringjoin(char *dest, size_t destsize, ...)
return ret;
}
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
int ignore_times = 0;
int delete_mode = 0;
int delete_during = 0;
-@@ -946,6 +947,7 @@ static struct poptOption long_options[] = {
+@@ -945,6 +946,7 @@ static struct poptOption long_options[] = {
{"no-timeout", 0, POPT_ARG_VAL, &io_timeout, 0, 0, 0 },
{"contimeout", 0, POPT_ARG_INT, &connect_timeout, 0, 0, 0 },
{"no-contimeout", 0, POPT_ARG_VAL, &connect_timeout, 0, 0, 0 },
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
{"rsync-path", 0, POPT_ARG_STRING, &rsync_path, 0, 0, 0 },
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
-@@ -2791,6 +2793,9 @@ void server_options(char **args, int *argc_p)
+@@ -2786,6 +2788,9 @@ void server_options(char **args, int *argc_p)
args[ac++] = tmpdir;
}
extern int preserve_links;
extern int preserve_devices;
extern int write_devices;
-@@ -1805,6 +1806,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1794,6 +1795,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
fname, fnamecmpbuf);
}
sx.st.st_size = F_LENGTH(fuzzy_file);
statret = 0;
fnamecmp = fnamecmpbuf;
}
-@@ -1972,6 +1981,18 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1961,6 +1970,18 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
if (read_batch)
goto cleanup;
extern int protocol_version;
extern int force_change;
extern int file_total;
-@@ -110,6 +115,7 @@ int daemon_over_rsh = 0;
+@@ -111,6 +116,7 @@ int daemon_over_rsh = 0;
mode_t orig_umask = 0;
int batch_gen_fd = -1;
int sender_keeps_checksum = 0;
int raw_argc, cooked_argc;
char **raw_argv, **cooked_argv;
-@@ -660,6 +666,43 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
+@@ -667,6 +673,43 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
return 0; /* not reached */
}
/* The receiving side operates in one of two modes:
*
* 1. it receives any number of files into a destination directory,
-@@ -718,6 +761,9 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
+@@ -725,6 +768,9 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
exit_cleanup(RERR_FILESELECT);
}
filesystem_dev = st.st_dev; /* ensures --force works right w/-x */
return NULL;
}
if (file_total > 1) {
-@@ -778,7 +824,9 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
+@@ -784,7 +830,9 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
full_fname(dest_path));
exit_cleanup(RERR_FILESELECT);
}
return NULL;
}
-@@ -798,6 +846,9 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
+@@ -804,6 +852,9 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
full_fname(dest_path));
exit_cleanup(RERR_FILESELECT);
}
int preserve_perms = 0;
int preserve_fileflags = 0;
int preserve_executability = 0;
-@@ -893,6 +894,10 @@ static struct poptOption long_options[] = {
+@@ -892,6 +893,10 @@ static struct poptOption long_options[] = {
{"no-force-change", 0, POPT_ARG_VAL, &force_change, 0, 0, 0 },
{"force-uchange", 0, POPT_ARG_VAL, &force_change, USR_IMMUTABLE, 0, 0 },
{"force-schange", 0, POPT_ARG_VAL, &force_change, SYS_IMMUTABLE, 0, 0 },
{"ignore-errors", 0, POPT_ARG_VAL, &ignore_errors, 1, 0, 0 },
{"no-ignore-errors", 0, POPT_ARG_VAL, &ignore_errors, 0, 0, 0 },
{"max-delete", 0, POPT_ARG_INT, &max_delete, 0, 0, 0 },
-@@ -1187,6 +1192,10 @@ static void set_refuse_options(void)
+@@ -1186,6 +1191,10 @@ static void set_refuse_options(void)
#ifndef SUPPORT_CRTIMES
parse_one_refuse_match(0, "crtimes", list_end);
#endif
/* Now we use the descrip values to actually mark the options for refusal. */
for (op = long_options; op != list_end; op++) {
-@@ -2029,6 +2038,15 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2024,6 +2033,15 @@ int parse_arguments(int *argc_p, const char ***argv_p)
}
#endif
if (block_size) {
/* We may not know the real protocol_version at this point if this is the client
* option parsing, but we still want to check it so that the client can specify
-@@ -2644,6 +2662,11 @@ void server_options(char **args, int *argc_p)
+@@ -2639,6 +2657,11 @@ void server_options(char **args, int *argc_p)
if (preserve_fileflags)
args[ac++] = "--fileflags";
diff --git a/rsync.c b/rsync.c
--- a/rsync.c
+++ b/rsync.c
-@@ -607,8 +607,14 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -606,8 +606,14 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
#ifdef SUPPORT_XATTRS
if (am_root < 0)
set_stat_xattr(fname, file, new_mode);
#endif
if (!preserve_times
-@@ -622,7 +628,11 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -621,7 +627,11 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
/* Don't set the creation date on the root folder of an HFS+ volume. */
if (sxp->st.st_ino == 2 && S_ISDIR(sxp->st.st_mode))
flags |= ATTRS_SKIP_CRTIME;
sx2.st.st_mtime = file->modtime;
#ifdef ST_MTIME_NSEC
sx2.st.ST_MTIME_NSEC = F_MOD_NSEC_or_0(file);
-@@ -699,6 +709,16 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -698,6 +708,16 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
&& !set_fileflags(fname, fileflags))
goto cleanup;
updated = 1;
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -574,6 +574,17 @@ typedef unsigned int size_t;
+@@ -577,6 +577,17 @@ typedef unsigned int size_t;
#define ST_FLAGS(st) NO_FFLAGS
#endif
+
#define MAX_FULL_DATUM 32
- #define HAS_PREFIX(str, prfx) (*(str) == *(prfx) \
-@@ -74,6 +79,17 @@ extern int saw_xattr_filter;
+ #define HAS_PREFIX(str, prfx) (*(str) == *(prfx) && strncmp(str, prfx, sizeof (prfx) - 1) == 0)
+@@ -73,6 +78,17 @@ extern int saw_xattr_filter;
#define XDEF_ACL_SUFFIX "dacl"
#define XDEF_ACL_ATTR RSYNC_PREFIX "%" XDEF_ACL_SUFFIX
typedef struct {
char *datum, *name;
size_t datum_len, name_len;
-@@ -185,8 +201,7 @@ static ssize_t get_xattr_names(const char *fname)
+@@ -184,7 +200,7 @@ static ssize_t get_xattr_names(const char *fname)
/* On entry, the *len_ptr parameter contains the size of the extra space we
* should allocate when we create a buffer for the data. On exit, it contains
* the length of the datum. */
--static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr,
-- int no_missing_error)
+-static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr, int no_missing_error)
+static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr, int flags)
{
size_t datum_len = sys_lgetxattr(fname, name, NULL, 0);
size_t extra_len = *len_ptr;
-@@ -195,7 +210,7 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
+@@ -193,7 +209,7 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
*len_ptr = datum_len;
if (datum_len == (size_t)-1) {
return NULL;
rsyserr(FERROR_XFER, errno,
"get_xattr_data: lgetxattr(%s,\"%s\",0) failed",
-@@ -203,6 +218,15 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
+@@ -201,6 +217,15 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
return NULL;
}
if (!datum_len && !extra_len)
extra_len = 1; /* request non-zero amount of memory */
if (datum_len + extra_len < datum_len)
-@@ -231,7 +255,31 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
+@@ -229,7 +254,31 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
return ptr;
}
{
ssize_t list_len, name_len;
size_t datum_len, name_offset;
-@@ -240,7 +288,8 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
+@@ -238,7 +287,8 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
int user_only = am_sender ? 0 : !am_root;
#endif
rsync_xa *rxa;
/* This puts the name list into the "namebuf" buffer. */
if ((list_len = get_xattr_names(fname)) < 0)
-@@ -271,11 +320,15 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
+@@ -269,11 +319,15 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
}
datum_len = name_len; /* Pass extra size to get_xattr_data() */
name_offset = 1 + MAX_DIGEST_LEN;
sum_init(-1, checksum_seed);
sum_update(ptr, datum_len);
-@@ -284,7 +337,9 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
+@@ -282,7 +336,9 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
if (!(ptr = new_array(char, name_offset + name_len)))
out_of_memory("rsync_xal_get");
*ptr = XSTATE_ABBREV;
} else
name_offset = datum_len;
-@@ -330,7 +385,7 @@ int get_xattr(const char *fname, stat_x *sxp)
+@@ -328,7 +384,7 @@ int get_xattr(const char *fname, stat_x *sxp)
} else if (IS_MISSING_FILE(sxp->st))
return 0;
free_xattr(sxp);
return -1;
}
-@@ -367,6 +422,8 @@ int copy_xattrs(const char *source, const char *dest)
+@@ -365,6 +421,8 @@ int copy_xattrs(const char *source, const char *dest)
datum_len = 0;
if (!(ptr = get_xattr_data(source, name, &datum_len, 0)))
return -1;
if (sys_lsetxattr(dest, name, ptr, datum_len) < 0) {
int save_errno = errno ? errno : EINVAL;
rsyserr(FERROR_XFER, errno,
-@@ -457,6 +514,7 @@ static int find_matching_xattr(const item_list *xalp)
+@@ -455,6 +513,7 @@ static int find_matching_xattr(const item_list *xalp)
}
return -1;
}
/* Store *xalp on the end of rsync_xal_l */
-@@ -673,11 +731,13 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out)
+@@ -671,11 +730,13 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out)
/* Re-read the long datum. */
if (!(ptr = get_xattr_data(fname, rxa->name, &len, 0))) {
write_varint(f_out, len); /* length might have changed! */
write_bigbuf(f_out, ptr, len);
free(ptr);
-@@ -964,7 +1024,7 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
+@@ -962,7 +1023,7 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
int user_only = am_root <= 0;
#endif
size_t name_len;
/* This puts the current name list into the "namebuf" buffer. */
if ((list_len = get_xattr_names(fname)) < 0)
-@@ -977,7 +1037,10 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
+@@ -975,7 +1036,10 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
int sum_len;
/* See if the fnamecmp version is identical. */
len = name_len = rxas[i].name_len;
still_abbrev:
if (am_generator)
continue;
-@@ -986,6 +1049,8 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
+@@ -984,6 +1048,8 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
ret = -1;
continue;
}
if (len != rxas[i].datum_len) {
free(ptr);
goto still_abbrev;
-@@ -1063,6 +1128,10 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
+@@ -1061,6 +1127,10 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
}
}
return ret;
}
-@@ -1112,7 +1181,7 @@ char *get_xattr_acl(const char *fname, int is_access_acl, size_t *len_p)
+@@ -1109,7 +1179,7 @@ char *get_xattr_acl(const char *fname, int is_access_acl, size_t *len_p)
{
const char *name = is_access_acl ? XACC_ACL_ATTR : XDEF_ACL_ATTR;
*len_p = 0; /* no extra data alloc needed from get_xattr_data() */
}
int set_xattr_acl(const char *fname, int is_access_acl, const char *buf, size_t buf_len)
-@@ -1255,11 +1324,33 @@ int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode)
+@@ -1252,11 +1322,33 @@ int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode)
return 0;
}
return ret;
}
-@@ -1268,6 +1359,9 @@ int x_lstat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst)
+@@ -1265,6 +1357,9 @@ int x_lstat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst)
int ret = do_lstat(fname, fst);
if ((ret < 0 || get_stat_xattr(fname, -1, fst, xst) < 0) && xst)
xst->st_mode = 0;
return ret;
}
-@@ -1276,6 +1370,9 @@ int x_fstat(int fd, STRUCT_STAT *fst, STRUCT_STAT *xst)
+@@ -1273,6 +1368,9 @@ int x_fstat(int fd, STRUCT_STAT *fst, STRUCT_STAT *xst)
int ret = do_fstat(fd, fst);
if ((ret < 0 || get_stat_xattr(NULL, fd, fst, xst) < 0) && xst)
xst->st_mode = 0;
- Make this code handle multibyte character encodings, and honor the
--iconv setting when converting case.
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/exclude.c b/exclude.c
--- a/exclude.c
+++ b/exclude.c
int blocking_io = -1;
int checksum_seed = 0;
int inplace = 0;
-@@ -931,6 +932,8 @@ static struct poptOption long_options[] = {
+@@ -930,6 +931,8 @@ static struct poptOption long_options[] = {
{"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 },
{"only-write-batch", 0, POPT_ARG_STRING, &batch_name, OPT_ONLY_WRITE_BATCH, 0, 0 },
{"files-from", 0, POPT_ARG_STRING, &files_from, 0, 0, 0 },
{"from0", '0', POPT_ARG_VAL, &eol_nulls, 1, 0, 0},
{"no-from0", 0, POPT_ARG_VAL, &eol_nulls, 0, 0, 0},
-@@ -2741,6 +2744,9 @@ void server_options(char **args, int *argc_p)
+@@ -2736,6 +2739,9 @@ void server_options(char **args, int *argc_p)
args[ac++] = arg;
}
./configure
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
diff --git a/clientserver.c b/clientserver.c
--- a/clientserver.c
+++ b/clientserver.c
-@@ -132,7 +132,7 @@ int start_socket_client(char *host, int remote_argc, char *remote_argv[],
+@@ -131,7 +131,7 @@ int start_socket_client(char *host, int remote_argc, char *remote_argv[],
setup_iconv();
#endif
return ret ? ret : client_run(fd, fd, -1, argc, argv);
}
-@@ -211,7 +211,7 @@ static int exchange_protocols(int f_in, int f_out, char *buf, size_t bufsiz, int
+@@ -210,7 +210,7 @@ static int exchange_protocols(int f_in, int f_out, char *buf, size_t bufsiz, int
return 0;
}
{
int i, modlen;
char line[BIGPATHBUFLEN];
-@@ -297,6 +297,17 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
+@@ -296,6 +296,17 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
continue;
}
if (strcmp(line,"@RSYNCD: OK") == 0)
break;
-@@ -652,7 +663,12 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
+@@ -651,7 +662,12 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
}
read_only = lp_read_only(i); /* may also be overridden by auth_server() */
diff --git a/main.c b/main.c
--- a/main.c
+++ b/main.c
-@@ -1535,7 +1535,7 @@ static int start_client(int argc, char *argv[])
+@@ -1537,7 +1537,7 @@ static int start_client(int argc, char *argv[])
* remote shell command, we need to do the RSYNCD protocol first */
if (daemon_over_rsh) {
int tmpret;
./configure
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
extern char *logfile_format;
extern char *files_from;
extern char *tmpdir;
-@@ -632,6 +633,9 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
+@@ -631,6 +632,9 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
return -1;
}
DEBUG_WORD(HLINK, W_SND|W_REC, "Debug hard-link actions (levels 1-3)"),
DEBUG_WORD(ICONV, W_CLI|W_SRV, "Debug iconv character conversions (levels 1-2)"),
DEBUG_WORD(IO, W_CLI|W_SRV, "Debug I/O routines (levels 1-4)"),
-@@ -736,7 +738,7 @@ enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+@@ -735,7 +737,7 @@ enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT,
OPT_OLD_COMPRESS, OPT_NEW_COMPRESS, OPT_NO_COMPRESS,
OPT_REFUSED_BASE = 9000};
-@@ -891,6 +893,7 @@ static struct poptOption long_options[] = {
+@@ -890,6 +892,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 },
{"fuzzy", 'y', POPT_ARG_NONE, 0, 'y', 0, 0 },
{"no-fuzzy", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
{"no-y", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
-@@ -1342,6 +1345,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
- iconv_opt = strdup(arg);
- #endif
+@@ -1134,6 +1137,9 @@ static void set_refuse_options(void)
+ ref = cp + 1;
+ }
+ if (*lp_link_by_hash_dir(module_id))
-+ set_refuse_options("link-by-hash");
++ parse_one_refuse_match(0, "link-by-hash", list_end);
+
- /* TODO: Call poptReadDefaultConfig; handle errors. */
-
- /* The context leaks in case of an error, but if there's a
-@@ -1837,6 +1843,21 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+ if (am_daemon) {
+ #ifdef ICONV_OPTION
+ if (!*lp_charset(module_id))
+@@ -1832,6 +1838,21 @@ int parse_arguments(int *argc_p, const char ***argv_p)
return 0;
#endif
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -2141,6 +2162,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2136,6 +2157,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
tmpdir = sanitize_path(NULL, tmpdir, NULL, 0, SP_DEFAULT);
if (backup_dir)
backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, SP_DEFAULT);
}
if (daemon_filter_list.head && !am_sender) {
filter_rule_list *elp = &daemon_filter_list;
-@@ -2816,6 +2839,12 @@ void server_options(char **args, int *argc_p)
+@@ -2811,6 +2834,12 @@ void server_options(char **args, int *argc_p)
} else if (inplace)
args[ac++] = "--inplace";
extern int sanitize_paths;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct chmod_mode_struct *daemon_chmod_modes;
-@@ -736,6 +737,10 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -735,6 +736,10 @@ int finish_transfer(const char *fname, const char *fnametmp,
}
if (ret == 0) {
/* The file was moved into place (not copied), so it's done. */
fast fallback for the case where xxHash libraries are not available at
build time.
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
-@@ -712,10 +712,12 @@ static int generate_and_send_sums(int fd, OFF_T len, int f_out, int f_copy)
+@@ -708,10 +708,12 @@ static int generate_and_send_sums(int fd, OFF_T len, int f_out, int f_copy)
if (append_mode > 0 && f_copy < 0)
return 0;
for (i = 0; i < sum.count; i++) {
int32 n1 = (int32)MIN(len, (OFF_T)sum.blength);
-@@ -733,7 +735,7 @@ static int generate_and_send_sums(int fd, OFF_T len, int f_out, int f_copy)
+@@ -729,7 +731,7 @@ static int generate_and_send_sums(int fd, OFF_T len, int f_out, int f_copy)
}
sum1 = get_checksum1(map, n1);
if (DEBUG_GTE(DELTASUM, 3)) {
rprintf(FINFO,
-@@ -745,8 +747,10 @@ static int generate_and_send_sums(int fd, OFF_T len, int f_out, int f_copy)
+@@ -741,8 +743,10 @@ static int generate_and_send_sums(int fd, OFF_T len, int f_out, int f_copy)
write_buf(f_out, sum2, sum.s2length);
}
diff --git a/match.c b/match.c
--- a/match.c
+++ b/match.c
-@@ -167,6 +167,8 @@ static void hash_search(int f,struct sum_struct *s,
+@@ -166,6 +166,8 @@ static void hash_search(int f,struct sum_struct *s,
if (DEBUG_GTE(DELTASUM, 3))
rprintf(FINFO, "sum=%.8x k=%ld\n", sum, (long)k);
offset = aligned_offset = aligned_i = 0;
end = len + 1 - s->sums[s->count-1].len;
-@@ -229,7 +231,7 @@ static void hash_search(int f,struct sum_struct *s,
+@@ -228,7 +230,7 @@ static void hash_search(int f,struct sum_struct *s,
if (!done_csum2) {
map = (schar *)map_ptr(buf,offset,l);
done_csum2 = 1;
}
-@@ -271,7 +273,7 @@ static void hash_search(int f,struct sum_struct *s,
+@@ -270,7 +272,7 @@ static void hash_search(int f,struct sum_struct *s,
sum = get_checksum1((char *)map, l);
if (sum != s->sums[i].sum1)
goto check_want_i;
if (memcmp(sum2, s->sums[i].sum2, s->s2length) != 0)
goto check_want_i;
/* OK, we have a re-alignment match. Bump the offset
-@@ -339,6 +341,8 @@ static void hash_search(int f,struct sum_struct *s,
+@@ -337,6 +339,8 @@ static void hash_search(int f,struct sum_struct *s,
matched(f, s, buf, offset - s->blength, -2);
} while (++offset < end);
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/authenticate.c b/authenticate.c
--- a/authenticate.c
+++ b/authenticate.c
#ifdef HAVE_SIGACTION
static struct sigaction sigact;
-@@ -777,7 +779,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
+@@ -776,7 +778,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
log_init(1);
#ifdef HAVE_PUTENV
&& !getenv("RSYNC_NO_XFER_EXEC")) {
set_env_num("RSYNC_PID", (long)getpid());
-@@ -837,6 +839,45 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
+@@ -836,6 +838,45 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
return -1;
}
}
}
#endif
-@@ -1079,6 +1120,44 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
+@@ -1077,6 +1118,44 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
return 0;
}
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/access.c b/access.c
--- a/access.c
+++ b/access.c
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
extern int delete_mode;
extern int delete_before;
extern int delete_during;
-@@ -497,6 +498,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -494,6 +495,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
const char *xname)
{
if (statret >= 0) { /* A from-dest-dir statret can == 1! */
int keep_time = !preserve_times ? 0
: S_ISDIR(file->mode) ? preserve_times & PRESERVE_DIR_TIMES
: S_ISLNK(file->mode) ? preserve_times & PRESERVE_LINK_TIMES
-@@ -526,10 +528,11 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -523,9 +525,9 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
} else if (preserve_executability
&& ((sxp->st.st_mode & 0111 ? 1 : 0) ^ (file->mode & 0111 ? 1 : 0)))
iflags |= ITEM_REPORT_PERMS;
- if (uid_ndx && am_root && (uid_t)F_OWNER(file) != sxp->st.st_uid)
-+ if (uid_ndx && am_root && !omit_changes
-+ && (uid_t)F_OWNER(file) != sxp->st.st_uid)
++ if (uid_ndx && am_root && !omit_changes && (uid_t)F_OWNER(file) != sxp->st.st_uid)
iflags |= ITEM_REPORT_OWNER;
-- if (gid_ndx && !(file->flags & FLAG_SKIP_GROUP)
-- && sxp->st.st_gid != (gid_t)F_GROUP(file))
-+ if (gid_ndx && !omit_changes
-+ && !(file->flags & FLAG_SKIP_GROUP) && sxp->st.st_gid != (gid_t)F_GROUP(file))
+- if (gid_ndx && !(file->flags & FLAG_SKIP_GROUP) && sxp->st.st_gid != (gid_t)F_GROUP(file))
++ if (gid_ndx && !omit_changes && !(file->flags & FLAG_SKIP_GROUP) && sxp->st.st_gid != (gid_t)F_GROUP(file))
iflags |= ITEM_REPORT_GROUP;
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
-@@ -1414,7 +1417,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1410,7 +1412,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
real_ret = statret;
if (file->flags & FLAG_DIR_CREATED)
statret = -1;
- if (!preserve_perms) { /* See comment in non-dir code below. */
+ if (!preserve_perms || omit_dir_changes) { /* See comment in non-dir code below. */
- file->mode = dest_mode(file->mode, sx.st.st_mode,
- dflt_perms, statret == 0);
+ file->mode = dest_mode(file->mode, sx.st.st_mode, dflt_perms, statret == 0);
}
+ if (statret != 0 && basis_dir[0] != NULL) {
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
int one_file_system = 0;
int protocol_version = PROTOCOL_VERSION;
int sparse_files = 0;
-@@ -797,6 +798,7 @@ static struct poptOption long_options[] = {
+@@ -796,6 +797,7 @@ static struct poptOption long_options[] = {
{"omit-link-times", 'J', POPT_ARG_VAL, &omit_link_times, 1, 0, 0 },
{"no-omit-link-times",0, POPT_ARG_VAL, &omit_link_times, 0, 0, 0 },
{"no-J", 0, POPT_ARG_VAL, &omit_link_times, 0, 0, 0 },
{"modify-window", '@', 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 },
-@@ -2209,6 +2211,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2204,6 +2206,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
parse_filter_str(&filter_list, backup_dir_buf, rule_template(0), 0);
}
if (preserve_times) {
preserve_times = PRESERVE_FILE_TIMES;
if (!omit_dir_times)
-@@ -2461,6 +2466,8 @@ void server_options(char **args, int *argc_p)
+@@ -2456,6 +2461,8 @@ void server_options(char **args, int *argc_p)
argstr[x++] = 'O';
if (omit_link_times)
argstr[x++] = 'J';
extern int am_root;
extern int am_server;
extern int am_daemon;
-@@ -520,9 +521,11 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -519,9 +520,11 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
get_acl(fname, sxp);
#endif
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
size_t bwlimit_writemax = 0;
int ignore_existing = 0;
int ignore_non_existing = 0;
-@@ -921,6 +922,7 @@ static struct poptOption long_options[] = {
+@@ -920,6 +921,7 @@ static struct poptOption long_options[] = {
{"itemize-changes", 'i', POPT_ARG_NONE, 0, 'i', 0, 0 },
{"no-itemize-changes",0, POPT_ARG_VAL, &itemize_changes, 0, 0, 0 },
{"no-i", 0, POPT_ARG_VAL, &itemize_changes, 0, 0, 0 },
TODO: the configure changes should abort if the user requests --enable-slp
and we can't honor that request.
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
diff --git a/clientserver.c b/clientserver.c
--- a/clientserver.c
+++ b/clientserver.c
-@@ -1353,6 +1353,13 @@ int daemon_main(void)
+@@ -1351,6 +1351,13 @@ int daemon_main(void)
* address too. In fact, why not just do getnameinfo on the
* local address??? */
diff --git a/main.c b/main.c
--- a/main.c
+++ b/main.c
-@@ -1372,6 +1372,18 @@ static int start_client(int argc, char *argv[])
+@@ -1377,6 +1377,18 @@ static int start_client(int argc, char *argv[])
if (!read_batch) { /* for read_batch, NO source is specified */
char *path = check_for_hostspec(argv[0], &shell_machine, &rsync_port);
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -644,6 +644,11 @@ static void print_capabilities(enum logcode f)
+@@ -643,6 +643,11 @@ static void print_capabilities(enum logcode f)
#endif
"SIMD",
diff --git a/socket.c b/socket.c
--- a/socket.c
+++ b/socket.c
-@@ -544,6 +544,16 @@ void start_accept_loop(int port, int (*fn)(int, int))
+@@ -538,6 +538,16 @@ void start_accept_loop(int port, int (*fn)(int, int))
{
fd_set deffds;
int *sp, maxfd, i;
#ifdef HAVE_SIGACTION
sigact.sa_flags = SA_NOCLDSTOP;
-@@ -572,14 +582,25 @@ void start_accept_loop(int port, int (*fn)(int, int))
+@@ -565,14 +575,25 @@ void start_accept_loop(int port, int (*fn)(int, int))
maxfd = sp[i];
}
/* close log file before the potentially very long select so
* file can be trimmed by another process instead of growing
-@@ -592,7 +613,18 @@ void start_accept_loop(int port, int (*fn)(int, int))
+@@ -585,7 +606,18 @@ void start_accept_loop(int port, int (*fn)(int, int))
fds = deffds;
#endif
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/syscall.c b/syscall.c
--- a/syscall.c
+++ b/syscall.c
-- Matt McCutchen <hashproduct@gmail.com>
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
/**
* If 1, send the whole file as literal data rather than trying to
-@@ -924,6 +925,7 @@ static struct poptOption long_options[] = {
+@@ -923,6 +924,7 @@ static struct poptOption long_options[] = {
{"bwlimit", 0, POPT_ARG_STRING, &bwlimit_arg, OPT_BWLIMIT, 0, 0 },
{"no-bwlimit", 0, POPT_ARG_VAL, &bwlimit, 0, 0, 0 },
{"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 },
{"suffix", 0, POPT_ARG_STRING, &backup_suffix, 0, 0, 0 },
-@@ -2719,6 +2721,8 @@ void server_options(char **args, int *argc_p)
+@@ -2714,6 +2716,8 @@ void server_options(char **args, int *argc_p)
goto oom;
args[ac++] = arg;
}
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
extern int size_only;
extern OFF_T max_size;
extern OFF_T min_size;
-@@ -586,7 +587,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -582,7 +583,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
/* Perform our quick-check heuristic for determining if a file is unchanged. */
int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
{
diff --git a/main.c b/main.c
--- a/main.c
+++ b/main.c
-@@ -180,7 +180,7 @@ int shell_exec(const char *cmd)
+@@ -181,7 +181,7 @@ int shell_exec(const char *cmd)
}
/* Wait for a process to exit, calling io_flush while waiting. */
char *rsync_path = RSYNC_PATH;
char *backup_dir = NULL;
char backup_dir_buf[MAXPATHLEN];
-@@ -838,6 +841,7 @@ static struct poptOption long_options[] = {
+@@ -837,6 +840,7 @@ static struct poptOption long_options[] = {
{"chmod", 0, POPT_ARG_STRING, 0, OPT_CHMOD, 0, 0 },
{"ignore-times", 'I', POPT_ARG_NONE, &ignore_times, 0, 0, 0 },
{"size-only", 0, POPT_ARG_NONE, &size_only, 0, 0, 0 },
{"one-file-system", 'x', POPT_ARG_NONE, 0, 'x', 0, 0 },
{"no-one-file-system",0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
{"no-x", 0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
-@@ -964,6 +968,8 @@ static struct poptOption long_options[] = {
+@@ -963,6 +967,8 @@ static struct poptOption long_options[] = {
{"password-file", 0, POPT_ARG_STRING, &password_file, 0, 0, 0 },
{"blocking-io", 0, POPT_ARG_VAL, &blocking_io, 1, 0, 0 },
{"no-blocking-io", 0, POPT_ARG_VAL, &blocking_io, 0, 0, 0 },
{"outbuf", 0, POPT_ARG_STRING, &outbuf_mode, 0, 0, 0 },
{"remote-option", 'M', POPT_ARG_STRING, 0, 'M', 0, 0 },
{"protocol", 0, POPT_ARG_INT, &protocol_version, 0, 0, 0 },
-@@ -2344,6 +2350,16 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2339,6 +2345,16 @@ int parse_arguments(int *argc_p, const char ***argv_p)
}
}
if (files_from) {
char *h, *p;
int q;
-@@ -2728,6 +2744,25 @@ void server_options(char **args, int *argc_p)
+@@ -2723,6 +2739,25 @@ void server_options(char **args, int *argc_p)
else if (missing_args == 1 && !am_sender)
args[ac++] = "--ignore-missing-args";
extern char *logfile_name;
extern int remote_option_cnt;
extern const char **remote_options;
-@@ -178,3 +179,77 @@ pid_t local_child(int argc, char **argv, int *f_in, int *f_out,
+@@ -176,3 +177,77 @@ pid_t local_child(int argc, char **argv, int *f_in, int *f_out,
return pid;
}
progress_init();
while (1) {
-@@ -854,6 +874,9 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -853,6 +873,9 @@ int recv_files(int f_in, int f_out, char *local_name)
else if (!am_server && INFO_GTE(NAME, 1) && INFO_EQ(PROGRESS, 1))
rprintf(FINFO, "%s\n", fname);
/* recv file data */
recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size, fname, fd2, file, inplace || one_inplace);
-@@ -869,6 +892,16 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -868,6 +891,16 @@ int recv_files(int f_in, int f_out, char *local_name)
exit_cleanup(RERR_FILEIO);
}
if (DEBUG_GTE(SEND, 1))
rprintf(FINFO, "send_files starting\n");
-@@ -340,6 +361,7 @@ void send_files(int f_in, int f_out)
+@@ -338,6 +359,7 @@ void send_files(int f_in, int f_out)
exit_cleanup(RERR_PROTOCOL);
}
fd = do_open(fname, O_RDONLY, 0);
if (fd == -1) {
if (errno == ENOENT) {
-@@ -361,6 +383,33 @@ void send_files(int f_in, int f_out)
+@@ -357,6 +379,33 @@ void send_files(int f_in, int f_out)
continue;
}
/* map the local file */
if (do_fstat(fd, &st) != 0) {
io_error |= IOERR_GENERAL;
-@@ -413,6 +462,8 @@ void send_files(int f_in, int f_out)
+@@ -408,6 +457,8 @@ void send_files(int f_in, int f_out)
}
}
close(fd);
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/fileio.c b/fileio.c
--- a/fileio.c
+++ b/fileio.c
int preallocate_files = 0;
int do_compression = 0;
int do_compression_level = CLVL_NOT_SPECIFIED;
-@@ -850,6 +851,7 @@ static struct poptOption long_options[] = {
+@@ -849,6 +850,7 @@ static struct poptOption long_options[] = {
{"sparse", 'S', POPT_ARG_VAL, &sparse_files, 1, 0, 0 },
{"no-sparse", 0, POPT_ARG_VAL, &sparse_files, 0, 0, 0 },
{"no-S", 0, POPT_ARG_VAL, &sparse_files, 0, 0, 0 },
{"preallocate", 0, POPT_ARG_NONE, &preallocate_files, 0, 0, 0},
{"inplace", 0, POPT_ARG_VAL, &inplace, 1, 0, 0 },
{"no-inplace", 0, POPT_ARG_VAL, &inplace, 0, 0, 0 },
-@@ -2635,6 +2637,12 @@ void server_options(char **args, int *argc_p)
+@@ -2630,6 +2632,12 @@ void server_options(char **args, int *argc_p)
args[ac++] = arg;
}
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/io.c b/io.c
--- a/io.c
+++ b/io.c
int max_delete = INT_MIN;
OFF_T max_size = -1;
OFF_T min_size = -1;
-@@ -739,6 +740,7 @@ enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+@@ -738,6 +739,7 @@ enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG,
OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT,
OPT_OLD_COMPRESS, OPT_NEW_COMPRESS, OPT_NO_COMPRESS,
OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
-@@ -946,6 +948,8 @@ static struct poptOption long_options[] = {
+@@ -945,6 +947,8 @@ static struct poptOption long_options[] = {
{"no-timeout", 0, POPT_ARG_VAL, &io_timeout, 0, 0, 0 },
{"contimeout", 0, POPT_ARG_INT, &connect_timeout, 0, 0, 0 },
{"no-contimeout", 0, POPT_ARG_VAL, &connect_timeout, 0, 0, 0 },
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
{"rsync-path", 0, POPT_ARG_STRING, &rsync_path, 0, 0, 0 },
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
-@@ -1837,6 +1841,36 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1832,6 +1836,36 @@ int parse_arguments(int *argc_p, const char ***argv_p)
return 0;
#endif
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -2647,6 +2681,15 @@ void server_options(char **args, int *argc_p)
+@@ -2642,6 +2676,15 @@ void server_options(char **args, int *argc_p)
args[ac++] = arg;
}
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
#define MAX_BATCH_NAME_LEN 256 /* Must be less than MAXPATHLEN-13 */
char *batch_name = NULL;
-@@ -951,6 +952,7 @@ static struct poptOption long_options[] = {
+@@ -950,6 +951,7 @@ static struct poptOption long_options[] = {
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
{"iconv", 0, POPT_ARG_STRING, &iconv_opt, 0, 0, 0 },
{"no-iconv", 0, POPT_ARG_NONE, 0, OPT_NO_ICONV, 0, 0 },
{"ipv4", '4', POPT_ARG_VAL, &default_af_hint, AF_INET, 0, 0 },
{"ipv6", '6', POPT_ARG_VAL, &default_af_hint, AF_INET6, 0, 0 },
{"8-bit-output", '8', POPT_ARG_VAL, &allow_8bit_chars, 1, 0, 0 },
-@@ -2390,6 +2392,24 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2385,6 +2387,24 @@ int parse_arguments(int *argc_p, const char ***argv_p)
}
}
am_starting_up = 0;
return 1;
-@@ -2833,6 +2853,12 @@ void server_options(char **args, int *argc_p)
+@@ -2828,6 +2848,12 @@ void server_options(char **args, int *argc_p)
if (relative_paths && !implied_dirs && (!am_sender || protocol_version >= 30))
args[ac++] = "--no-implied-dirs";
+
0. `--ipv4`, `-4` or `--ipv6`, `-6`
- Tells rsync to prefer IPv4/IPv6 when creating sockets. This only affects
+ Tells rsync to prefer IPv4/IPv6 when creating sockets or running ssh. This
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/syscall.c b/syscall.c
--- a/syscall.c
+++ b/syscall.c
diff --git a/compat.c b/compat.c
--- a/compat.c
+++ b/compat.c
-@@ -529,13 +529,6 @@ void setup_protocol(int f_out,int f_in)
- if (protocol_version < 30) {
- if (append_mode == 1)
- append_mode = 2;
+@@ -543,13 +543,6 @@ void setup_protocol(int f_out,int f_in)
+ protocol_version);
+ exit_cleanup(RERR_PROTOCOL);
+ }
- if (preserve_xattrs && !local_server) {
- rprintf(FERROR,
-- "--xattrs requires protocol 30 or higher"
-- " (negotiated %d).\n",
-- protocol_version);
+- "--xattrs requires protocol 30 or higher"
+- " (negotiated %d).\n",
+- protocol_version);
- exit_cleanup(RERR_PROTOCOL);
- }
}
#define RSYNC_XAL_INITIAL 5
#define RSYNC_XAL_LIST_INITIAL 100
-@@ -274,7 +276,7 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
+@@ -272,7 +274,7 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
if (!(ptr = get_xattr_data(fname, name, &datum_len, 0)))
return -1;
/* For large datums, we store a flag and a checksum. */
name_offset = 1 + MAX_DIGEST_LEN;
sum_init(-1, checksum_seed);
-@@ -440,7 +442,7 @@ static int find_matching_xattr(const item_list *xalp)
+@@ -438,7 +440,7 @@ static int find_matching_xattr(const item_list *xalp)
|| rxas1[j].datum_len != rxas2[j].datum_len
|| strcmp(rxas1[j].name, rxas2[j].name))
break;
if (memcmp(rxas1[j].datum + 1,
rxas2[j].datum + 1,
MAX_DIGEST_LEN) != 0)
-@@ -510,13 +512,22 @@ int send_xattr(int f, stat_x *sxp)
+@@ -508,13 +510,22 @@ int send_xattr(int f, stat_x *sxp)
{
int ndx = find_matching_xattr(sxp->xattr);
for (rxa = sxp->xattr->items; count--; rxa++) {
size_t name_len = rxa->name_len;
const char *name = rxa->name;
-@@ -535,8 +546,8 @@ int send_xattr(int f, stat_x *sxp)
+@@ -533,8 +544,8 @@ int send_xattr(int f, stat_x *sxp)
name_len += UPRE_LEN;
}
#endif
#ifndef HAVE_LINUX_XATTRS
if (name_len > rxa->name_len) {
write_buf(f, USER_PREFIX, UPRE_LEN);
-@@ -544,7 +555,7 @@ int send_xattr(int f, stat_x *sxp)
+@@ -542,7 +553,7 @@ int send_xattr(int f, stat_x *sxp)
}
#endif
write_buf(f, name, name_len);
write_buf(f, rxa->datum + 1, MAX_DIGEST_LEN);
else
write_bigbuf(f, rxa->datum, rxa->datum_len);
-@@ -595,7 +606,7 @@ int xattr_diff(struct file_struct *file, stat_x *sxp, int find_all)
+@@ -593,7 +604,7 @@ int xattr_diff(struct file_struct *file, stat_x *sxp, int find_all)
cmp = rec_cnt ? strcmp(snd_rxa->name, rec_rxa->name) : -1;
if (cmp > 0)
same = 0;
same = cmp == 0 && snd_rxa->datum_len == rec_rxa->datum_len
&& memcmp(snd_rxa->datum + 1, rec_rxa->datum + 1,
MAX_DIGEST_LEN) == 0;
-@@ -641,6 +652,9 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out)
+@@ -639,6 +650,9 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out)
int cnt, prior_req = 0;
rsync_xa *rxa;
glst += F_XATTR(file);
lst = &glst->xa_items;
-@@ -700,6 +714,9 @@ int recv_xattr_request(struct file_struct *file, int f_in)
+@@ -698,6 +712,9 @@ int recv_xattr_request(struct file_struct *file, int f_in)
rsync_xa *rxa;
int rel_pos, cnt, num, got_xattr_data = 0;
if (F_XATTR(file) < 0) {
rprintf(FERROR, "recv_xattr_request: internal data error!\n");
exit_cleanup(RERR_PROTOCOL);
-@@ -786,7 +803,22 @@ void receive_xattr(int f, struct file_struct *file)
+@@ -784,7 +801,22 @@ void receive_xattr(int f, struct file_struct *file)
#else
int need_sort = 1;
#endif
if (ndx < 0 || (size_t)ndx > rsync_xal_l.count) {
rprintf(FERROR, "receive_xattr: xa index %d out of"
-@@ -799,7 +831,7 @@ void receive_xattr(int f, struct file_struct *file)
+@@ -797,7 +829,7 @@ void receive_xattr(int f, struct file_struct *file)
return;
}
(void)EXPAND_ITEM_LIST(&temp_xattr, rsync_xa, count);
temp_xattr.count = 0;
}
-@@ -807,9 +839,10 @@ void receive_xattr(int f, struct file_struct *file)
+@@ -805,9 +837,10 @@ void receive_xattr(int f, struct file_struct *file)
for (num = 1; num <= count; num++) {
char *ptr, *name;
rsync_xa *rxa;
./configure (optional if already run)
make
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: c528f8d5c8aa7b16b20cda72a9f4119699890c28
diff --git a/checksum.c b/checksum.c
--- a/checksum.c
+++ b/checksum.c