./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/acls.c b/acls.c
--- a/acls.c
+++ b/acls.c
Fix a bug that could lose some bits when stripping some (supposedly)
superfluous ACL info.
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
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: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/compat.c b/compat.c
--- a/compat.c
+++ b/compat.c
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -53,6 +53,7 @@ extern int preserve_specials;
+@@ -54,6 +54,7 @@ extern int preserve_specials;
extern int delete_during;
extern int missing_args;
extern int eol_nulls;
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
-@@ -500,6 +500,9 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -504,6 +504,9 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
: iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !(iflags & ITEM_MATCHED)
&& (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
iflags |= ITEM_REPORT_TIME;
#if !defined HAVE_LCHMOD && !defined HAVE_SETATTRLIST
if (S_ISLNK(file->mode)) {
;
-@@ -915,6 +918,8 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
+@@ -919,6 +922,8 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
if (link_dest) {
if (!hard_link_one(file, fname, cmpbuf, 1))
goto try_a_copy;
if (preserve_hard_links && F_IS_HLINKED(file))
finish_hard_link(file, fname, ndx, &sxp->st, itemizing, code, j);
if (!maybe_ATTRS_REPORT && (INFO_GTE(NAME, 2) || stdout_format_has_i > 1)) {
-@@ -1119,6 +1124,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
+@@ -1123,6 +1128,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
static void list_file_entry(struct file_struct *f)
{
char permbuf[PERMSTRING_SIZE];
int64 len;
int colwidth = human_readable ? 14 : 11;
-@@ -1134,10 +1140,12 @@ static void list_file_entry(struct file_struct *f)
+@@ -1138,10 +1144,12 @@ static void list_file_entry(struct file_struct *f)
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(f->mode)) {
} else
#endif
if (missing_args == 2 && f->mode == 0) {
-@@ -1145,9 +1153,12 @@ static void list_file_entry(struct file_struct *f)
+@@ -1149,9 +1157,12 @@ static void list_file_entry(struct file_struct *f)
colwidth + 31, "*missing",
f_name(f, NULL));
} else {
}
}
-@@ -2063,8 +2074,11 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
+@@ -2065,8 +2076,11 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
+ do_chmod(fname, file->mode);
if (need_retouch_dir_times) {
STRUCT_STAT st;
- if (link_stat(fname, &st, 0) == 0
-- && cmp_time(st.st_mtime, file->modtime) != 0)
+- if (link_stat(fname, &st, 0) == 0 && time_diff(&st, file))
- set_modtime(fname, file->modtime, F_MOD_NSEC(file), file->mode);
-+ && cmp_time(st.st_mtime, file->modtime) != 0) {
++ if (link_stat(fname, &st, 0) == 0 && time_diff(&st, file)) {
+ st.st_mtime = file->modtime;
+ st.ST_MTIME_NSEC = F_MOD_NSEC(file);
+ set_times(fname, &st);
diff --git a/log.c b/log.c
--- a/log.c
+++ b/log.c
-@@ -709,7 +709,8 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
+@@ -713,7 +713,8 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
c[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
c[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
c[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -707,6 +708,7 @@ void usage(enum logcode F)
+@@ -708,6 +709,7 @@ void usage(enum logcode F)
rprintf(F," --specials preserve special files\n");
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve modification times\n");
rprintf(F," -O, --omit-dir-times omit directories from --times\n");
rprintf(F," -J, --omit-link-times omit symlinks from --times\n");
rprintf(F," --super receiver attempts super-user activities\n");
-@@ -865,6 +867,9 @@ static struct poptOption long_options[] = {
+@@ -867,6 +869,9 @@ static struct poptOption long_options[] = {
{"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 },
{"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
{"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
{"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 },
-@@ -2437,6 +2442,8 @@ void server_options(char **args, int *argc_p)
+@@ -2441,6 +2446,8 @@ void server_options(char **args, int *argc_p)
argstr[x++] = 'D';
if (preserve_times)
argstr[x++] = 't';
-O, --omit-dir-times omit directories from --times
-J, --omit-link-times omit symlinks from --times
--super receiver attempts super-user activities
-@@ -1180,6 +1181,12 @@ cause the next transfer to behave as if it used bf(-I), causing all files to be
+@@ -1189,6 +1190,12 @@ cause the next transfer to behave as if it used bf(-I), causing all files to be
updated (though rsync's delta-transfer algorithm will make the update fairly efficient
if the files haven't actually changed, you're much better off using bf(-t)).
dit(bf(-O, --omit-dir-times)) This tells rsync to omit directories when
it is preserving modification times (see bf(--times)). If NFS is sharing
the directories on the receiving side, it is a good idea to use bf(-O).
-@@ -2137,7 +2144,10 @@ quote(itemization(
+@@ -2169,7 +2176,10 @@ quote(itemization(
sender's value (requires bf(--owner) and super-user privileges).
it() A bf(g) means the group is different and is being updated to the
sender's value (requires bf(--group) and the authority to set the group).
diff --git a/syscall.c b/syscall.c
--- a/syscall.c
+++ b/syscall.c
-@@ -349,15 +349,15 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
+@@ -351,15 +351,15 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
}
#ifdef HAVE_UTIMENSAT
t[1].tv_sec = modtime;
t[1].tv_nsec = mod_nsec;
return utimensat(AT_FDCWD, fname, t, AT_SYMLINK_NOFOLLOW);
-@@ -365,15 +365,15 @@ int do_utimensat(const char *fname, time_t modtime, uint32 mod_nsec)
+@@ -367,15 +367,15 @@ int do_utimensat(const char *fname, time_t modtime, uint32 mod_nsec)
#endif
#ifdef HAVE_LUTIMES
t[1].tv_sec = modtime;
t[1].tv_usec = mod_nsec / 1000;
return lutimes(fname, t);
-@@ -381,22 +381,22 @@ int do_lutimes(const char *fname, time_t modtime, uint32 mod_nsec)
+@@ -383,22 +383,22 @@ int do_lutimes(const char *fname, time_t modtime, uint32 mod_nsec)
#endif
#ifdef HAVE_UTIMES
{
#ifdef HAVE_STRUCT_UTIMBUF
struct utimbuf tbuf;
-@@ -408,11 +408,11 @@ int do_utime(const char *fname, time_t modtime, UNUSED(uint32 mod_nsec))
+@@ -410,11 +410,11 @@ int do_utime(const char *fname, time_t modtime, UNUSED(uint32 mod_nsec))
RETURN_ERROR_IF_RO_OR_LO;
# ifdef HAVE_STRUCT_UTIMBUF
diff --git a/tls.c b/tls.c
--- a/tls.c
+++ b/tls.c
-@@ -109,6 +109,8 @@ static int stat_xattr(const char *fname, STRUCT_STAT *fst)
+@@ -111,6 +111,8 @@ static int stat_xattr(const char *fname, STRUCT_STAT *fst)
#endif
static void failed(char const *what, char const *where)
{
fprintf(stderr, PROGRAM ": %s %s: %s\n",
-@@ -116,13 +118,38 @@ static void failed(char const *what, char const *where)
+@@ -118,13 +120,38 @@ static void failed(char const *what, char const *where)
exit(1);
}
if (do_lstat(fname, &buf) < 0)
failed("stat", fname);
-@@ -159,30 +186,17 @@ static void list_file(const char *fname)
+@@ -161,30 +188,17 @@ static void list_file(const char *fname)
}
permstring(permbuf, buf.st_mode);
/* TODO: Perhaps escape special characters in fname? */
-@@ -193,13 +207,14 @@ static void list_file(const char *fname)
+@@ -195,13 +209,14 @@ static void list_file(const char *fname)
(long)minor(buf.st_rdev));
} 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
-@@ -218,6 +233,7 @@ static void tls_usage(int ret)
+@@ -220,6 +235,7 @@ static void tls_usage(int ret)
fprintf(F,"usage: " PROGRAM " [OPTIONS] FILE ...\n");
fprintf(F,"Trivial file listing program for portably checking rsync\n");
fprintf(F,"\nOptions:\n");
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
-@@ -1794,7 +1794,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1797,7 +1797,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)))
-@@ -1830,7 +1830,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1833,7 +1833,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;
-@@ -1954,7 +1954,7 @@ int atomic_create(struct file_struct *file, char *fname, const char *slnk, const
+@@ -1957,7 +1957,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
-@@ -677,6 +677,7 @@ void usage(enum logcode F)
+@@ -678,6 +678,7 @@ void usage(enum logcode F)
rprintf(F," -R, --relative use relative path names\n");
rprintf(F," --no-implied-dirs don't send implied dirs with --relative\n");
rprintf(F," -b, --backup make backups (see --suffix & --backup-dir)\n");
rprintf(F," --backup-dir=DIR make backups into hierarchy based in DIR\n");
rprintf(F," --suffix=SUFFIX set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
rprintf(F," -u, --update skip files that are newer on the receiver\n");
-@@ -991,7 +992,8 @@ static struct poptOption long_options[] = {
+@@ -994,7 +995,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 },
-@@ -2598,6 +2600,10 @@ void server_options(char **args, int *argc_p)
+@@ -2608,6 +2610,10 @@ void server_options(char **args, int *argc_p)
}
if (am_sender) {
diff --git a/receiver.c b/receiver.c
--- a/receiver.c
+++ b/receiver.c
-@@ -422,7 +422,7 @@ static void handle_delayed_updates(char *local_name)
+@@ -418,7 +418,7 @@ static void handle_delayed_updates(char *local_name)
struct file_struct *file = cur_flist->files[ndx];
fname = local_name ? local_name : f_name(file, NULL);
if ((partialptr = partial_dir_fname(fname)) != NULL) {
continue;
if (DEBUG_GTE(RECV, 1)) {
rprintf(FINFO, "renaming %s to %s\n",
-@@ -735,7 +735,7 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -731,7 +731,7 @@ int recv_files(int f_in, int f_out, char *local_name)
} else {
/* Reminder: --inplace && --partial-dir are never
* enabled at the same time. */
+ if (make_backups > 1 && overwriting_basis) {
int ok = make_backup(fname, False);
if (!ok)
- return 1;
+ exit_cleanup(RERR_FILEIO);
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
--backup-dir=DIR make backups into hierarchy based in DIR
--suffix=SUFFIX backup suffix (default ~ w/o --backup-dir)
-u, --update skip files that are newer on the receiver
-@@ -780,6 +781,11 @@ in the list so that it has a high enough priority to be effective (e.g., if
+@@ -791,6 +792,11 @@ in the list so that it has a high enough priority to be effective (e.g., if
your rules specify a trailing inclusion/exclusion of '*', the auto-added
rule would never be reached).
unmake_file(file);
}
-@@ -156,7 +163,12 @@ static BOOL copy_valid_path(const char *fname)
+@@ -156,28 +163,34 @@ static BOOL copy_valid_path(const char *fname)
/* Make a complete pathname for backup file and verify any new path elements. */
char *get_backup_name(const char *fname)
{
+ char *suffix = deleting ? backup_suffix_dels : backup_suffix;
+
if (backup_dir) {
+ static int initialized = 0;
+- if (!initialized) {
+ int prefix_len = deleting ? backup_dir_dels_len : backup_dir_len;
+ unsigned int remainder = deleting ? backup_dir_dels_remainder : backup_dir_remainder;
- static int initialized = 0;
- if (!initialized) {
++ int init_bits = deleting ? 2 : 1;
++ if (!(initialized & init_bits)) {
int ret;
-@@ -170,14 +182,14 @@ char *get_backup_name(const char *fname)
- initialized = 1;
+- if (backup_dir_len > 1)
+- backup_dir_buf[backup_dir_len-1] = '\0';
+- ret = make_path(backup_dir_buf, 0);
+- if (backup_dir_len > 1)
+- backup_dir_buf[backup_dir_len-1] = '/';
++ if (prefix_len > 1)
++ buf[prefix_len-1] = '\0';
++ ret = make_path(buf, 0);
++ if (prefix_len > 1)
++ buf[prefix_len-1] = '/';
+ if (ret < 0)
+ return NULL;
+- initialized = 1;
++ initialized |= init_bits;
}
/* copy fname into backup_dir_buf while validating the dirs. */
- if (copy_valid_path(fname))
- if (stringjoin(backup_dir_buf, MAXPATHLEN, fname, backup_suffix, NULL) < MAXPATHLEN)
- return backup_dir_buf;
-+ if (stringjoin(backup_dir_buf, MAXPATHLEN, fname, suffix, NULL) < MAXPATHLEN)
++ if (stringjoin(buf, MAXPATHLEN, fname, suffix, NULL) < MAXPATHLEN)
+ return buf;
rprintf(FERROR, "backup filename too long\n");
return NULL;
-@@ -352,3 +364,13 @@ int make_backup(const char *fname, BOOL prefer_rename)
+@@ -352,3 +365,13 @@ int make_backup(const char *fname, BOOL prefer_rename)
rprintf(FINFO, "backed up %s to %s\n", fname, buf);
return ret;
}
char *sockopts = NULL;
char *usermap = NULL;
char *groupmap = NULL;
-@@ -680,6 +686,8 @@ void usage(enum logcode F)
+@@ -681,6 +687,8 @@ void usage(enum logcode F)
rprintf(F," --backup-deleted make backups only of deleted files\n");
rprintf(F," --backup-dir=DIR make backups into hierarchy based in DIR\n");
rprintf(F," --suffix=SUFFIX set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
rprintf(F," -u, --update skip files that are newer on the receiver\n");
rprintf(F," --inplace update destination files in-place (SEE MAN PAGE)\n");
rprintf(F," --append append data onto shorter files\n");
-@@ -996,7 +1004,9 @@ static struct poptOption long_options[] = {
+@@ -999,7 +1007,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 },
-@@ -2089,6 +2099,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2101,6 +2111,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;
-@@ -2110,6 +2122,14 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2122,6 +2134,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)
-@@ -2121,6 +2141,20 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2133,6 +2153,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] == '/')
-@@ -2156,6 +2190,34 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2168,6 +2202,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;
-@@ -2590,6 +2652,10 @@ void server_options(char **args, int *argc_p)
+@@ -2594,6 +2656,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) {
-@@ -2598,7 +2664,14 @@ void server_options(char **args, int *argc_p)
+@@ -2602,6 +2668,14 @@ void server_options(char **args, int *argc_p)
goto oom;
args[ac++] = arg;
}
--
+ /* Only send --suffix-dels if it specifies a value different from the
+ * --suffix value, which would normally be used for deletions too. */
+ if (strcmp(backup_suffix_dels, backup_suffix) != 0) {
+ goto oom;
+ args[ac++] = arg;
+ }
- if (am_sender) {
- /* A remote sender just needs the above -b option.
- * A remote receiver will override that with this option. */
+
+ if (checksum_choice) {
+ if (asprintf(&arg, "--checksum-choice=%s", checksum_choice) < 0)
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/errcode.h b/errcode.h
--- a/errcode.h
+++ b/errcode.h
diff --git a/log.c b/log.c
--- a/log.c
+++ b/log.c
-@@ -91,6 +91,7 @@ struct {
+@@ -93,6 +93,7 @@ struct {
{ RERR_TERMINATED , "sibling process terminated abnormally" },
{ RERR_SIGNAL1 , "received SIGUSR1" },
{ RERR_SIGNAL , "received SIGINT, SIGTERM, or SIGHUP" },
}
void write_del_stats(int f)
-@@ -1458,6 +1461,14 @@ void remember_children(UNUSED(int val))
+@@ -1466,6 +1469,14 @@ void remember_children(UNUSED(int val))
break;
}
}
}
#endif
#ifndef HAVE_SIGACTION
-@@ -1515,6 +1526,12 @@ static void rsync_panic_handler(UNUSED(int whatsig))
+@@ -1523,6 +1534,12 @@ static void rsync_panic_handler(UNUSED(int whatsig))
}
#endif
int main(int argc,char *argv[])
{
-@@ -1537,6 +1554,11 @@ int main(int argc,char *argv[])
+@@ -1545,6 +1562,11 @@ int main(int argc,char *argv[])
SIGACTMASK(SIGFPE, rsync_panic_handler);
SIGACTMASK(SIGABRT, rsync_panic_handler);
SIGACTMASK(SIGBUS, rsync_panic_handler);
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/clientserver.c b/clientserver.c
--- a/clientserver.c
+++ b/clientserver.c
extern int inc_recurse;
extern int always_checksum;
+extern int basis_dir_cnt;
+ extern int checksum_type;
extern int module_id;
extern int ignore_errors;
- extern int numeric_ids;
-@@ -58,6 +60,7 @@ extern int implied_dirs;
+@@ -59,6 +61,7 @@ extern int implied_dirs;
extern int ignore_perishable;
extern int non_perishable_cnt;
extern int prune_empty_dirs;
extern int copy_links;
extern int copy_unsafe_links;
extern int protocol_version;
-@@ -69,6 +72,7 @@ extern int sender_symlink_iconv;
+@@ -70,6 +73,7 @@ extern int sender_symlink_iconv;
extern int output_needs_newline;
extern int sender_keeps_checksum;
extern int unsort_ndx;
extern uid_t our_uid;
extern struct stats stats;
extern char *filesfrom_host;
-@@ -86,6 +90,20 @@ extern int filesfrom_convert;
+@@ -87,6 +91,20 @@ extern int filesfrom_convert;
extern iconv_t ic_send, ic_recv;
#endif
#define PTR_SIZE (sizeof (struct file_struct *))
int io_error;
-@@ -128,7 +146,11 @@ static char tmp_sum[MAX_DIGEST_LEN];
+@@ -129,7 +147,11 @@ static char tmp_sum[MAX_DIGEST_LEN];
static char empty_sum[MAX_DIGEST_LEN];
static int flist_count_offset; /* for --delete --progress */
extern int remove_source_files;
extern int delay_updates;
extern int update_only;
-@@ -569,7 +570,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -573,7 +574,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;
-@@ -578,7 +579,10 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
+@@ -582,7 +583,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), checksum_len) == 0;
}
-@@ -877,7 +881,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
+@@ -881,7 +885,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
match_level = 1;
/* FALL THROUGH */
case 1:
continue;
best_match = j;
match_level = 2;
-@@ -1184,7 +1188,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1188,7 +1192,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;
-@@ -1287,8 +1291,9 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1291,8 +1295,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);
-@@ -1296,7 +1301,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1300,7 +1305,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
}
parent_dirname = dn;
int i;
strlcpy(fnamecmpbuf, dn, sizeof fnamecmpbuf);
for (i = 0; i < fuzzy_basis; i++) {
-@@ -1308,7 +1313,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1312,7 +1317,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
fuzzy_dirlist[i] = NULL;
}
}
}
statret = link_stat(fname, &sx.st, keep_dirlinks && is_dir);
-@@ -1754,7 +1762,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1757,7 +1765,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
;
else if (fnamecmp_type == FNAMECMP_FUZZY)
;
int max_delete = INT_MIN;
OFF_T max_size = -1;
OFF_T min_size = -1;
-@@ -671,6 +672,7 @@ void usage(enum logcode F)
+@@ -672,6 +673,7 @@ void usage(enum logcode F)
rprintf(F," -q, --quiet suppress non-error messages\n");
rprintf(F," --no-motd suppress daemon-mode MOTD (see manpage caveat)\n");
rprintf(F," -c, --checksum skip based on checksum, not mod-time & size\n");
rprintf(F," -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)\n");
rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n");
rprintf(F," -r, --recursive recurse into directories\n");
-@@ -817,7 +819,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+@@ -819,7 +821,7 @@ enum {OPT_VERSION = 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_SERVER, OPT_REFUSED_BASE = 9000};
-@@ -957,6 +959,7 @@ static struct poptOption long_options[] = {
+@@ -960,6 +962,7 @@ static struct poptOption long_options[] = {
{"checksum", 'c', POPT_ARG_VAL, &always_checksum, 1, 0, 0 },
{"no-checksum", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
{"no-c", 0, POPT_ARG_VAL, &always_checksum, 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 },
-@@ -1673,6 +1676,23 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1676,6 +1679,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);
-@@ -1941,6 +1961,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1953,6 +1973,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
}
#endif
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
--no-OPTION turn off an implied OPTION (e.g. --no-D)
-r, --recursive recurse into directories
-@@ -619,9 +620,9 @@ uses a "quick check" that (by default) checks if each file's size and time
+@@ -630,9 +631,9 @@ uses a "quick check" that (by default) checks if each file's size and time
of last modification match between the sender and receiver. This option
changes this to compare a 128-bit checksum for each file that has a
matching size. Generating the checksums means that both sides will expend
The sending side generates its checksums while it is doing the file-system
scan that builds the list of the available files. The receiver generates
-@@ -629,6 +630,8 @@ its checksums when it is scanning for changed files, and will checksum any
+@@ -640,6 +641,8 @@ its checksums when it is scanning for changed files, and will checksum any
file that has the same size as the corresponding sender's file: files with
either a changed size or a changed checksum are selected for transfer.
Note that rsync always verifies that each em(transferred) file was
correctly reconstructed on the receiving side by checking a whole-file
checksum that is generated as the file is transferred, but that
-@@ -638,6 +641,36 @@ option's before-the-transfer "Does this file need to be updated?" check.
+@@ -649,6 +652,36 @@ option's before-the-transfer "Does this file need to be updated?" check.
For protocol 30 and beyond (first supported in 3.0.0), the checksum used is
MD5. For older protocols, the checksum used is MD4.
extern int am_root;
extern int am_server;
extern int am_daemon;
-@@ -106,6 +107,9 @@ extern iconv_t ic_send, ic_recv;
+@@ -107,6 +108,9 @@ extern iconv_t ic_send, ic_recv;
#define PTR_SIZE (sizeof (struct file_struct *))
int io_error;
int checksum_len;
dev_t filesystem_dev; /* used to implement -x */
-@@ -146,8 +150,13 @@ static char tmp_sum[MAX_DIGEST_LEN];
+@@ -147,8 +151,13 @@ static char tmp_sum[MAX_DIGEST_LEN];
static char empty_sum[MAX_DIGEST_LEN];
static int flist_count_offset; /* for --delete --progress */
static const char *solo_file = NULL;
enum nonregtype {
-@@ -580,7 +581,7 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st, int slot
+@@ -584,7 +585,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), checksum_len) == 0;
-@@ -1314,7 +1315,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1318,7 +1319,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
}
}
if (checksum_files) {
}
need_new_dirscan = 0;
}
-@@ -1488,6 +1490,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1492,6 +1494,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;
}
-@@ -1768,6 +1771,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1771,6 +1774,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);
if (itemizing)
itemize(fnamecmp, file, ndx, statret, &sx, 0, 0, NULL);
#ifdef SUPPORT_HARD_LINKS
-@@ -2262,6 +2267,7 @@ void generate_files(int f_out, const char *local_name)
+@@ -2264,6 +2269,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];
-@@ -2356,6 +2362,9 @@ void generate_files(int f_out, const char *local_name)
+@@ -2358,6 +2364,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
-@@ -1678,7 +1678,15 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1681,7 +1681,15 @@ int parse_arguments(int *argc_p, const char ***argv_p)
case OPT_SUMFILES:
arg = poptGetOptArg(pc);
diff --git a/receiver.c b/receiver.c
--- a/receiver.c
+++ b/receiver.c
-@@ -50,6 +50,7 @@ extern int preallocate_files;
+@@ -49,6 +49,7 @@ extern int sparse_files;
+ extern int preallocate_files;
extern int keep_partial;
- extern int checksum_len;
extern int checksum_seed;
+extern int checksum_files;
+ extern int whole_file;
extern int inplace;
extern int allowed_lull;
- extern int delay_updates;
-@@ -435,7 +436,7 @@ static void handle_delayed_updates(char *local_name)
+@@ -431,7 +432,7 @@ static void handle_delayed_updates(char *local_name)
"rename failed for %s (from %s)",
full_fname(fname), partialptr);
} else {
|| (preserve_hard_links && F_IS_HLINKED(file)))
send_msg_int(MSG_SUCCESS, ndx);
handle_partial_dir(partialptr, PDIR_DELETE);
-@@ -897,7 +898,7 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -893,7 +894,7 @@ int recv_files(int f_in, int f_out, char *local_name)
case 2:
break;
case 1:
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -650,9 +650,13 @@ computed just as it would be if bf(--sumfiles) was not specified.
+@@ -661,9 +661,13 @@ computed just as it would be if bf(--sumfiles) was not specified.
The MODE value is either "lax", for relaxed checking (which compares size
and mtime), "strict" (which also compares ctime and inode), or "none" to
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
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
-@@ -578,7 +578,8 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
+@@ -582,7 +582,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];
typedef struct {
char *datum, *name;
-@@ -247,7 +253,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;
}
-@@ -959,6 +967,39 @@ int del_def_xattr_acl(const char *fname)
+@@ -1120,6 +1128,39 @@ int del_def_xattr_acl(const char *fname)
}
#endif
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
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;
-@@ -778,6 +780,8 @@ void usage(enum logcode F)
+@@ -780,6 +782,8 @@ void usage(enum logcode F)
rprintf(F," --address=ADDRESS bind address for outgoing socket to daemon\n");
rprintf(F," --port=PORT specify double-colon alternate port number\n");
rprintf(F," --sockopts=OPTIONS specify custom TCP options\n");
rprintf(F," --blocking-io use blocking I/O for the remote shell\n");
rprintf(F," --stats give some file-transfer stats\n");
rprintf(F," -8, --8-bit-output leave high-bit chars unescaped in output\n");
-@@ -1038,6 +1042,8 @@ static struct poptOption long_options[] = {
+@@ -1041,6 +1045,8 @@ static struct poptOption long_options[] = {
#endif
{"remote-option", 'M', POPT_ARG_STRING, 0, 'M', 0, 0 },
{"protocol", 0, POPT_ARG_INT, &protocol_version, 0, 0, 0 },
{"checksum-seed", 0, POPT_ARG_INT, &checksum_seed, 0, 0, 0 },
{"server", 0, POPT_ARG_NONE, 0, OPT_SERVER, 0, 0 },
{"sender", 0, POPT_ARG_NONE, 0, OPT_SENDER, 0, 0 },
-@@ -1065,6 +1071,8 @@ static void daemon_usage(enum logcode F)
+@@ -1068,6 +1074,8 @@ static void daemon_usage(enum logcode F)
rprintf(F," --log-file=FILE override the \"log file\" setting\n");
rprintf(F," --log-file-format=FMT override the \"log format\" setting\n");
rprintf(F," --sockopts=OPTIONS specify custom TCP options\n");
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
extern int preserve_specials;
extern int preserve_hard_links;
extern int preserve_executability;
-@@ -1650,7 +1651,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1654,7 +1655,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
int preserve_links = 0;
int preserve_hard_links = 0;
int preserve_acls = 0;
-@@ -704,6 +705,7 @@ void usage(enum logcode F)
+@@ -705,6 +706,7 @@ void usage(enum logcode F)
rprintf(F," -o, --owner preserve owner (super-user only)\n");
rprintf(F," -g, --group preserve group\n");
rprintf(F," --devices preserve device files (super-user only)\n");
rprintf(F," --specials preserve special files\n");
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve modification times\n");
-@@ -885,6 +887,7 @@ static struct poptOption long_options[] = {
+@@ -887,6 +889,7 @@ static struct poptOption long_options[] = {
{"no-D", 0, POPT_ARG_NONE, 0, OPT_NO_D, 0, 0 },
{"devices", 0, POPT_ARG_VAL, &preserve_devices, 1, 0, 0 },
{"no-devices", 0, POPT_ARG_VAL, &preserve_devices, 0, 0, 0 },
{"specials", 0, POPT_ARG_VAL, &preserve_specials, 1, 0, 0 },
{"no-specials", 0, POPT_ARG_VAL, &preserve_specials, 0, 0, 0 },
{"links", 'l', POPT_ARG_VAL, &preserve_links, 1, 0, 0 },
-@@ -2762,6 +2765,9 @@ void server_options(char **args, int *argc_p)
+@@ -2773,6 +2776,9 @@ void server_options(char **args, int *argc_p)
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -54,6 +54,7 @@ extern int preserve_fileflags;
+@@ -55,6 +55,7 @@ extern int preserve_fileflags;
extern int delete_during;
extern int missing_args;
extern int eol_nulls;
extern int preserve_hard_links;
extern int preserve_executability;
extern int preserve_fileflags;
-@@ -384,8 +385,15 @@ static void do_delete_pass(void)
+@@ -384,6 +385,16 @@ static void do_delete_pass(void)
rprintf(FINFO, " \r");
}
--static inline int time_differs(struct file_struct *file, stat_x *sxp)
-+static inline int time_differs(struct file_struct *file, stat_x *sxp, const char *fname)
- {
-+ if (crtimes_ndx) {
-+ if (sxp->crtime == 0)
-+ sxp->crtime = get_create_time(fname);
-+ if (cmp_time(sxp->crtime, f_crtime(file)) != 0)
-+ return 1;
-+ }
++static inline int all_time_diff(stat_x *sxp, struct file_struct *file, const char *fname)
++{
++ int diff = time_diff(&sxp->st, file);
++ if (diff || !crtimes_ndx)
++ return diff;
++ if (sxp->crtime == 0)
++ sxp->crtime = get_create_time(fname);
++ return cmp_time(sxp->crtime, 0, f_crtime(file), 0);
++}
+
- return cmp_time(sxp->st.st_mtime, file->modtime);
- }
-
-@@ -443,7 +451,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
+ static inline int time_diff(STRUCT_STAT *stp, struct file_struct *file)
+ {
+ #ifdef ST_MTIME_NSEC
+@@ -447,7 +458,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
{
if (S_ISLNK(file->mode)) {
#ifdef CAN_SET_SYMLINK_TIMES
-- if (preserve_times & PRESERVE_LINK_TIMES && time_differs(file, sxp))
-+ if (preserve_times & PRESERVE_LINK_TIMES && time_differs(file, sxp, fname))
+- if (preserve_times & PRESERVE_LINK_TIMES && time_diff(&sxp->st, file))
++ if (preserve_times & PRESERVE_LINK_TIMES && all_time_diff(sxp, file, fname))
return 0;
#endif
#ifdef CAN_CHMOD_SYMLINK
-@@ -463,7 +471,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
+@@ -467,7 +478,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
return 0;
#endif
} else {
-- if (preserve_times && time_differs(file, sxp))
-+ if (preserve_times && time_differs(file, sxp, fname))
+- if (preserve_times && time_diff(&sxp->st, file))
++ if (preserve_times && all_time_diff(sxp, file, fname))
return 0;
if (perms_differ(file, sxp))
return 0;
-@@ -506,6 +514,12 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -510,6 +521,12 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
: iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !(iflags & ITEM_MATCHED)
&& (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
iflags |= ITEM_REPORT_TIME;
#if !defined HAVE_LCHMOD && !defined HAVE_SETATTRLIST
if (S_ISLNK(file->mode)) {
;
-@@ -1130,6 +1144,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
+@@ -1134,6 +1151,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
static void list_file_entry(struct file_struct *f)
{
char permbuf[PERMSTRING_SIZE];
int64 len;
int colwidth = human_readable ? 14 : 11;
-@@ -1145,10 +1160,12 @@ static void list_file_entry(struct file_struct *f)
+@@ -1149,10 +1167,12 @@ static void list_file_entry(struct file_struct *f)
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(f->mode)) {
} else
#endif
if (missing_args == 2 && f->mode == 0) {
-@@ -1156,9 +1173,12 @@ static void list_file_entry(struct file_struct *f)
+@@ -1160,9 +1180,12 @@ static void list_file_entry(struct file_struct *f)
colwidth + 31, "*missing",
f_name(f, NULL));
} else {
}
}
-@@ -1251,6 +1271,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1255,6 +1278,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
return;
}
}
diff --git a/log.c b/log.c
--- a/log.c
+++ b/log.c
-@@ -712,7 +712,8 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
+@@ -716,7 +716,8 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
c[8] = !(iflags & ITEM_REPORT_FFLAGS) ? '.' : 'f';
c[9] = !(iflags & ITEM_REPORT_ACL) ? '.' : 'a';
c[10] = !(iflags & ITEM_REPORT_XATTR) ? '.' : 'x';
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -716,6 +717,7 @@ void usage(enum logcode F)
+@@ -717,6 +718,7 @@ void usage(enum logcode F)
rprintf(F," --specials preserve special files\n");
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve modification times\n");
rprintf(F," -O, --omit-dir-times omit directories from --times\n");
rprintf(F," -J, --omit-link-times omit symlinks from --times\n");
rprintf(F," --super receiver attempts super-user activities\n");
-@@ -883,6 +885,9 @@ static struct poptOption long_options[] = {
+@@ -885,6 +887,9 @@ static struct poptOption long_options[] = {
{"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 },
{"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
{"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
{"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 },
-@@ -2463,6 +2468,8 @@ void server_options(char **args, int *argc_p)
+@@ -2467,6 +2472,8 @@ void server_options(char **args, int *argc_p)
argstr[x++] = 'D';
if (preserve_times)
argstr[x++] = 't';
-O, --omit-dir-times omit directories from --times
-J, --omit-link-times omit symlinks from --times
--super receiver attempts super-user activities
-@@ -1208,6 +1209,9 @@ cause the next transfer to behave as if it used bf(-I), causing all files to be
+@@ -1217,6 +1218,9 @@ cause the next transfer to behave as if it used bf(-I), causing all files to be
updated (though rsync's delta-transfer algorithm will make the update fairly efficient
if the files haven't actually changed, you're much better off using bf(-t)).
dit(bf(-O, --omit-dir-times)) This tells rsync to omit directories when
it is preserving modification times (see bf(--times)). If NFS is sharing
the directories on the receiving side, it is a good idea to use bf(-O).
-@@ -2110,7 +2114,7 @@ with older versions of rsync, but that also turns on the output of other
+@@ -2142,7 +2146,7 @@ with older versions of rsync, but that also turns on the output of other
verbose messages).
The "%i" escape has a cryptic output that is 11 letters long. The general
type of update being done, bf(X) is replaced by the file-type, and the
other letters represent attributes that may be output if they are being
modified.
-@@ -2169,6 +2173,8 @@ quote(itemization(
+@@ -2201,6 +2205,8 @@ quote(itemization(
it() The bf(f) means that the fileflags information changed.
it() The bf(a) means that the ACL information changed.
it() The bf(x) means that the extended attribute information changed.
diff --git a/syscall.c b/syscall.c
--- a/syscall.c
+++ b/syscall.c
-@@ -42,6 +42,13 @@ extern int force_change;
+@@ -44,6 +44,13 @@ extern int force_change;
extern int preserve_perms;
extern int preserve_executability;
#define RETURN_ERROR_IF(x,e) \
do { \
if (x) { \
-@@ -460,6 +467,36 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
+@@ -462,6 +469,36 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
#endif
}
diff --git a/tls.c b/tls.c
--- a/tls.c
+++ b/tls.c
-@@ -109,6 +109,8 @@ static int stat_xattr(const char *fname, STRUCT_STAT *fst)
+@@ -111,6 +111,8 @@ static int stat_xattr(const char *fname, STRUCT_STAT *fst)
#endif
static void failed(char const *what, char const *where)
{
fprintf(stderr, PROGRAM ": %s %s: %s\n",
-@@ -116,16 +118,44 @@ static void failed(char const *what, char const *where)
+@@ -118,16 +120,44 @@ static void failed(char const *what, char const *where)
exit(1);
}
#ifdef SUPPORT_XATTRS
if (am_root < 0)
stat_xattr(fname, &buf);
-@@ -159,30 +189,17 @@ static void list_file(const char *fname)
+@@ -161,30 +191,17 @@ static void list_file(const char *fname)
}
permstring(permbuf, buf.st_mode);
/* TODO: Perhaps escape special characters in fname? */
-@@ -193,13 +210,14 @@ static void list_file(const char *fname)
+@@ -195,13 +212,14 @@ static void list_file(const char *fname)
(long)minor(buf.st_rdev));
} 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
-@@ -218,6 +236,7 @@ static void tls_usage(int ret)
+@@ -220,6 +238,7 @@ static void tls_usage(int ret)
fprintf(F,"usage: " PROGRAM " [OPTIONS] FILE ...\n");
fprintf(F,"Trivial file listing program for portably checking rsync\n");
fprintf(F,"\nOptions:\n");
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/exclude.c b/exclude.c
--- a/exclude.c
+++ b/exclude.c
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
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;
-@@ -571,6 +572,9 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -575,6 +576,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)
{
int daemon_bwlimit = 0;
int bwlimit = 0;
int fuzzy_basis = 0;
-@@ -755,6 +756,7 @@ void usage(enum logcode F)
+@@ -757,6 +758,7 @@ void usage(enum logcode F)
rprintf(F," -I, --ignore-times don't skip files that match in size and mod-time\n");
rprintf(F," -M, --remote-option=OPTION send OPTION to the remote side only\n");
rprintf(F," --size-only skip files that match in size\n");
+ rprintf(F," --date-only skip files that match in mod-time\n");
- rprintf(F," --modify-window=NUM compare mod-times with reduced accuracy\n");
+ rprintf(F," -@, --modify-window=NUM set the accuracy for mod-time comparisons\n");
rprintf(F," -T, --temp-dir=DIR create temporary files in directory DIR\n");
rprintf(F," -y, --fuzzy find similar file for basis if no dest file\n");
-@@ -910,6 +912,7 @@ static struct poptOption long_options[] = {
+@@ -912,6 +914,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 },
-@@ -2649,6 +2652,9 @@ void server_options(char **args, int *argc_p)
+@@ -2659,6 +2662,9 @@ void server_options(char **args, int *argc_p)
else if (missing_args == 1 && !am_sender)
args[ac++] = "--ignore-missing-args";
+ if (date_only)
+ args[ac++] = "--date-only";
+
- if (modify_window_set) {
- if (asprintf(&arg, "--modify-window=%d", modify_window) < 0)
- goto oom;
+ if (modify_window_set && am_sender) {
+ char *fmt = modify_window < 0 ? "-@%d" : "--modify-window=%d";
+ if (asprintf(&arg, fmt, modify_window) < 0)
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -413,6 +413,7 @@ to the detailed description below for a complete description. verb(
+@@ -414,6 +414,7 @@ to the detailed description below for a complete description. verb(
--contimeout=SECONDS set daemon connection timeout in seconds
-I, --ignore-times don't skip files that match size and time
--size-only skip files that match in size
+ --date-only skip files that match in mod-time
- --modify-window=NUM compare mod-times with reduced accuracy
+ -@, --modify-window=NUM set the accuracy for mod-time comparisons
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
-@@ -605,6 +606,12 @@ time to just looking for files that have changed in size. This is useful
+@@ -606,6 +607,12 @@ time to just looking for files that have changed in size. This is useful
when starting to use rsync after using another mirroring system which may
not preserve timestamps exactly.
+timestamp, regardless of size. This may be useful when the remote
+files have passed through a size-changing filter, e.g. for encryption.
+
- dit(bf(--modify-window)) When comparing two timestamps, rsync treats the
+ dit(bf(-@, --modify-window)) When comparing two timestamps, rsync treats the
timestamps as being equal if they differ by no more than the modify-window
- value. This is normally 0 (for an exact match), but you may find it useful
+ value. The default is 0, which matches just integer seconds. If you specify a
./configure
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
+man: rsync.1 rsyncdb.1 rsyncd.conf.5 man-copy
man-copy:
- @-if test -f rsync.1; then :; else echo 'Copying srcdir rsync.1'; cp -p $(srcdir)/rsync.1 .; fi
-+ @-if test -f rsyncdb.1; then :; else echo 'Copying srcdir rsyncdb.1'; cp -p $(srcdir)/rsyncdb.1 .; fi
- @-if test -f rsyncd.conf.5; then :; else echo 'Copying srcdir rsyncd.conf.5'; cp -p $(srcdir)/rsyncd.conf.5 .; fi
+ @if test -f rsync.1; then :; elif test -f $(srcdir)/rsync.1; then echo 'Copying srcdir rsync.1'; cp -p $(srcdir)/rsync.1 .; else echo "NOTE: rsync.1 cannot be created."; fi
++ @if test -f rsyncdb.1; then :; elif test -f $(srcdir)/rsyncdb.1; then echo 'Copying srcdir rsyncdb.1'; cp -p $(srcdir)/rsyncdb.1 .; else echo "NOTE: rsyncdb.1 cannot be created."; fi
+ @if test -f rsyncd.conf.5; then :; elif test -f $(srcdir)/rsyncd.conf.5; then echo 'Copying srcdir rsyncd.conf.5'; cp -p $(srcdir)/rsyncd.conf.5 .; else echo "NOTE: rsyncd.conf.5 cannot be created."; fi
rsync.1: rsync.yo
yodl2man -o rsync.1 $(srcdir)/rsync.yo
extern int protocol_version;
extern int proper_seed_order;
+extern int use_db;
+ extern char *checksum_choice;
- /*
- a simple 32 bit checksum that can be upadted from either end
-@@ -136,6 +137,9 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
+ #define CSUM_NONE 0
+@@ -213,6 +214,9 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
md5_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
md5_result(&m, (uchar *)sum);
+
+ if (use_db)
+ db_set_checksum(5, st_p, sum);
- } else {
- mdfour_begin(&m);
-
-@@ -153,6 +157,9 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
+ break;
+ case CSUM_MD4:
+ case CSUM_MD4_OLD:
+@@ -233,6 +237,9 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
mdfour_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
mdfour_result(&m, (uchar *)sum);
+
+ if (use_db)
+ db_set_checksum(4, st_p, sum);
- }
-
- close(fd);
+ break;
+ default:
+ rprintf(FERROR, "invalid checksum-choice for the --checksum option (%d)\n", checksum_type);
diff --git a/cleanup.c b/cleanup.c
--- a/cleanup.c
+++ b/cleanup.c
netdb.h malloc.h float.h limits.h iconv.h libcharset.h langinfo.h \
sys/acl.h acl/libacl.h attr/xattr.h sys/xattr.h sys/extattr.h \
popt.h popt/popt.h linux/falloc.h netinet/in_systm.h netinet/ip.h \
-@@ -1068,6 +1069,48 @@ if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"
+@@ -1098,6 +1099,48 @@ if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"
fi
fi
new file mode 100644
--- /dev/null
+++ b/db.c
-@@ -0,0 +1,1913 @@
+@@ -0,0 +1,1912 @@
+/*
+ * Routines to access extended file info via DB.
+ *
+extern int same_db;
+extern int am_receiver;
+extern int am_generator;
-+extern int checksum_len;
+extern int db_clean, db_check, db_do_md4, db_do_md5, db_update, db_lax, db_init, db_mounts;
+extern int db_output_name, db_output_sum, db_output_info, db_output_unchanged, db_output_dirs, db_output_msgs;
+extern int saw_db_output_opt, saw_db_sum_opt;
+ binds[5].buffer = &bind_ctime;
+ binds[6].buffer_type = MYSQL_TYPE_BLOB;
+ binds[6].buffer = &bind_sum;
-+ binds[6].buffer_length = checksum_len;
++ binds[6].buffer_length = MD5_DIGEST_LEN; /* Same as MD4_DIGEST_LEN */
+ if (!prepare_mysql(REP_SUM, binds, 7, sql))
+ return 0;
+
+
+ binds[0].buffer_type = MYSQL_TYPE_BLOB;
+ binds[0].buffer = sum;
-+ binds[0].buffer_length = checksum_len;
++ binds[0].buffer_length = MD5_DIGEST_LEN;
+ ok = fetch_mysql(binds, 1, SEL_SUM, 1, NULL);
+ break;
+ }
+ if (ok) {
+ rprintf(FCLIENT, "[%s] Found DB checksum for %s,%s,%d: %s\n",
+ who_am_i(), big_num(st_p->st_dev),
-+ big_num(st_p->st_ino), md_num, sum_as_hex(sum));
++ big_num(st_p->st_ino), md_num, sum_as_hex(md_num, sum));
+ } else {
+ rprintf(FCLIENT, "[%s] No DB checksum for %s,%s,%d\n",
+ who_am_i(), big_num(st_p->st_dev),
+
+ binds[0].buffer_type = MYSQL_TYPE_BLOB;
+ binds[0].buffer = dbsum;
-+ binds[0].buffer_length = checksum_len;
++ binds[0].buffer_length = MD5_DIGEST_LEN;
+ binds[1].buffer_type = MYSQL_TYPE_LONG;
+ binds[1].buffer = (char*)sum_type;
+ binds[2].buffer_type = MYSQL_TYPE_LONGLONG;
+ if (sqlite3_step(stmt) != SQLITE_ROW)
+ break;
+ len = sqlite3_column_bytes(stmt, 0);
-+ if (len > checksum_len)
-+ len = checksum_len;
-+ memcpy(dbsum + checksum_len*j, sqlite3_column_blob(stmt, 0), len);
++ if (len > MD5_DIGEST_LEN)
++ len = MD5_DIGEST_LEN;
++ memcpy(dbsum + MD5_DIGEST_LEN*j, sqlite3_column_blob(stmt, 0), len);
+ sum_type[j] = sqlite3_column_int(stmt, 1);
+ dbsize[j] = sqlite3_column_int(stmt, 2);
+ dbmtime[j] = sqlite3_column_int64(stmt, 3);
+ for (j = 0; j < rows; j++) {
+ if (DEBUG_GTE(DB, 3)) {
+ rprintf(FCLIENT, "DB checksum for %s,%s,%d: %s\n",
-+ big_num(st_p->st_dev), big_num(st_p->st_ino), sum_type[j], sum_as_hex(dbsum + checksum_len*j));
++ big_num(st_p->st_dev), big_num(st_p->st_ino), sum_type[j],
++ sum_as_hex(sum_type[j], dbsum + MD5_DIGEST_LEN*j));
+ }
+
+ if (sum_type[j] == 4) {
+ if (!sum4)
+ continue;
-+ *sum4 = dbsum + checksum_len*j;
++ *sum4 = dbsum + MD5_DIGEST_LEN*j;
+ } else {
+ if (!sum5)
+ continue;
-+ *sum5 = dbsum + checksum_len*j;
++ *sum5 = dbsum + MD5_DIGEST_LEN*j;
+ }
+ if (st_p->st_size == dbsize[j] && st_p->st_mtime == dbmtime[j] && (db_lax || st_p->st_ctime == dbctime[j]))
+ ++*right_sum_cnt;
+ bind_size = st_p->st_size;
+ bind_mtime = st_p->st_mtime;
+ bind_ctime = st_p->st_ctime;
-+ memcpy(bind_sum, sum, checksum_len);
++ memcpy(bind_sum, sum, MD5_DIGEST_LEN);
+ if (exec_mysql(REP_SUM) == NULL)
+ errmsg = mysql_error(dbh.mysql);
+ break;
+ sqlite3_bind_int64(stmt, 4, st_p->st_size);
+ sqlite3_bind_int64(stmt, 5, st_p->st_mtime);
+ sqlite3_bind_int64(stmt, 6, st_p->st_ctime);
-+ sqlite3_bind_blob(stmt, 7, sum, checksum_len, SQLITE_TRANSIENT);
++ sqlite3_bind_blob(stmt, 7, sum, MD5_DIGEST_LEN, SQLITE_TRANSIENT);
+ while (1) {
+ rc = sqlite3_step(stmt);
+ if (rc != SQLITE_BUSY && rc != SQLITE_LOCKED)
+ if (DEBUG_GTE(DB, 2)) {
+ rprintf(FCLIENT, "[%s] Set DB checksum for %s,%s,%d: %s\n",
+ who_am_i(), big_num(st_p->st_dev), big_num(st_p->st_ino),
-+ md_num, sum_as_hex(sum));
++ md_num, sum_as_hex(md_num, sum));
+ }
+ } else {
+ rprintf(log_code, "[%s] Failed to set checksum for %s,%s,%d: %s (%d) -- closing DB\n",
+
+static inline int sums_ne(const char *sum1, const char *sum2)
+{
-+ return memcmp(sum1, sum2, checksum_len) != 0;
++ return memcmp(sum1, sum2, MD5_DIGEST_LEN) != 0;
+}
+
+/* Returns 1 if there is a checksum change, else 0. */
+ }
+ if (db_output_sum) {
+ if (db_do_md4)
-+ printf("%s ", sum_as_hex(sum4));
++ printf("%s ", sum_as_hex(4, sum4));
+ if (db_do_md5)
-+ printf("%s ", sum_as_hex(sum5));
++ printf("%s ", sum_as_hex(5, sum5));
+ }
+ if (db_output_name) {
+ if (db_output_sum)
+ struct name_list *names;
+ int exit_code = 0;
+
-+ checksum_len = MD5_DIGEST_LEN; /* Same as MD4_DIGEST_LEN */
+ protocol_version = 31;
+
+ need_sum_cnt = db_do_md4 + db_do_md5;
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -52,6 +52,7 @@ extern int preserve_devices;
+@@ -53,6 +53,7 @@ extern int preserve_devices;
extern int preserve_specials;
extern int delete_during;
extern int missing_args;
extern int append_mode;
extern int make_backups;
extern int csum_length;
-@@ -578,7 +579,8 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
+@@ -582,7 +583,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), checksum_len) == 0;
}
-@@ -2223,6 +2225,13 @@ void generate_files(int f_out, const char *local_name)
+@@ -2225,6 +2227,13 @@ void generate_files(int f_out, const char *local_name)
: "enabled");
}
dflt_perms = (ACCESSPERMS & ~orig_umask);
do {
-@@ -2348,6 +2357,9 @@ void generate_files(int f_out, const char *local_name)
+@@ -2350,6 +2359,9 @@ void generate_files(int f_out, const char *local_name)
wait_for_receiver();
}
extern char *shell_cmd;
extern char *batch_name;
extern char *password_file;
-@@ -1092,6 +1095,9 @@ void start_server(int f_in, int f_out, int argc, char *argv[])
+@@ -1100,6 +1103,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)
-@@ -1373,6 +1379,9 @@ static int start_client(int argc, char *argv[])
+@@ -1381,6 +1387,9 @@ static int start_client(int argc, char *argv[])
}
}
int connect_timeout = 0;
int keep_partial = 0;
int safe_symlinks = 0;
-@@ -270,6 +275,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = {
+@@ -271,6 +276,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = {
DEBUG_WORD(CHDIR, W_CLI|W_SRV, "Debug when the current directory changes"),
DEBUG_WORD(CONNECT, W_CLI, "Debug connection events (levels 1-2)"),
DEBUG_WORD(CMD, W_CLI, "Debug commands+options that are issued (levels 1-2)"),
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"),
-@@ -572,6 +578,7 @@ static void print_rsync_version(enum logcode f)
+@@ -573,6 +579,7 @@ static void print_rsync_version(enum logcode f)
char const *links = "no ";
char const *iconv = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -608,6 +615,11 @@ static void print_rsync_version(enum logcode f)
+@@ -609,6 +616,11 @@ static void print_rsync_version(enum logcode f)
#ifdef CAN_SET_SYMLINK_TIMES
symtimes = "";
#endif
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -621,8 +633,8 @@ static void print_rsync_version(enum logcode f)
+@@ -622,8 +634,8 @@ static void print_rsync_version(enum logcode f)
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -671,6 +683,9 @@ void usage(enum logcode F)
+@@ -672,6 +684,9 @@ void usage(enum logcode F)
rprintf(F," -q, --quiet suppress non-error messages\n");
rprintf(F," --no-motd suppress daemon-mode MOTD (see manpage caveat)\n");
rprintf(F," -c, --checksum skip based on checksum, not mod-time & size\n");
rprintf(F," -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)\n");
rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n");
rprintf(F," -r, --recursive recurse into directories\n");
-@@ -818,6 +833,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+@@ -820,6 +835,7 @@ enum {OPT_VERSION = 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_SERVER, OPT_REFUSED_BASE = 9000};
-@@ -957,6 +973,10 @@ static struct poptOption long_options[] = {
+@@ -960,6 +976,10 @@ static struct poptOption long_options[] = {
{"checksum", 'c', POPT_ARG_VAL, &always_checksum, 1, 0, 0 },
{"no-checksum", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
{"no-c", 0, POPT_ARG_VAL, &always_checksum, 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 },
-@@ -1047,6 +1067,9 @@ static struct poptOption long_options[] = {
+@@ -1050,6 +1070,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}
};
-@@ -1100,6 +1123,50 @@ static struct poptOption long_daemon_options[] = {
+@@ -1103,6 +1126,50 @@ static struct poptOption long_daemon_options[] = {
{0,0,0,0, 0, 0, 0}
};
static char err_buf[200];
-@@ -1278,6 +1345,100 @@ static void create_refuse_error(int which)
+@@ -1281,6 +1348,100 @@ static void create_refuse_error(int which)
}
}
/**
* Process command line arguments. Called on both local and remote.
-@@ -1295,10 +1456,18 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1298,10 +1459,18 @@ int parse_arguments(int *argc_p, const char ***argv_p)
int argc = *argc_p;
int opt;
#ifdef ICONV_OPTION
if (!*lp_charset(module_id))
set_refuse_options("iconv");
-@@ -1421,6 +1590,12 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1424,6 +1593,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
-@@ -1495,6 +1670,10 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1498,6 +1673,10 @@ int parse_arguments(int *argc_p, const char ***argv_p)
preserve_devices = preserve_specials = 0;
break;
extern int am_root;
extern int am_server;
extern int inc_recurse;
-@@ -435,6 +437,11 @@ static void handle_delayed_updates(char *local_name)
+@@ -431,6 +433,11 @@ static void handle_delayed_updates(char *local_name)
"rename failed for %s (from %s)",
full_fname(fname), partialptr);
} else {
if (remove_source_files
|| (preserve_hard_links && F_IS_HLINKED(file)))
send_msg_int(MSG_SUCCESS, ndx);
-@@ -541,6 +548,9 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -537,6 +544,9 @@ int recv_files(int f_in, int f_out, char *local_name)
if (delay_updates)
delayed_bits = bitbag_create(cur_flist->used + 1);
while (1) {
cleanup_disable();
-@@ -869,6 +879,8 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -865,6 +875,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) {
if (!handle_partial_dir(partialptr, PDIR_CREATE)) {
rprintf(FERROR,
-@@ -882,6 +894,8 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -878,6 +890,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);
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
--no-OPTION turn off an implied OPTION (e.g. --no-D)
-r, --recursive recurse into directories
-@@ -638,6 +641,67 @@ option's before-the-transfer "Does this file need to be updated?" check.
+@@ -649,6 +652,67 @@ option's before-the-transfer "Does this file need to be updated?" check.
For protocol 30 and beyond (first supported in 3.0.0), the checksum used is
MD5. For older protocols, the checksum used is MD4.
diff = u_strcmp(fmid->basename, f->basename);
if (diff == 0) {
good_match = mid;
-@@ -1939,6 +1941,21 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1942,6 +1944,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
-@@ -760,6 +760,8 @@ void usage(enum logcode F)
+@@ -762,6 +762,8 @@ void usage(enum logcode F)
rprintf(F," -T, --temp-dir=DIR create temporary files in directory DIR\n");
rprintf(F," -y, --fuzzy find similar file for basis if no dest file\n");
rprintf(F," --detect-renamed try to find renamed files to speed up the transfer\n");
rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n");
rprintf(F," --copy-dest=DIR ... and include copies of unchanged files\n");
rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n");
-@@ -963,7 +965,9 @@ static struct poptOption long_options[] = {
+@@ -966,7 +968,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 },
-@@ -2636,8 +2640,14 @@ void server_options(char **args, int *argc_p)
+@@ -2646,8 +2650,14 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--super";
if (size_only)
args[ac++] = "--size-only";
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -417,6 +417,8 @@ to the detailed description below for a complete description. verb(
+@@ -418,6 +418,8 @@ to the detailed description below for a complete description. verb(
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
--detect-renamed try to find renamed files to speed the xfer
--compare-dest=DIR also compare received files relative to DIR
--copy-dest=DIR ... and include copies of unchanged files
--link-dest=DIR hardlink to files in DIR when unchanged
-@@ -1816,6 +1818,17 @@ the bf(--partial-dir) option, that directory will be used instead. These
+@@ -1848,6 +1850,17 @@ the bf(--partial-dir) option, that directory will be used instead. These
potential alternate-basis files will be removed as the transfer progresses.
This option conflicts with bf(--inplace) and bf(--append).
a file that can't use it, while missing out on giving it to a file
that could use it.
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/backup.c b/backup.c
--- a/backup.c
+++ b/backup.c
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -60,6 +60,7 @@ extern int non_perishable_cnt;
+@@ -61,6 +61,7 @@ extern int non_perishable_cnt;
extern int prune_empty_dirs;
extern int copy_links;
extern int copy_unsafe_links;
extern int protocol_version;
extern int sanitize_paths;
extern int munge_symlinks;
-@@ -125,6 +126,8 @@ static int64 tmp_dev = -1, tmp_ino;
+@@ -126,6 +127,8 @@ static int64 tmp_dev = -1, tmp_ino;
#endif
static char tmp_sum[MAX_DIGEST_LEN];
+ rprintf(FINFO, "found renamed: %s => %s\n", fname, fn);
+}
+
- static inline int time_differs(struct file_struct *file, stat_x *sxp)
+ static inline int time_diff(STRUCT_STAT *stp, struct file_struct *file)
{
- return cmp_time(sxp->st.st_mtime, file->modtime);
-@@ -1151,6 +1292,7 @@ static void list_file_entry(struct file_struct *f)
+ #ifdef ST_MTIME_NSEC
+@@ -1155,6 +1296,7 @@ static void list_file_entry(struct file_struct *f)
}
}
static int phase = 0;
static int dflt_perms;
-@@ -1273,7 +1415,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1277,7 +1419,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));
-@@ -1426,7 +1568,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",
-@@ -1475,9 +1617,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1479,9 +1621,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;
-@@ -1743,8 +1888,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1746,8 +1891,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;
-@@ -2204,6 +2355,12 @@ void generate_files(int f_out, const char *local_name)
+@@ -2206,6 +2357,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) {
-@@ -2214,7 +2371,7 @@ void generate_files(int f_out, const char *local_name)
+@@ -2216,7 +2373,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",
-@@ -2250,7 +2407,7 @@ void generate_files(int f_out, const char *local_name)
+@@ -2252,7 +2409,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));
}
-@@ -2297,7 +2454,21 @@ void generate_files(int f_out, const char *local_name)
+@@ -2299,7 +2456,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;
-@@ -758,6 +759,7 @@ void usage(enum logcode F)
- rprintf(F," --modify-window=NUM compare mod-times with reduced accuracy\n");
+@@ -760,6 +761,7 @@ void usage(enum logcode F)
+ rprintf(F," -@, --modify-window=NUM set the accuracy for mod-time comparisons\n");
rprintf(F," -T, --temp-dir=DIR create temporary files in directory DIR\n");
rprintf(F," -y, --fuzzy find similar file for basis if no dest file\n");
+ rprintf(F," --detect-renamed try to find renamed files to speed up the transfer\n");
rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n");
rprintf(F," --copy-dest=DIR ... and include copies of unchanged files\n");
rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n");
-@@ -961,6 +963,7 @@ static struct poptOption long_options[] = {
+@@ -964,6 +966,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 },
-@@ -2246,7 +2249,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2250,7 +2253,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
inplace = 1;
}
partial_dir = tmp_partialdir;
if (inplace) {
-@@ -2255,6 +2258,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2259,6 +2262,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;
}
-@@ -2632,6 +2636,8 @@ void server_options(char **args, int *argc_p)
+@@ -2642,6 +2646,8 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--super";
if (size_only)
args[ac++] = "--size-only";
diff --git a/receiver.c b/receiver.c
--- a/receiver.c
+++ b/receiver.c
-@@ -212,7 +212,7 @@ int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file)
+@@ -216,7 +216,7 @@ int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file)
* information should have been previously transferred, but that may
* not be the case with -R */
if (fd == -1 && relative_paths && errno == ENOENT
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -416,6 +416,7 @@ to the detailed description below for a complete description. verb(
- --modify-window=NUM compare mod-times with reduced accuracy
+@@ -417,6 +417,7 @@ to the detailed description below for a complete description. verb(
+ -@, --modify-window=NUM set the accuracy for mod-time comparisons
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
+ --detect-renamed try to find renamed files to speed the xfer
--compare-dest=DIR also compare received files relative to DIR
--copy-dest=DIR ... and include copies of unchanged files
--link-dest=DIR hardlink to files in DIR when unchanged
-@@ -1800,6 +1801,21 @@ Note that the use of the bf(--delete) option might get rid of any potential
+@@ -1832,6 +1833,21 @@ Note that the use of the bf(--delete) option might get rid of any potential
fuzzy-match files, so either use bf(--delete-after) or specify some
filename exclusions if you need to prevent this.
ret = -ret - 1;
else
ret++;
-@@ -1133,6 +1133,32 @@ char *normalize_path(char *path, BOOL force_newbuf, unsigned int *len_ptr)
+@@ -1159,6 +1159,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
-@@ -1226,7 +1252,7 @@ int handle_partial_dir(const char *fname, int create)
+@@ -1252,7 +1278,7 @@ int handle_partial_dir(const char *fname, int create)
}
statret = -1;
}
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
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;
-@@ -745,6 +746,7 @@ void usage(enum logcode F)
+@@ -747,6 +748,7 @@ void usage(enum logcode F)
rprintf(F," --partial keep partially transferred files\n");
rprintf(F," --partial-dir=DIR put a partially transferred file into DIR\n");
rprintf(F," --delay-updates put all updated files into place at transfer's end\n");
rprintf(F," -m, --prune-empty-dirs prune empty directory chains from the file-list\n");
rprintf(F," --numeric-ids don't map uid/gid values by user/group name\n");
rprintf(F," --usermap=STRING custom username mapping\n");
-@@ -979,6 +981,8 @@ static struct poptOption long_options[] = {
+@@ -982,6 +984,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 },
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -404,6 +404,7 @@ to the detailed description below for a complete description. verb(
+@@ -405,6 +405,7 @@ to the detailed description below for a complete description. verb(
--partial keep partially transferred files
--partial-dir=DIR put a partially transferred file into DIR
--delay-updates put all updated files into place at end
-m, --prune-empty-dirs prune empty directory chains from file-list
--numeric-ids don't map uid/gid values by user/group name
--usermap=STRING custom username mapping
-@@ -2369,6 +2370,14 @@ See also the "atomic-rsync" perl script in the "support" subdir for an
+@@ -2401,6 +2402,14 @@ See also the "atomic-rsync" perl script in the "support" subdir for an
update algorithm that is even more atomic (it uses bf(--link-dest) and a
parallel hierarchy of files).
diff --git a/syscall.c b/syscall.c
--- a/syscall.c
+++ b/syscall.c
-@@ -41,6 +41,8 @@ extern int list_only;
+@@ -43,6 +43,8 @@ extern int preallocate_files;
extern int preserve_perms;
extern int preserve_executability;
#define RETURN_ERROR_IF(x,e) \
do { \
if (x) { \
-@@ -69,7 +71,12 @@ int do_symlink(const char *lnk, const char *fname)
+@@ -71,7 +73,12 @@ int do_symlink(const char *lnk, const char *fname)
* and write the lnk into it. */
if (am_root < 0) {
int ok, len = strlen(lnk);
if (fd < 0)
return -1;
ok = write(fd, lnk, len) == len;
-@@ -190,6 +197,9 @@ int do_open(const char *pathname, int flags, mode_t mode)
+@@ -192,6 +199,9 @@ int do_open(const char *pathname, int flags, mode_t mode)
RETURN_ERROR_IF_RO_OR_LO;
}
return open(pathname, flags | O_BINARY, mode);
}
-@@ -461,6 +471,9 @@ int do_open_nofollow(const char *pathname, int flags)
+@@ -516,6 +526,9 @@ int do_open_nofollow(const char *pathname, int flags)
#endif
}
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
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;
-@@ -1685,6 +1686,13 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1688,6 +1689,13 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
fnamecmp_type = FNAMECMP_FNAME;
if (statret == 0 && !S_ISREG(sx.st.st_mode)) {
-@@ -2110,6 +2118,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
+@@ -2112,6 +2120,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;
-@@ -2135,6 +2144,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
+@@ -2137,6 +2146,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 cvs_exclude = 0;
int dry_run = 0;
int do_xfers = 1;
-@@ -680,6 +681,7 @@ void usage(enum logcode F)
+@@ -681,6 +682,7 @@ void usage(enum logcode F)
rprintf(F," --backup-dir=DIR make backups into hierarchy based in DIR\n");
rprintf(F," --suffix=SUFFIX set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
rprintf(F," -u, --update skip files that are newer on the receiver\n");
rprintf(F," --inplace update destination files in-place (SEE MAN PAGE)\n");
rprintf(F," --append append data onto shorter files\n");
rprintf(F," --append-verify like --append, but with old data in file checksum\n");
-@@ -914,6 +916,7 @@ static struct poptOption long_options[] = {
+@@ -916,6 +918,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
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -50,6 +50,7 @@ extern int preserve_links;
+@@ -51,6 +51,7 @@ extern int preserve_links;
extern int preserve_hard_links;
extern int preserve_devices;
extern int preserve_specials;
extern int delete_mode;
extern int delete_before;
extern int delete_during;
-@@ -465,6 +467,10 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
+@@ -469,6 +471,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
-@@ -516,6 +522,11 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -520,6 +526,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))
iflags |= ITEM_REPORT_GROUP;
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
if (!ACL_READY(*sxp))
-@@ -1408,6 +1419,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1412,6 +1423,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);
}
if (statret != 0 && basis_dir[0] != NULL) {
int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx,
itemizing, code);
-@@ -1452,10 +1467,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1456,10 +1471,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));
-@@ -1491,6 +1511,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1495,6 +1515,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);
}
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_HLINK_NOT_FIRST(file)
-@@ -2059,13 +2083,17 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
+@@ -2062,12 +2086,16 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
continue;
fname = f_name(file, NULL);
if (fix_dir_perms)
+ do_chmod(fname, file->mode, 0);
if (need_retouch_dir_times) {
STRUCT_STAT st;
- if (link_stat(fname, &st, 0) == 0
- && cmp_time(st.st_mtime, file->modtime) != 0)
+ if (link_stat(fname, &st, 0) == 0 && time_diff(&st, file))
- set_modtime(fname, file->modtime, F_MOD_NSEC(file), file->mode);
+ set_modtime(fname, file->modtime, F_MOD_NSEC(file), file->mode, 0);
}
diff --git a/log.c b/log.c
--- a/log.c
+++ b/log.c
-@@ -709,7 +709,7 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
+@@ -713,7 +713,7 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
c[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
c[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
c[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
extern int file_total;
extern int recurse;
extern int xfer_dirs;
-@@ -840,6 +844,22 @@ static int do_recv(int f_in, int f_out, char *local_name)
+@@ -847,6 +851,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;
-@@ -572,6 +574,7 @@ static void print_rsync_version(enum logcode f)
+@@ -573,6 +575,7 @@ static void print_rsync_version(enum logcode f)
char const *links = "no ";
char const *iconv = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -608,6 +611,9 @@ static void print_rsync_version(enum logcode f)
+@@ -609,6 +612,9 @@ static void print_rsync_version(enum logcode f)
#ifdef CAN_SET_SYMLINK_TIMES
symtimes = "";
#endif
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -621,8 +627,8 @@ static void print_rsync_version(enum logcode f)
+@@ -622,8 +628,8 @@ static void print_rsync_version(enum logcode f)
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -693,6 +699,9 @@ void usage(enum logcode F)
+@@ -694,6 +700,9 @@ void usage(enum logcode F)
rprintf(F," -K, --keep-dirlinks treat symlinked dir on receiver as dir\n");
rprintf(F," -H, --hard-links preserve hard links\n");
rprintf(F," -p, --perms preserve permissions\n");
rprintf(F," -E, --executability preserve the file's executability\n");
rprintf(F," --chmod=CHMOD affect file and/or directory permissions\n");
#ifdef SUPPORT_ACLS
-@@ -738,7 +747,12 @@ void usage(enum logcode F)
+@@ -740,7 +749,12 @@ void usage(enum logcode F)
rprintf(F," --ignore-missing-args ignore missing source args without error\n");
rprintf(F," --delete-missing-args delete missing source args from destination\n");
rprintf(F," --ignore-errors delete even if there are I/O errors\n");
rprintf(F," --max-delete=NUM don't delete more than NUM files\n");
rprintf(F," --max-size=SIZE don't transfer any file larger than SIZE\n");
rprintf(F," --min-size=SIZE don't transfer any file smaller than SIZE\n");
-@@ -855,6 +869,10 @@ static struct poptOption long_options[] = {
+@@ -857,6 +871,10 @@ 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 },
-@@ -941,6 +959,14 @@ static struct poptOption long_options[] = {
+@@ -943,6 +961,14 @@ 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 },
-@@ -2539,6 +2565,9 @@ void server_options(char **args, int *argc_p)
+@@ -2543,6 +2569,9 @@ void server_options(char **args, int *argc_p)
if (xfer_dirs && !recurse && delete_mode && am_sender)
args[ac++] = "--no-r";
if (do_compression && def_compress_level != Z_DEFAULT_COMPRESSION) {
if (asprintf(&arg, "--compress-level=%d", def_compress_level) < 0)
goto oom;
-@@ -2626,6 +2655,16 @@ void server_options(char **args, int *argc_p)
+@@ -2636,6 +2665,16 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--delete-excluded";
if (force_delete)
args[ac++] = "--force";
-E, --executability preserve executability
--chmod=CHMOD affect file and/or directory permissions
-A, --acls preserve ACLs (implies -p)
-@@ -397,7 +398,10 @@ to the detailed description below for a complete description. verb(
+@@ -398,7 +399,10 @@ to the detailed description below for a complete description. verb(
--ignore-missing-args ignore missing source args without error
--delete-missing-args delete missing source args from destination
--ignore-errors delete even if there are I/O errors
--max-delete=NUM don't delete more than NUM files
--max-size=SIZE don't transfer any file larger than SIZE
--min-size=SIZE don't transfer any file smaller than SIZE
-@@ -646,7 +650,8 @@ specified, in which case bf(-r) is not implied.
+@@ -657,7 +661,8 @@ specified, in which case bf(-r) is not implied.
Note that bf(-a) bf(does not preserve hardlinks), because
finding multiply-linked files is expensive. You must separately
dit(--no-OPTION) You may turn off one or more implied options by prefixing
the option name with "no-". Not all options may be prefixed with a "no-":
-@@ -950,7 +955,7 @@ they would be using bf(--copy-links).
+@@ -959,7 +964,7 @@ they would be using bf(--copy-links).
Without this option, if the sending side has replaced a directory with a
symlink to a directory, the receiving side will delete anything that is in
the way of the new symlink, including a directory hierarchy (as long as
See also bf(--keep-dirlinks) for an analogous option for the receiving
side.
-@@ -1113,6 +1118,29 @@ Note that this option does not copy rsyncs special xattr values (e.g. those
+@@ -1122,6 +1127,29 @@ Note that this option does not copy rsyncs special xattr values (e.g. those
used by bf(--fake-super)) unless you repeat the option (e.g. -XX). This
"copy all xattrs" mode cannot be used with bf(--fake-super).
dit(bf(--chmod)) This option tells rsync to apply one or more
comma-separated "chmod" modes to the permission of the files in the
transfer. The resulting value is treated as though it were the permissions
-@@ -1442,12 +1470,13 @@ display as a "*missing" entry in the bf(--list-only) output.
+@@ -1474,12 +1502,13 @@ display as a "*missing" entry in the bf(--list-only) output.
dit(bf(--ignore-errors)) Tells bf(--delete) to go ahead and delete files
even when there are I/O errors.
bf(--recursive) option was also enabled.
dit(bf(--max-delete=NUM)) This tells rsync not to delete more than NUM
-@@ -2081,7 +2110,7 @@ with older versions of rsync, but that also turns on the output of other
+@@ -2113,7 +2142,7 @@ with older versions of rsync, but that also turns on the output of other
verbose messages).
The "%i" escape has a cryptic output that is 11 letters long. The general
type of update being done, bf(X) is replaced by the file-type, and the
other letters represent attributes that may be output if they are being
modified.
-@@ -2137,7 +2166,7 @@ quote(itemization(
+@@ -2169,7 +2198,7 @@ quote(itemization(
sender's value (requires bf(--owner) and super-user privileges).
it() A bf(g) means the group is different and is being updated to the
sender's value (requires bf(--group) and the authority to set the group).
diff --git a/syscall.c b/syscall.c
--- a/syscall.c
+++ b/syscall.c
-@@ -38,6 +38,7 @@ extern int am_root;
- extern int am_sender;
- extern int read_only;
+@@ -40,6 +40,7 @@ extern int read_only;
extern int list_only;
+ extern int inplace;
+ extern int preallocate_files;
+extern int force_change;
extern int preserve_perms;
extern int preserve_executability;
-@@ -55,7 +56,23 @@ int do_unlink(const char *fname)
+@@ -57,7 +58,23 @@ int do_unlink(const char *fname)
{
if (dry_run) return 0;
RETURN_ERROR_IF_RO_OR_LO;
}
#ifdef SUPPORT_LINKS
-@@ -116,14 +133,37 @@ int do_link(const char *fname1, const char *fname2)
+@@ -118,14 +135,37 @@ int do_link(const char *fname1, const char *fname2)
}
#endif
}
int do_mknod(const char *pathname, mode_t mode, dev_t dev)
-@@ -163,7 +203,7 @@ int do_mknod(const char *pathname, mode_t mode, dev_t dev)
+@@ -165,7 +205,7 @@ int do_mknod(const char *pathname, mode_t mode, dev_t dev)
return -1;
close(sock);
#ifdef HAVE_CHMOD
#else
return 0;
#endif
-@@ -180,7 +220,22 @@ int do_rmdir(const char *pathname)
+@@ -182,7 +222,22 @@ int do_rmdir(const char *pathname)
{
if (dry_run) return 0;
RETURN_ERROR_IF_RO_OR_LO;
}
int do_open(const char *pathname, int flags, mode_t mode)
-@@ -194,7 +249,7 @@ int do_open(const char *pathname, int flags, mode_t mode)
+@@ -196,7 +251,7 @@ int do_open(const char *pathname, int flags, mode_t mode)
}
#ifdef HAVE_CHMOD
{
int code;
if (dry_run) return 0;
-@@ -217,17 +272,74 @@ int do_chmod(const char *path, mode_t mode)
+@@ -219,17 +274,74 @@ int do_chmod(const char *path, mode_t mode)
} else
code = chmod(path, mode & CHMOD_BITS); /* DISCOURAGED FUNCTION */
#endif /* !HAVE_LCHMOD */
diff --git a/t_stub.c b/t_stub.c
--- a/t_stub.c
+++ b/t_stub.c
-@@ -28,6 +28,7 @@ int module_id = -1;
- int checksum_len = 0;
+@@ -28,6 +28,7 @@ int protect_args = 0;
+ int module_id = -1;
int relative_paths = 0;
int module_dirlen = 0;
+int force_change = 0;
int preserve_acls = 0;
int preserve_times = 0;
int preserve_xattrs = 0;
-@@ -97,3 +98,23 @@ filter_rule_list daemon_filter_list;
+@@ -102,3 +103,23 @@ filter_rule_list daemon_filter_list;
{
- return "tester";
+ return cst ? 16 : 1;
}
+
+#if defined SUPPORT_FILEFLAGS || defined SUPPORT_FORCE_CHANGE
diff --git a/xattrs.c b/xattrs.c
--- a/xattrs.c
+++ b/xattrs.c
-@@ -1045,7 +1045,7 @@ int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode)
+@@ -1206,7 +1206,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: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/exclude.c b/exclude.c
--- a/exclude.c
+++ b/exclude.c
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -80,6 +80,7 @@ extern struct chmod_mode_struct *chmod_modes;
+@@ -81,6 +81,7 @@ extern struct chmod_mode_struct *chmod_modes;
extern filter_rule_list filter_list;
extern filter_rule_list daemon_filter_list;
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -1135,6 +1135,8 @@ quote(--chmod=D2775,F664)
+@@ -1144,6 +1144,8 @@ quote(--chmod=D2775,F664)
It is also legal to specify multiple bf(--chmod) options, as each
additional option is just appended to the list of changes to make.
See the bf(--perms) and bf(--executability) options for how the resulting
permission value can be applied to the files in the transfer.
-@@ -2031,6 +2033,10 @@ be omitted, but if USER is empty, a leading colon must be supplied.
+@@ -2063,6 +2065,10 @@ be omitted, but if USER is empty, a leading colon must be supplied.
If you specify "--chown=foo:bar, this is exactly the same as specifying
"--usermap=*:foo --groupmap=*:bar", only easier.
dit(bf(--timeout=TIMEOUT)) This option allows you to set a maximum I/O
timeout in seconds. If no data is transferred for the specified time
then rsync will exit. The default is 0, which means no timeout.
-@@ -2890,6 +2896,15 @@ itemization(
+@@ -2926,6 +2932,15 @@ itemization(
option's default 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.
)
manpagesection(MERGE-FILE FILTER RULES)
-@@ -2951,6 +2966,12 @@ itemization(
+@@ -2987,6 +3002,12 @@ itemization(
a rule prefix such as bf(hide)).
)
diff --git a/util.c b/util.c
--- a/util.c
+++ b/util.c
-@@ -852,6 +852,25 @@ size_t stringjoin(char *dest, size_t destsize, ...)
+@@ -878,6 +878,25 @@ size_t stringjoin(char *dest, size_t destsize, ...)
return ret;
}
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
int preserve_links = 0;
int preserve_hard_links = 0;
int preserve_acls = 0;
-@@ -746,6 +747,7 @@ void usage(enum logcode F)
+@@ -748,6 +749,7 @@ void usage(enum logcode F)
rprintf(F," --partial-dir=DIR put a partially transferred file into DIR\n");
rprintf(F," --delay-updates put all updated files into place at transfer's end\n");
rprintf(F," -m, --prune-empty-dirs prune empty directory chains from the file-list\n");
rprintf(F," --numeric-ids don't map uid/gid values by user/group name\n");
rprintf(F," --usermap=STRING custom username mapping\n");
rprintf(F," --groupmap=STRING custom groupname mapping\n");
-@@ -1014,6 +1016,7 @@ static struct poptOption long_options[] = {
+@@ -1017,6 +1019,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 },
-@@ -2711,6 +2714,9 @@ void server_options(char **args, int *argc_p)
+@@ -2722,6 +2725,9 @@ void server_options(char **args, int *argc_p)
args[ac++] = tmpdir;
}
extern int basis_dir_cnt;
extern int make_backups;
extern int cleanup_got_literal;
-@@ -396,6 +397,12 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
- if (sum_end(file_sum1) != checksum_len)
- overflow_exit("checksum_len"); /* Impossible... */
+@@ -392,6 +393,12 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+
+ checksum_len = sum_end(file_sum1);
+ if (do_fsync && fd != -1 && fsync(fd) != 0) {
+ rsyserr(FERROR, errno, "fsync failed on %s",
diff --git a/t_stub.c b/t_stub.c
--- a/t_stub.c
+++ b/t_stub.c
-@@ -21,6 +21,7 @@
-
+@@ -22,6 +22,7 @@
#include "rsync.h"
+ int inplace = 0;
+int do_fsync = 0;
int modify_window = 0;
int preallocate_files = 0;
extern int protect_args;
extern int modify_window;
extern int relative_paths;
-@@ -413,6 +414,13 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
+@@ -404,6 +405,13 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
+ rsyserr(FERROR_XFER, errno, "ftruncate %s", full_fname(dest));
}
- #endif
+ if (do_fsync && fsync(ofd) < 0) {
+ rsyserr(FERROR, errno, "fsync failed on %s",
extern int preserve_links;
extern int preserve_devices;
extern int preserve_specials;
-@@ -1776,6 +1777,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1782,6 +1783,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;
}
-@@ -1943,6 +1952,18 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1949,6 +1958,18 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
if (read_batch)
goto cleanup;
/* There's probably never more than at most 2 outstanding child processes,
* but set it higher, just in case. */
-@@ -560,6 +566,43 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
+@@ -567,6 +573,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,
-@@ -618,6 +661,9 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
+@@ -625,6 +668,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) {
-@@ -678,7 +724,9 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
+@@ -685,7 +731,9 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
full_fname(dest_path));
exit_cleanup(RERR_FILESELECT);
}
return NULL;
}
-@@ -698,6 +746,9 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
+@@ -705,6 +753,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;
-@@ -711,6 +712,10 @@ void usage(enum logcode F)
+@@ -712,6 +713,10 @@ void usage(enum logcode F)
#ifdef SUPPORT_XATTRS
rprintf(F," -X, --xattrs preserve extended attributes\n");
#endif
rprintf(F," -o, --owner preserve owner (super-user only)\n");
rprintf(F," -g, --group preserve group\n");
rprintf(F," --devices preserve device files (super-user only)\n");
-@@ -972,6 +977,12 @@ static struct poptOption long_options[] = {
+@@ -974,6 +979,12 @@ static struct poptOption long_options[] = {
{"force-uchange", 0, POPT_ARG_VAL, &force_change, USR_IMMUTABLE, 0, 0 },
{"force-schange", 0, POPT_ARG_VAL, &force_change, SYS_IMMUTABLE, 0, 0 },
#endif
{"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 },
-@@ -1972,6 +1983,15 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1984,6 +1995,15 @@ int parse_arguments(int *argc_p, const char ***argv_p)
}
#endif
if (block_size > MAX_BLOCK_SIZE) {
snprintf(err_buf, sizeof err_buf,
"--block-size=%lu is too large (max: %u)\n", block_size, MAX_BLOCK_SIZE);
-@@ -2575,6 +2595,11 @@ void server_options(char **args, int *argc_p)
+@@ -2579,6 +2599,11 @@ void server_options(char **args, int *argc_p)
if (preserve_fileflags)
args[ac++] = "--fileflags";
-o, --owner preserve owner (super-user only)
-g, --group preserve group
--devices preserve device files (super-user only)
-@@ -1142,6 +1144,42 @@ flags on files and directories that are being updated or deleted on the
+@@ -1151,6 +1153,42 @@ flags on files and directories that are being updated or deleted on the
receiving side. It does not try to affect user flags. This option overrides
bf(--force-change) and bf(--force-uchange).
typedef struct {
char *datum, *name;
size_t datum_len, name_len;
-@@ -167,8 +183,7 @@ static ssize_t get_xattr_names(const char *fname)
+@@ -184,8 +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. */
{
size_t datum_len = sys_lgetxattr(fname, name, NULL, 0);
size_t extra_len = *len_ptr;
-@@ -177,7 +192,7 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
+@@ -194,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",
-@@ -185,6 +200,15 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
+@@ -202,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)
-@@ -213,7 +237,29 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
+@@ -230,7 +254,29 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr
return ptr;
}
+#endif
+#endif
+ } else {
-+ sum_init(checksum_seed);
++ sum_init(-1, checksum_seed);
+ sum_update(datum, datum_len);
+ sum_end(sum);
+ }
{
ssize_t list_len, name_len;
size_t datum_len, name_offset;
-@@ -222,7 +268,8 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
+@@ -239,7 +285,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)
-@@ -252,20 +299,22 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
+@@ -269,20 +316,23 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
}
datum_len = name_len; /* Pass extra size to get_xattr_data() */
/* For large datums, we store a flag and a checksum. */
+ char *datum = ptr;
name_offset = 1 + MAX_DIGEST_LEN;
-- sum_init(checksum_seed);
+- sum_init(-1, checksum_seed);
- sum_update(ptr, datum_len);
- free(ptr);
--
+
if (!(ptr = new_array(char, name_offset + name_len)))
out_of_memory("rsync_xal_get");
*ptr = XSTATE_ABBREV;
} else
name_offset = datum_len;
-@@ -311,7 +360,7 @@ int get_xattr(const char *fname, stat_x *sxp)
+@@ -328,7 +378,7 @@ int get_xattr(const char *fname, stat_x *sxp)
} else if (IS_MISSING_FILE(sxp->st))
return 0;
free_xattr(sxp);
return -1;
}
-@@ -346,6 +395,8 @@ int copy_xattrs(const char *source, const char *dest)
+@@ -363,6 +413,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,
-@@ -362,6 +413,10 @@ int copy_xattrs(const char *source, const char *dest)
+@@ -402,6 +454,10 @@ static int64 xattr_lookup_hash(const item_list *xalp)
- static int find_matching_xattr(item_list *xalp)
+ static int find_matching_xattr(const item_list *xalp)
{
+#ifdef HAVE_OSX_XATTRS
+ xalp = NULL;
+ return -1; /* find_matching_xattr is a waste of cycles for MOSX clients */
+#else
- size_t i, j;
- item_list *lst = rsync_xal_l.items;
-
-@@ -395,6 +450,7 @@ static int find_matching_xattr(item_list *xalp)
+ const struct ht_int64_node *node;
+ const rsync_xa_list_ref *ref;
+ int64 key;
+@@ -453,6 +509,7 @@ static int find_matching_xattr(const item_list *xalp)
}
return -1;
}
/* Store *xalp on the end of rsync_xal_l */
-@@ -574,11 +630,13 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out)
+@@ -674,11 +731,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);
-@@ -795,7 +853,7 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
+@@ -953,7 +1012,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)
-@@ -807,7 +865,10 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
+@@ -965,7 +1024,10 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
if (XATTR_ABBREV(rxas[i])) {
/* See if the fnamecmp version is identical. */
len = name_len = rxas[i].name_len;
still_abbrev:
if (am_generator)
continue;
-@@ -816,14 +877,14 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
+@@ -974,14 +1036,14 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
ret = -1;
continue;
}
goto still_abbrev;
}
-- sum_init(checksum_seed);
+- sum_init(-1, checksum_seed);
- sum_update(ptr, len);
- sum_end(sum);
+ checksum_xattr_data(sum, ptr, len, sxp);
if (memcmp(sum, rxas[i].datum + 1, MAX_DIGEST_LEN) != 0) {
free(ptr);
goto still_abbrev;
-@@ -892,6 +953,10 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
+@@ -1050,6 +1112,10 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
}
}
return ret;
}
-@@ -938,7 +1003,7 @@ char *get_xattr_acl(const char *fname, int is_access_acl, size_t *len_p)
+@@ -1099,7 +1165,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)
-@@ -1081,11 +1146,33 @@ int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode)
+@@ -1242,11 +1308,33 @@ int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode)
return 0;
}
return ret;
}
-@@ -1094,6 +1181,9 @@ int x_lstat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst)
+@@ -1255,6 +1343,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;
}
-@@ -1102,6 +1192,9 @@ int x_fstat(int fd, STRUCT_STAT *fst, STRUCT_STAT *xst)
+@@ -1263,6 +1354,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: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/exclude.c b/exclude.c
--- a/exclude.c
+++ b/exclude.c
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -34,6 +34,7 @@ extern int am_generator;
- extern int inc_recurse;
+@@ -35,6 +35,7 @@ extern int inc_recurse;
extern int always_checksum;
+ extern int checksum_type;
extern int module_id;
+extern int ignore_case;
extern int ignore_errors;
int blocking_io = -1;
int checksum_seed = 0;
int inplace = 0;
-@@ -775,6 +776,7 @@ void usage(enum logcode F)
+@@ -777,6 +778,7 @@ void usage(enum logcode F)
rprintf(F," --files-from=FILE read list of source-file names from FILE\n");
rprintf(F," -0, --from0 all *-from/filter files are delimited by 0s\n");
rprintf(F," -s, --protect-args no space-splitting; only wildcard special-chars\n");
rprintf(F," --address=ADDRESS bind address for outgoing socket to daemon\n");
rprintf(F," --port=PORT specify double-colon alternate port number\n");
rprintf(F," --sockopts=OPTIONS specify custom TCP options\n");
-@@ -999,6 +1001,8 @@ static struct poptOption long_options[] = {
+@@ -1002,6 +1004,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},
-@@ -2661,6 +2665,9 @@ void server_options(char **args, int *argc_p)
+@@ -2672,6 +2676,9 @@ void server_options(char **args, int *argc_p)
args[ac++] = arg;
}
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -433,6 +433,7 @@ to the detailed description below for a complete description. verb(
+@@ -434,6 +434,7 @@ to the detailed description below for a complete description. verb(
--files-from=FILE read list of source-file names from FILE
-0, --from0 all *from/filter files are delimited by 0s
-s, --protect-args no space-splitting; wildcard chars only
--address=ADDRESS bind address for outgoing socket to daemon
--port=PORT specify double-colon alternate port number
--sockopts=OPTIONS specify custom TCP options
-@@ -1751,6 +1752,10 @@ default (with is overridden by both the environment and the command-line).
+@@ -1783,6 +1784,10 @@ default (with is overridden by both the environment and the command-line).
This option will eventually become a new default setting at some
as-yet-undetermined point in the future.
./configure
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
-@@ -665,6 +665,31 @@ if test x"$enable_iconv" != x"no"; then
+@@ -695,6 +695,31 @@ if test x"$enable_iconv" != x"no"; then
AC_DEFINE(UTF8_CHARSET, "UTF-8", [String to pass to iconv() for the UTF-8 charset.])
fi
diff --git a/main.c b/main.c
--- a/main.c
+++ b/main.c
-@@ -1410,7 +1410,7 @@ static int start_client(int argc, char *argv[])
+@@ -1418,7 +1418,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: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
diff --git a/checksum.c b/checksum.c
--- a/checksum.c
+++ b/checksum.c
-@@ -21,9 +21,12 @@
+@@ -21,10 +21,13 @@
#include "rsync.h"
extern int checksum_seed;
extern int protocol_version;
extern int proper_seed_order;
+ extern char *checksum_choice;
+extern char *link_by_hash_dir;
-+extern char link_by_hash_extra_sum[MAX_DIGEST_LEN];
++extern char link_by_hash_sum[MAX_DIGEST_LEN];
- /*
- a simple 32 bit checksum that can be upadted from either end
-@@ -160,7 +163,7 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
+ #define CSUM_NONE 0
+ #define CSUM_ARCHAIC 1
+@@ -244,7 +247,7 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
}
static int32 sumresidue;
-static md_context md;
+static md_context md, md2;
+ static int cursum_type;
- void sum_init(int seed)
- {
-@@ -173,6 +176,8 @@ void sum_init(int seed)
- sumresidue = 0;
- SIVAL(s, 0, seed);
- sum_update(s, 4);
-+ if (link_by_hash_dir)
-+ md5_begin(&md2);
- }
- }
-
-@@ -191,6 +196,9 @@ void sum_update(const char *p, int32 len)
- return;
- }
+ void sum_init(int csum_type, int seed)
+@@ -255,6 +258,9 @@ void sum_init(int csum_type, int seed)
+ csum_type = parse_csum_name(NULL, 0);
+ cursum_type = csum_type;
-+ if (link_by_hash_dir)
++ if (link_by_hash_dir && cursum_type != CSUM_MD5)
++ md5_begin(&md2);
++
+ switch (csum_type) {
+ case CSUM_MD5:
+ md5_begin(&md);
+@@ -285,6 +291,9 @@ void sum_init(int csum_type, int seed)
+ **/
+ void sum_update(const char *p, int32 len)
+ {
++ if (link_by_hash_dir && cursum_type != CSUM_MD5)
+ md5_update(&md2, (uchar *)p, len);
+
- if (len + sumresidue < CSUM_CHUNK) {
- memcpy(md.buffer + sumresidue, p, len);
- sumresidue += len;
-@@ -223,6 +231,9 @@ int sum_end(char *sum)
- return MD5_DIGEST_LEN;
- }
+ switch (cursum_type) {
+ case CSUM_MD5:
+ md5_update(&md, (uchar *)p, len);
+@@ -315,6 +324,7 @@ void sum_update(const char *p, int32 len)
+ sumresidue = len;
+ if (sumresidue)
+ memcpy(md.buffer, p, sumresidue);
++
+ break;
+ case CSUM_NONE:
+ break;
+@@ -323,6 +333,13 @@ void sum_update(const char *p, int32 len)
-+ if (link_by_hash_dir)
-+ md5_result(&md2, (uchar *)link_by_hash_extra_sum);
+ int sum_end(char *sum)
+ {
++ if (link_by_hash_dir) {
++ if (cursum_type != CSUM_MD5)
++ md5_result(&md2, (uchar *)link_by_hash_sum);
++ else
++ memcpy(link_by_hash_sum, sum, sizeof link_by_hash_sum);
++ }
+
- if (sumresidue || protocol_version >= 27)
- mdfour_update(&md, (uchar *)md.buffer, sumresidue);
-
+ switch (cursum_type) {
+ case CSUM_MD5:
+ md5_result(&md, (uchar *)sum);
diff --git a/clientserver.c b/clientserver.c
--- a/clientserver.c
+++ b/clientserver.c
new file mode 100644
--- /dev/null
+++ b/hashlink.c
-@@ -0,0 +1,92 @@
+@@ -0,0 +1,91 @@
+/*
+ Copyright (C) Cronosys, LLC 2004
+
+
+extern int protocol_version;
+extern char *link_by_hash_dir;
-+extern char sender_file_sum[MAX_DIGEST_LEN];
+
-+char link_by_hash_extra_sum[MAX_DIGEST_LEN]; /* Only used when md4 sums are in the transfer */
++char link_by_hash_sum[MAX_DIGEST_LEN];
+
+#ifdef HAVE_LINK
+
+ if (F_LENGTH(file) == 0)
+ return;
+
-+ hex = sum_as_hex(protocol_version >= 30 ? sender_file_sum : link_by_hash_extra_sum);
++ hex = sum_as_hex(5, link_by_hash_sum);
+ if (asprintf(&hashname, "%s/%.3s/%.3s/%.3s/%s.%s.000000",
+ link_by_hash_dir, hex, hex+3, hex+6, hex+9, big_num(F_LENGTH(file))) < 0)
+ {
char *config_file = NULL;
char *shell_cmd = NULL;
char *logfile_name = NULL;
-@@ -209,7 +210,7 @@ static const char *debug_verbosity[] = {
+@@ -210,7 +211,7 @@ static const char *debug_verbosity[] = {
/*2*/ "BIND,CMD,CONNECT,DEL,DELTASUM,DUP,FILTER,FLIST,ICONV",
/*3*/ "ACL,BACKUP,CONNECT2,DELTASUM2,DEL2,EXIT,FILTER2,FLIST2,FUZZY,GENR,OWN,RECV,SEND,TIME",
/*4*/ "CMD2,DELTASUM3,DEL3,EXIT2,FLIST3,ICONV2,OWN2,PROTO,TIME2",
};
#define MAX_VERBOSITY ((int)(sizeof debug_verbosity / sizeof debug_verbosity[0]) - 1)
-@@ -279,6 +280,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = {
+@@ -280,6 +281,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = {
DEBUG_WORD(FUZZY, W_REC, "Debug fuzzy scoring (levels 1-2)"),
DEBUG_WORD(GENR, W_REC, "Debug generator functions"),
DEBUG_WORD(HASH, W_SND|W_REC, "Debug hashtable code"),
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)"),
-@@ -761,6 +763,7 @@ void usage(enum logcode F)
+@@ -763,6 +765,7 @@ void usage(enum logcode F)
rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n");
rprintf(F," --copy-dest=DIR ... and include copies of unchanged files\n");
rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n");
rprintf(F," -z, --compress compress file data during the transfer\n");
rprintf(F," --compress-level=NUM explicitly set compression level\n");
rprintf(F," --skip-compress=LIST skip compressing files with a suffix in LIST\n");
-@@ -817,7 +820,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+@@ -819,7 +822,7 @@ enum {OPT_VERSION = 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_SERVER, OPT_REFUSED_BASE = 9000};
-@@ -961,6 +964,7 @@ static struct poptOption long_options[] = {
+@@ -964,6 +967,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 },
-@@ -1310,6 +1314,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1313,6 +1317,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
iconv_opt = strdup(arg);
#endif
/* TODO: Call poptReadDefaultConfig; handle errors. */
/* The context leaks in case of an error, but if there's a
-@@ -1785,6 +1792,21 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1788,6 +1795,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. */
-@@ -2087,6 +2109,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2099,6 +2121,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;
-@@ -2740,6 +2764,12 @@ void server_options(char **args, int *argc_p)
+@@ -2751,6 +2775,12 @@ void server_options(char **args, int *argc_p)
} else if (inplace)
args[ac++] = "--inplace";
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -419,6 +419,7 @@ to the detailed description below for a complete description. verb(
+@@ -420,6 +420,7 @@ to the detailed description below for a complete description. verb(
--compare-dest=DIR also compare received files relative to DIR
--copy-dest=DIR ... and include copies of unchanged files
--link-dest=DIR hardlink to files in DIR when unchanged
-z, --compress compress file data during the transfer
--compress-level=NUM explicitly set compression level
--skip-compress=LIST skip compressing files with suffix in LIST
-@@ -1881,6 +1882,48 @@ bf(--link-dest) from working properly for a non-super-user when bf(-o) was
+@@ -1913,6 +1914,48 @@ bf(--link-dest) from working properly for a non-super-user when bf(-o) was
specified (or implied by bf(-a)). You can work-around this bug by avoiding
the bf(-o) option when sending to an old rsync.
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/authenticate.c b/authenticate.c
--- a/authenticate.c
+++ b/authenticate.c
diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
--- a/rsyncd.conf.yo
+++ b/rsyncd.conf.yo
-@@ -267,6 +267,27 @@ path elements that rsync believes will allow a symlink to escape the module's
+@@ -199,7 +199,7 @@ if the module is not read-only).
+
+ When this parameter is enabled, the "numeric-ids" option will also default to
+ being enabled (disabling name lookups). See below for what a chroot needs in
+-order for name lookups to succeed.
++order for name lookups to succeed. See also the "name converter" parameter.
+
+ If you copy library resources into the module's chroot area, you
+ should protect them through your OS's normal user/group or ACL settings (to
+@@ -224,11 +224,14 @@ running as root (see "uid") or for "fake super" to be configured.
+ A chroot-enabled module should not have this parameter enabled unless you've
+ taken steps to ensure that the module has the necessary resources it needs
+ to translate names, and that it is not possible for a user to change those
+-resources. That includes being the code being able to call functions like
++resources. That can include being able to call functions like
+ code(getpwuid()), code(getgrgid()), code(getpwname()), and code(getgrnam())).
+ You should test what libraries and config files are required for your OS
+ and get those setup before starting to test name mapping in rsync.
+
++See also the "name converter" support for a way to convert names w/o any
++extra files in the chroot.
++
+ dit(bf(munge symlinks)) This parameter tells rsync to modify
+ all symlinks in the same way as the (non-daemon-affecting)
+ bf(--munge-links) command-line option (using a method described below).
+@@ -267,6 +270,30 @@ path elements that rsync believes will allow a symlink to escape the module's
hierarchy. There are tricky ways to work around this, though, so you had
better trust your users if you choose this combination of parameters.
+bf(RSYNC_MODULE_PATH), bf(RSYNC_HOST_ADDR), bf(RSYNC_HOST_NAME), and
+bf(RSYNC_USER_NAME). This is useful if you want to customize the
+conversion using a single program invocation.
++
++NOTE: if "use chroot" is enabled, you must explicity set "numeric ids"
++to False.
+
dit(bf(charset)) This specifies the name of the character set in which the
module's filenames are stored. If the client uses an bf(--iconv) option,
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/access.c b/access.c
--- a/access.c
+++ b/access.c
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
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;
-@@ -485,6 +486,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -489,6 +490,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
-@@ -511,10 +513,11 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -515,10 +517,11 @@ 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;
iflags |= ITEM_REPORT_GROUP;
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
-@@ -1404,7 +1407,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1408,7 +1411,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
real_ret = statret;
if (file->flags & FLAG_DIR_CREATED)
statret = -1;
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -709,6 +710,7 @@ void usage(enum logcode F)
+@@ -710,6 +711,7 @@ void usage(enum logcode F)
rprintf(F," -t, --times preserve modification times\n");
rprintf(F," -O, --omit-dir-times omit directories from --times\n");
rprintf(F," -J, --omit-link-times omit symlinks from --times\n");
rprintf(F," --super receiver attempts super-user activities\n");
#ifdef SUPPORT_XATTRS
rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
-@@ -871,6 +873,7 @@ static struct poptOption long_options[] = {
+@@ -873,6 +875,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 },
+ {"omit-dir-changes", 0, POPT_ARG_NONE, &omit_dir_changes, 0, 0, 0 },
- {"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
+ {"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 },
-@@ -2155,6 +2158,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2167,6 +2170,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)
-@@ -2406,6 +2412,8 @@ void server_options(char **args, int *argc_p)
+@@ -2410,6 +2416,8 @@ void server_options(char **args, int *argc_p)
argstr[x++] = 'O';
if (omit_link_times)
argstr[x++] = 'J';
+ --omit-dir-changes omit directories from any attribute changes
--super receiver attempts super-user activities
--fake-super store/recover privileged attrs using xattrs
- -S, --sparse handle sparse files efficiently
-@@ -1199,6 +1200,10 @@ directories.
+ -S, --sparse turn sequences of nulls into sparse blocks
+@@ -1208,6 +1209,10 @@ directories.
dit(bf(-J, --omit-link-times)) This tells rsync to omit symlinks when
it is preserving modification times (see bf(--times)).
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -69,6 +69,7 @@ extern int sender_symlink_iconv;
+@@ -70,6 +70,7 @@ extern int sender_symlink_iconv;
extern int output_needs_newline;
extern int sender_keeps_checksum;
extern int unsort_ndx;
size_t bwlimit_writemax = 0;
int ignore_existing = 0;
int ignore_non_existing = 0;
-@@ -791,6 +792,7 @@ void usage(enum logcode F)
+@@ -793,6 +794,7 @@ void usage(enum logcode F)
rprintf(F," --password-file=FILE read daemon-access password from FILE\n");
rprintf(F," --list-only list the files instead of copying them\n");
rprintf(F," --bwlimit=RATE limit socket I/O bandwidth\n");
#ifdef HAVE_SETVBUF
rprintf(F," --outbuf=N|L|B set output buffering to None, Line, or Block\n");
#endif
-@@ -989,6 +991,7 @@ static struct poptOption long_options[] = {
+@@ -992,6 +994,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: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
-@@ -721,6 +721,29 @@ if test $rsync_cv_can_hardlink_special = yes; then
+@@ -751,6 +751,29 @@ if test $rsync_cv_can_hardlink_special = yes; then
AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
fi
diff --git a/main.c b/main.c
--- a/main.c
+++ b/main.c
-@@ -1259,6 +1259,18 @@ static int start_client(int argc, char *argv[])
+@@ -1267,6 +1267,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
-@@ -572,6 +572,7 @@ static void print_rsync_version(enum logcode f)
+@@ -573,6 +573,7 @@ static void print_rsync_version(enum logcode f)
char const *links = "no ";
char const *iconv = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -608,6 +609,9 @@ static void print_rsync_version(enum logcode f)
+@@ -609,6 +610,9 @@ static void print_rsync_version(enum logcode f)
#ifdef CAN_SET_SYMLINK_TIMES
symtimes = "";
#endif
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -621,8 +625,8 @@ static void print_rsync_version(enum logcode f)
+@@ -622,8 +626,8 @@ static void print_rsync_version(enum logcode f)
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
enddit()
manpagesection(MODULE PARAMETERS)
-@@ -856,6 +865,7 @@ use chroot = yes
+@@ -863,6 +872,7 @@ use chroot = yes
max connections = 4
syslog facility = local5
pid file = /var/run/rsyncd.pid
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/syscall.c b/syscall.c
--- a/syscall.c
+++ b/syscall.c
-@@ -110,9 +110,14 @@ ssize_t do_readlink(const char *path, char *buf, size_t bufsiz)
+@@ -112,9 +112,14 @@ ssize_t do_readlink(const char *path, char *buf, size_t bufsiz)
#ifdef HAVE_LINK
int do_link(const char *fname1, const char *fname2)
{
-- Matt McCutchen <hashproduct@gmail.com>
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
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
-@@ -728,6 +729,7 @@ void usage(enum logcode F)
+@@ -730,6 +731,7 @@ void usage(enum logcode F)
rprintf(F," --existing skip creating new files on receiver\n");
rprintf(F," --ignore-existing skip updating files that already exist on receiver\n");
rprintf(F," --remove-source-files sender removes synchronized files (non-dirs)\n");
rprintf(F," --del an alias for --delete-during\n");
rprintf(F," --delete delete extraneous files from destination dirs\n");
rprintf(F," --delete-before receiver deletes before transfer, not during\n");
-@@ -992,6 +994,7 @@ static struct poptOption long_options[] = {
+@@ -995,6 +997,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 },
-@@ -2640,6 +2643,8 @@ void server_options(char **args, int *argc_p)
+@@ -2650,6 +2653,8 @@ void server_options(char **args, int *argc_p)
goto oom;
args[ac++] = arg;
}
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -387,6 +387,7 @@ to the detailed description below for a complete description. verb(
+@@ -388,6 +388,7 @@ to the detailed description below for a complete description. verb(
--existing skip creating new files on receiver
--ignore-existing skip updating files that exist on receiver
--remove-source-files sender removes synchronized files (non-dir)
--del an alias for --delete-during
--delete delete extraneous files from dest dirs
--delete-before receiver deletes before xfer, not during
-@@ -1339,6 +1340,14 @@ bf(--exclude='*.new') for the rsync transfer).
+@@ -1371,6 +1372,14 @@ bf(--exclude='*.new') for the rsync transfer).
Starting with 3.1.0, rsync will skip the sender-side removal (and output an
error) if the file's size or modify time has not stayed unchanged.
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
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;
-@@ -571,7 +572,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -575,7 +576,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)
{
char *rsync_path = RSYNC_PATH;
char *backup_dir = NULL;
char backup_dir_buf[MAXPATHLEN];
-@@ -755,6 +758,7 @@ void usage(enum logcode F)
+@@ -757,6 +760,7 @@ void usage(enum logcode F)
rprintf(F," -I, --ignore-times don't skip files that match in size and mod-time\n");
rprintf(F," -M, --remote-option=OPTION send OPTION to the remote side only\n");
rprintf(F," --size-only skip files that match in size\n");
+ rprintf(F," --times-only skip files that match in mod-time\n");
- rprintf(F," --modify-window=NUM compare mod-times with reduced accuracy\n");
+ rprintf(F," -@, --modify-window=NUM set the accuracy for mod-time comparisons\n");
rprintf(F," -T, --temp-dir=DIR create temporary files in directory DIR\n");
rprintf(F," -y, --fuzzy find similar file for basis if no dest file\n");
-@@ -797,6 +801,8 @@ void usage(enum logcode F)
+@@ -799,6 +803,8 @@ void usage(enum logcode F)
rprintf(F," --write-batch=FILE write a batched update to FILE\n");
rprintf(F," --only-write-batch=FILE like --write-batch but w/o updating destination\n");
rprintf(F," --read-batch=FILE read a batched update from FILE\n");
rprintf(F," --protocol=NUM force an older protocol version to be used\n");
#ifdef ICONV_OPTION
rprintf(F," --iconv=CONVERT_SPEC request charset conversion of filenames\n");
-@@ -910,6 +916,7 @@ static struct poptOption long_options[] = {
+@@ -912,6 +918,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 },
-@@ -1033,6 +1040,8 @@ static struct poptOption long_options[] = {
+@@ -1036,6 +1043,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 },
#ifdef HAVE_SETVBUF
{"outbuf", 0, POPT_ARG_STRING, &outbuf_mode, 0, 0, 0 },
#endif
-@@ -2290,6 +2299,16 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2294,6 +2303,16 @@ int parse_arguments(int *argc_p, const char ***argv_p)
}
}
if (files_from) {
char *h, *p;
int q;
-@@ -2649,6 +2668,25 @@ void server_options(char **args, int *argc_p)
+@@ -2659,6 +2678,25 @@ void server_options(char **args, int *argc_p)
else if (missing_args == 1 && !am_sender)
args[ac++] = "--ignore-missing-args";
+ args[ac++] = arg;
+ }
+
- if (modify_window_set) {
- if (asprintf(&arg, "--modify-window=%d", modify_window) < 0)
- goto oom;
+ if (modify_window_set && am_sender) {
+ char *fmt = modify_window < 0 ? "-@%d" : "--modify-window=%d";
+ if (asprintf(&arg, fmt, modify_window) < 0)
diff --git a/pipe.c b/pipe.c
--- a/pipe.c
+++ b/pipe.c
diff --git a/receiver.c b/receiver.c
--- a/receiver.c
+++ b/receiver.c
-@@ -56,6 +56,7 @@ extern int delay_updates;
+@@ -57,6 +57,7 @@ extern int xfersum_type;
extern mode_t orig_umask;
extern struct stats stats;
extern char *tmpdir;
extern char *partial_dir;
extern char *basis_dir[MAX_BASIS_DIRS+1];
extern char sender_file_sum[MAX_DIGEST_LEN];
-@@ -534,6 +535,8 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -530,6 +531,8 @@ int recv_files(int f_in, int f_out, char *local_name)
const char *parent_dirname = "";
#endif
int ndx, recv_ok;
if (DEBUG_GTE(RECV, 1))
rprintf(FINFO, "recv_files(%d) starting\n", cur_flist->used);
-@@ -541,6 +544,23 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -537,6 +540,23 @@ int recv_files(int f_in, int f_out, char *local_name)
if (delay_updates)
delayed_bits = bitbag_create(cur_flist->used + 1);
while (1) {
cleanup_disable();
-@@ -845,6 +865,9 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -841,6 +861,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, F_LENGTH(file));
-@@ -859,6 +882,16 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -855,6 +878,16 @@ int recv_files(int f_in, int f_out, char *local_name)
exit_cleanup(RERR_FILEIO);
}
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -413,6 +413,7 @@ to the detailed description below for a complete description. verb(
+@@ -414,6 +414,7 @@ to the detailed description below for a complete description. verb(
--contimeout=SECONDS set daemon connection timeout in seconds
-I, --ignore-times don't skip files that match size and time
--size-only skip files that match in size
+ --times-only skip files that match in mod-time
- --modify-window=NUM compare mod-times with reduced accuracy
+ -@, --modify-window=NUM set the accuracy for mod-time comparisons
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
-@@ -454,6 +455,8 @@ to the detailed description below for a complete description. verb(
+@@ -455,6 +456,8 @@ to the detailed description below for a complete description. verb(
--write-batch=FILE write a batched update to FILE
--only-write-batch=FILE like --write-batch but w/o updating dest
--read-batch=FILE read a batched update from FILE
--protocol=NUM force an older protocol version to be used
--iconv=CONVERT_SPEC request charset conversion of filenames
--checksum-seed=NUM set block/file checksum seed (advanced)
-@@ -2550,6 +2553,33 @@ file previously generated by bf(--write-batch).
+@@ -2582,6 +2585,33 @@ file previously generated by bf(--write-batch).
If em(FILE) is bf(-), the batch data will be read from standard input.
See the "BATCH MODE" section for details.
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/fileio.c b/fileio.c
--- a/fileio.c
+++ b/fileio.c
extern int sparse_files;
+extern int sparse_files_block_size;
- static OFF_T sparse_seek = 0;
+ OFF_T preallocated_len = 0;
-@@ -130,7 +131,7 @@ int write_file(int f, char *buf, int len)
+@@ -147,7 +148,7 @@ int write_file(int f, int use_seek, OFF_T offset, const char *buf, int len)
while (len > 0) {
int r1;
if (sparse_files > 0) {
- int len1 = MIN(len, SPARSE_WRITE_SIZE);
+ int len1 = MIN(len, sparse_files_block_size);
- r1 = write_sparse(f, buf, len1);
+ r1 = write_sparse(f, use_seek, offset, buf, len1);
+ offset += r1;
} else {
- if (!wf_writeBuf) {
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
int preallocate_files = 0;
int do_compression = 0;
int def_compress_level = NOT_SPECIFIED;
-@@ -714,6 +715,7 @@ void usage(enum logcode F)
+@@ -715,6 +716,7 @@ void usage(enum logcode F)
rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
#endif
- rprintf(F," -S, --sparse handle sparse files efficiently\n");
+ rprintf(F," -S, --sparse turn sequences of nulls into sparse blocks\n");
+ rprintf(F," --sparse-block=SIZE set the block size used to handle sparse files\n");
#ifdef SUPPORT_PREALLOCATION
rprintf(F," --preallocate allocate dest files before writing them\n");
#else
-@@ -922,6 +924,7 @@ static struct poptOption long_options[] = {
+@@ -924,6 +926,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 },
-@@ -2572,6 +2575,12 @@ void server_options(char **args, int *argc_p)
+@@ -2576,6 +2579,12 @@ void server_options(char **args, int *argc_p)
args[ac++] = arg;
}
@@ -377,6 +377,7 @@ to the detailed description below for a complete description. verb(
--super receiver attempts super-user activities
--fake-super store/recover privileged attrs using xattrs
- -S, --sparse handle sparse files efficiently
+ -S, --sparse turn sequences of nulls into sparse blocks
+ --sparse-block=SIZE set block size used to handle sparse files
--preallocate allocate dest files before writing
-n, --dry-run perform a trial run with no changes made
-W, --whole-file copy files whole (w/o delta-xfer algorithm)
-@@ -1255,6 +1256,15 @@ filesystem, but with this option rsync will probably copy more slowly. If the
- destination is not an extent-supporting filesystem (such as ext4, xfs, NTFS,
- etc.), this option may have no positive effect at all.
+@@ -1274,6 +1275,15 @@ If combined with bf(--sparse), the file will only have sparse blocks (as
+ opposed to allocated sequences of null bytes) if the kernel version and
+ filesystem type support creating holes in the allocated data.
+dit(bf(--sparse-block=SIZE)) Change the block size used to handle sparse files
+to SIZE bytes. This option only has an effect if the bf(--sparse) (bf(-S))
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/main.c b/main.c
--- a/main.c
+++ b/main.c
extern struct stats stats;
extern char *stdout_format;
extern char *logfile_format;
-@@ -447,6 +448,11 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
+@@ -454,6 +455,11 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
*t++ = '\0';
}
/* check to see if we've already been given '-l user' in
* the remote-shell command */
for (i = 0; i < argc-1; i++) {
-@@ -466,20 +472,25 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
+@@ -473,20 +479,25 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
args[argc++] = "-l";
args[argc++] = user;
}
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -2589,14 +2589,18 @@ regardless of the remote charset you actually pass. Thus, you may feel free to
+@@ -2621,14 +2621,18 @@ regardless of the remote charset you actually pass. Thus, you may feel free to
specify just the local charset for a daemon transfer (e.g. bf(--iconv=utf8)).
dit(bf(-4, --ipv4) or bf(-6, --ipv6)) Tells rsync to prefer IPv4/IPv6
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
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;
-@@ -791,6 +792,8 @@ void usage(enum logcode F)
+@@ -793,6 +794,8 @@ void usage(enum logcode F)
rprintf(F," --password-file=FILE read daemon-access password from FILE\n");
rprintf(F," --list-only list the files instead of copying them\n");
rprintf(F," --bwlimit=RATE limit socket I/O bandwidth\n");
#ifdef HAVE_SETVBUF
rprintf(F," --outbuf=N|L|B set output buffering to None, Line, or Block\n");
#endif
-@@ -819,6 +822,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+@@ -821,6 +824,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
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_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
-@@ -1014,6 +1018,8 @@ static struct poptOption long_options[] = {
+@@ -1017,6 +1021,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 },
-@@ -1785,6 +1791,36 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1788,6 +1794,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. */
-@@ -2584,6 +2620,15 @@ void server_options(char **args, int *argc_p)
+@@ -2588,6 +2624,15 @@ void server_options(char **args, int *argc_p)
args[ac++] = arg;
}
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -451,6 +451,8 @@ to the detailed description below for a complete description. verb(
+@@ -452,6 +452,8 @@ to the detailed description below for a complete description. verb(
--password-file=FILE read daemon-access password from FILE
--list-only list the files instead of copying them
--bwlimit=RATE limit socket I/O bandwidth
--write-batch=FILE write a batched update to FILE
--only-write-batch=FILE like --write-batch but w/o updating dest
--read-batch=FILE read a batched update from FILE
-@@ -2524,6 +2526,19 @@ files can show up as being rapidly sent when the data is quickly buffered,
+@@ -2556,6 +2558,19 @@ files can show up as being rapidly sent when the data is quickly buffered,
while other can show up as very slow when the flushing of the output buffer
occurs. This may be fixed in a future version.
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -73,6 +73,7 @@ extern uid_t our_uid;
+@@ -74,6 +74,7 @@ extern uid_t our_uid;
extern struct stats stats;
extern char *filesfrom_host;
extern char *usermap, *groupmap;
extern char curr_dir[MAXPATHLEN];
-@@ -99,6 +100,8 @@ int file_total = 0; /* total of all active items over all file-lists */
+@@ -100,6 +101,8 @@ int file_total = 0; /* total of all active items over all file-lists */
int file_old_total = 0; /* total of active items that will soon be gone */
int flist_eof = 0; /* all the file-lists are now known */
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -192,6 +192,7 @@ int logfile_format_has_i = 0;
+@@ -193,6 +193,7 @@ int logfile_format_has_i = 0;
int logfile_format_has_o_or_i = 0;
int always_checksum = 0;
int list_only = 0;
#define MAX_BATCH_NAME_LEN 256 /* Must be less than MAXPATHLEN-13 */
char *batch_name = NULL;
-@@ -801,6 +802,7 @@ void usage(enum logcode F)
+@@ -803,6 +804,7 @@ void usage(enum logcode F)
#ifdef ICONV_OPTION
rprintf(F," --iconv=CONVERT_SPEC request charset conversion of filenames\n");
#endif
rprintf(F," --checksum-seed=NUM set block/file checksum seed (advanced)\n");
rprintf(F," -4, --ipv4 prefer IPv4\n");
rprintf(F," -6, --ipv6 prefer IPv6\n");
-@@ -1021,6 +1023,7 @@ static struct poptOption long_options[] = {
+@@ -1024,6 +1026,7 @@ static struct poptOption long_options[] = {
{"iconv", 0, POPT_ARG_STRING, &iconv_opt, 0, 0, 0 },
{"no-iconv", 0, POPT_ARG_NONE, 0, OPT_NO_ICONV, 0, 0 },
#endif
{"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 },
-@@ -2336,6 +2339,24 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2340,6 +2343,24 @@ int parse_arguments(int *argc_p, const char ***argv_p)
}
}
am_starting_up = 0;
return 1;
-@@ -2757,6 +2778,12 @@ void server_options(char **args, int *argc_p)
+@@ -2768,6 +2789,12 @@ void server_options(char **args, int *argc_p)
if (relative_paths && !implied_dirs && (!am_sender || protocol_version >= 30))
args[ac++] = "--no-implied-dirs";
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -456,6 +456,7 @@ to the detailed description below for a complete description. verb(
+@@ -457,6 +457,7 @@ to the detailed description below for a complete description. verb(
--read-batch=FILE read a batched update from FILE
--protocol=NUM force an older protocol version to be used
--iconv=CONVERT_SPEC request charset conversion of filenames
--checksum-seed=NUM set block/file checksum seed (advanced)
-4, --ipv4 prefer IPv4
-6, --ipv6 prefer IPv6
-@@ -2588,6 +2589,22 @@ daemon uses the charset specified in its "charset" configuration parameter
+@@ -2620,6 +2621,22 @@ daemon uses the charset specified in its "charset" configuration parameter
regardless of the remote charset you actually pass. Thus, you may feel free to
specify just the local charset for a daemon transfer (e.g. bf(--iconv=utf8)).
./configure (optional if already run)
make
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/syscall.c b/syscall.c
--- a/syscall.c
+++ b/syscall.c
This patch has not yet been tested by me (Wayne), but was provided
Darryl Dixon. Thanks!
-based-on: 16b49716d55a50f2e985b879b720b2c53c892a3a
+based-on: f3873b3d88b61167b106e7b9227a20147f8f6197
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
extern int preserve_specials;
extern int preserve_hard_links;
extern int preserve_executability;
-@@ -1687,7 +1688,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1690,7 +1691,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
fnamecmp_type = FNAMECMP_FNAME;
int preserve_links = 0;
int preserve_hard_links = 0;
int preserve_acls = 0;
-@@ -704,6 +705,7 @@ void usage(enum logcode F)
+@@ -705,6 +706,7 @@ void usage(enum logcode F)
rprintf(F," -o, --owner preserve owner (super-user only)\n");
rprintf(F," -g, --group preserve group\n");
rprintf(F," --devices preserve device files (super-user only)\n");
rprintf(F," --specials preserve special files\n");
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve modification times\n");
-@@ -885,6 +887,7 @@ static struct poptOption long_options[] = {
+@@ -887,6 +889,7 @@ static struct poptOption long_options[] = {
{"no-D", 0, POPT_ARG_NONE, 0, OPT_NO_D, 0, 0 },
{"devices", 0, POPT_ARG_VAL, &preserve_devices, 1, 0, 0 },
{"no-devices", 0, POPT_ARG_VAL, &preserve_devices, 0, 0, 0 },
{"specials", 0, POPT_ARG_VAL, &preserve_specials, 1, 0, 0 },
{"no-specials", 0, POPT_ARG_VAL, &preserve_specials, 0, 0, 0 },
{"links", 'l', POPT_ARG_VAL, &preserve_links, 1, 0, 0 },
-@@ -1785,6 +1788,11 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1788,6 +1791,11 @@ 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. */
-@@ -2757,6 +2765,9 @@ void server_options(char **args, int *argc_p)
+@@ -2768,6 +2776,9 @@ void server_options(char **args, int *argc_p)
if (relative_paths && !implied_dirs && (!am_sender || protocol_version >= 30))
args[ac++] = "--no-implied-dirs";
extern int preserve_xattrs;
extern int basis_dir_cnt;
extern int make_backups;
-@@ -229,7 +230,7 @@ int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file)
+@@ -233,7 +234,7 @@ int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file)
}
static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
{
static char file_sum1[MAX_DIGEST_LEN];
struct map_struct *mapbuf;
-@@ -245,12 +246,12 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
- OFF_T preallocated_len = 0;
- #endif
-
+@@ -241,20 +242,20 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+ int checksum_len;
+ int32 len;
+ OFF_T offset = 0;
+- OFF_T offset2;
++ OFF_T offset2, total_size = F_LENGTH(file);
+ char *data;
+ int32 i;
+ char *map = NULL;
+
+ #ifdef SUPPORT_PREALLOCATION
- if (preallocate_files && fd != -1 && total_size > 0 && (!inplace || total_size > size_r)) {
-+ if (preallocate_files && fd != -1 && F_LENGTH(file) > 0 && (!inplace || F_LENGTH(file) > size_r)) {
++ if (preallocate_files && fd != -1 && total_size > 0 && !IS_DEVICE(file->mode) && (!inplace || total_size > size_r)) {
/* Try to preallocate enough space for file's eventual length. Can
* reduce fragmentation on filesystems like ext4, xfs, and NTFS. */
-- if (do_fallocate(fd, 0, total_size) == 0) {
-+ if (do_fallocate(fd, 0, F_LENGTH(file)) == 0) {
- #ifdef PREALLOCATE_NEEDS_TRUNCATE
-- preallocated_len = total_size;
-+ preallocated_len = F_LENGTH(file);
- #endif
- } else
+ if ((preallocated_len = do_fallocate(fd, 0, total_size)) < 0)
rsyserr(FWARNING, errno, "do_fallocate %s", full_fname(fname));
-@@ -279,7 +280,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
- if (append_mode == 2 && mapbuf) {
- for (j = CHUNK_SIZE; j < sum.flength; j += CHUNK_SIZE) {
- if (INFO_GTE(PROGRESS, 1))
-- show_progress(offset, total_size);
-+ show_progress(offset, F_LENGTH(file));
- sum_update(map_ptr(mapbuf, offset, CHUNK_SIZE),
- CHUNK_SIZE);
- offset = j;
-@@ -287,7 +288,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
- if (offset < sum.flength) {
- int32 len = (int32)(sum.flength - offset);
- if (INFO_GTE(PROGRESS, 1))
-- show_progress(offset, total_size);
-+ show_progress(offset, F_LENGTH(file));
- sum_update(map_ptr(mapbuf, offset, len), len);
- }
- }
-@@ -301,7 +302,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
-
- while ((i = recv_token(f_in, &data)) != 0) {
- if (INFO_GTE(PROGRESS, 1))
-- show_progress(offset, total_size);
-+ show_progress(offset, F_LENGTH(file));
-
- if (allowed_lull)
- maybe_send_keepalive(time(NULL), MSK_ALLOW_FLUSH | MSK_ACTIVE_RECEIVER);
-@@ -371,20 +372,20 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
-
+ } else
+ #endif
+- if (inplace) {
++ if (inplace && !IS_DEVICE(file->mode)) {
#ifdef HAVE_FTRUNCATE
+ /* The most compatible way to create a sparse file is to start with no length. */
+ if (sparse_files > 0 && whole_file && fd >= 0 && do_ftruncate(fd, 0) == 0)
+@@ -381,7 +382,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
/* inplace: New data could be shorter than old data.
-- * preallocate_files: total_size could have been an overestimate.
-+ * preallocate_files: F_LENGTH(file) could have been an overestimate.
+ * preallocate_files: total_size could have been an overestimate.
* Cut off any extra preallocated zeros from dest file. */
- if ((inplace
- #ifdef PREALLOCATE_NEEDS_TRUNCATE
- || preallocated_len > offset
- #endif
-- ) && fd != -1 && do_ftruncate(fd, offset) < 0) {
-+ ) && fd != -1 && !IS_DEVICE(file->mode) && do_ftruncate(fd, offset) < 0) {
+- if ((inplace || preallocated_len > offset) && fd != -1 && do_ftruncate(fd, offset) < 0) {
++ if ((inplace || preallocated_len > offset) && fd != -1 && !IS_DEVICE(file->mode) && do_ftruncate(fd, offset) < 0) {
rsyserr(FERROR_XFER, errno, "ftruncate failed on %s",
full_fname(fname));
}
- #endif
-
- if (INFO_GTE(PROGRESS, 1))
-- end_progress(total_size);
-+ end_progress(F_LENGTH(file));
-
- if (fd != -1 && offset > 0 && sparse_end(fd, offset) != 0) {
- report_write_error:
-@@ -408,9 +409,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -404,9 +405,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
}
}
static void handle_delayed_updates(char *local_name)
-@@ -666,7 +667,7 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -662,7 +663,7 @@ int recv_files(int f_in, int f_out, char *local_name)
"(Skipping batched update for%s \"%s\")\n",
redoing ? " resend of" : "",
fname);
file->flags |= FLAG_FILE_SENT;
continue;
}
-@@ -677,13 +678,13 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -673,13 +674,13 @@ int recv_files(int f_in, int f_out, char *local_name)
if (!do_xfers) { /* log the transfer */
log_item(FCLIENT, file, iflags, NULL);
if (read_batch)
if (inc_recurse)
send_msg_int(MSG_SUCCESS, ndx);
continue;
-@@ -773,7 +774,7 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -769,7 +770,7 @@ int recv_files(int f_in, int f_out, char *local_name)
} else if (do_fstat(fd1,&st) != 0) {
rsyserr(FERROR_XFER, errno, "fstat %s failed",
full_fname(fnamecmp));
close(fd1);
if (inc_recurse)
send_msg_int(MSG_NO_SEND, ndx);
-@@ -788,18 +789,32 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -784,18 +785,32 @@ int recv_files(int f_in, int f_out, char *local_name)
*/
rprintf(FERROR_XFER, "recv_files: %s is a directory\n",
full_fname(fnamecmp));
/* If we're not preserving permissions, change the file-list's
* mode based on the local permissions and some heuristics. */
if (!preserve_perms) {
-@@ -831,7 +846,7 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -827,7 +842,7 @@ int recv_files(int f_in, int f_out, char *local_name)
}
if (fd2 == -1) {
if (fd1 != -1)
close(fd1);
if (inc_recurse)
-@@ -846,8 +861,7 @@ int recv_files(int f_in, int f_out, char *local_name)
+@@ -842,8 +857,7 @@ int recv_files(int f_in, int f_out, char *local_name)
rprintf(FINFO, "%s\n", fname);
/* recv file data */
#define RSYNC_XAL_INITIAL 5
#define RSYNC_XAL_LIST_INITIAL 100
-@@ -255,7 +257,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;
+ if (datum_len > MAX_FULL_DATUM && protocol_version >= 30) {
/* For large datums, we store a flag and a checksum. */
name_offset = 1 + MAX_DIGEST_LEN;
- sum_init(checksum_seed);
-@@ -378,7 +380,7 @@ static int find_matching_xattr(item_list *xalp)
+ sum_init(-1, checksum_seed);
+@@ -436,7 +438,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)
-@@ -415,13 +417,22 @@ int send_xattr(int f, stat_x *sxp)
+@@ -511,13 +513,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;
-@@ -440,8 +451,8 @@ int send_xattr(int f, stat_x *sxp)
+@@ -536,8 +547,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);
-@@ -449,7 +460,7 @@ int send_xattr(int f, stat_x *sxp)
+@@ -545,7 +556,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);
-@@ -499,7 +510,7 @@ int xattr_diff(struct file_struct *file, stat_x *sxp, int find_all)
+@@ -596,7 +607,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;
-@@ -544,6 +555,9 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out)
+@@ -642,6 +653,9 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out)
int cnt, prior_req = 0;
rsync_xa *rxa;
+ if (protocol_version < 30)
+ return;
+
- lst += F_XATTR(file);
- for (rxa = lst->items, cnt = lst->count; cnt--; rxa++) {
- if (rxa->datum_len <= MAX_FULL_DATUM)
-@@ -600,6 +614,9 @@ int recv_xattr_request(struct file_struct *file, int f_in)
+ glst += F_XATTR(file);
+ lst = &glst->xa_items;
+
+@@ -701,6 +715,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);
-@@ -663,7 +680,22 @@ void receive_xattr(int f, struct file_struct *file)
+@@ -787,7 +804,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"
-@@ -676,7 +708,7 @@ void receive_xattr(int f, struct file_struct *file)
+@@ -800,7 +832,7 @@ void receive_xattr(int f, struct file_struct *file)
return;
}
(void)EXPAND_ITEM_LIST(&temp_xattr, rsync_xa, count);
temp_xattr.count = 0;
}
-@@ -684,9 +716,10 @@ void receive_xattr(int f, struct file_struct *file)
+@@ -808,9 +840,10 @@ void receive_xattr(int f, struct file_struct *file)
for (num = 1; num <= count; num++) {
char *ptr, *name;
rsync_xa *rxa;