am_sender ? "on" : "to",
--- old/configure.in
+++ new/configure.in
-@@ -610,6 +610,12 @@ if test x"$with_included_popt" != x"yes"
+@@ -632,6 +632,12 @@ if test x"$with_included_popt" != x"yes"
AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
fi
+ if (*strFileNamePtr == '/')
+ strFileNamePtr++;
+
-+ snprintf(strFileSize, sizeof strFileSize, "%.0f", (double)file->length);
++ snprintf(strFileSize, sizeof strFileSize, "%.0f", (double)F_LENGTH(file));
+ if (am_sender) {
+ intBytesTransferred = stats.total_written - initial_stats->total_written;
+ } else {
FN_LOCAL_BOOL(lp_list, list)
--- old/log.c
+++ new/log.c
-@@ -93,7 +93,7 @@ struct {
+@@ -95,7 +95,7 @@ struct {
/*
* Map from rsync error code to name, or return NULL.
*/
for (i = 0; rerr_names[i].name; i++) {
--- old/receiver.c
+++ new/receiver.c
-@@ -110,6 +110,10 @@ static int get_tmpname(char *fnametmp, c
+@@ -110,6 +110,10 @@ int get_tmpname(char *fnametmp, char *fn
if (maxname < 1) {
rprintf(FERROR, "temporary filename too long: %s\n", fname);
+#endif
} else {
if (remove_source_files
- || (preserve_hard_links
-@@ -422,6 +444,9 @@ int recv_files(int f_in, struct file_lis
+ || (preserve_hard_links && F_IS_HLINKED(file)))
+@@ -419,6 +441,9 @@ int recv_files(int f_in, struct file_lis
if (server_filter_list.head
&& check_filter(&server_filter_list, fname, 0) < 0) {
rprintf(FERROR, "attempt to hack rsync failed.\n");
exit_cleanup(RERR_PROTOCOL);
}
-@@ -478,6 +503,11 @@ int recv_files(int f_in, struct file_lis
+@@ -475,6 +500,11 @@ int recv_files(int f_in, struct file_lis
rprintf(FERROR,
"invalid basis_dir index: %d.\n",
fnamecmp_type);
exit_cleanup(RERR_PROTOCOL);
}
pathjoin(fnamecmpbuf, sizeof fnamecmpbuf,
-@@ -526,6 +556,9 @@ int recv_files(int f_in, struct file_lis
+@@ -523,6 +553,9 @@ int recv_files(int f_in, struct file_lis
} else if (do_fstat(fd1,&st) != 0) {
rsyserr(FERROR, errno, "fstat %s failed",
full_fname(fnamecmp));
+#ifdef HAVE_LIBODBC
+ db_log_error(FERROR, 19,"fstat %s failed",full_fname(fnamecmp));
+#endif
- discard_receive_data(f_in, file->length);
+ discard_receive_data(f_in, F_LENGTH(file));
close(fd1);
continue;
-@@ -539,6 +572,9 @@ int recv_files(int f_in, struct file_lis
+@@ -536,6 +569,9 @@ int recv_files(int f_in, struct file_lis
*/
rprintf(FERROR,"recv_files: %s is a directory\n",
full_fname(fnamecmp));
+#ifdef HAVE_LIBODBC
+ db_log_error(FERROR,20,"recv_files: %s is a directory",full_fname(fnamecmp));
+#endif
- discard_receive_data(f_in, file->length);
+ discard_receive_data(f_in, F_LENGTH(file));
close(fd1);
continue;
-@@ -562,6 +598,9 @@ int recv_files(int f_in, struct file_lis
+@@ -559,6 +595,9 @@ int recv_files(int f_in, struct file_lis
if (fd2 == -1) {
rsyserr(FERROR, errno, "open %s failed",
full_fname(fname));
+#ifdef HAVE_LIBODBC
+ db_log_error(FERROR,22, "open %s failed", full_fname(fname));
+#endif
- discard_receive_data(f_in, file->length);
+ discard_receive_data(f_in, F_LENGTH(file));
if (fd1 != -1)
close(fd1);
-@@ -595,6 +634,10 @@ int recv_files(int f_in, struct file_lis
+@@ -592,6 +631,10 @@ int recv_files(int f_in, struct file_lis
if (fd2 == -1) {
rsyserr(FERROR, errno, "mkstemp %s failed",
full_fname(fnametmp));
+ db_log_error(FERROR, 22, "mkstemp %s failed",
+ full_fname(fnametmp));
+#endif
- discard_receive_data(f_in, file->length);
+ discard_receive_data(f_in, F_LENGTH(file));
if (fd1 != -1)
close(fd1);
-@@ -615,12 +658,19 @@ int recv_files(int f_in, struct file_lis
- fname, fd2, file->length);
+@@ -612,12 +655,19 @@ int recv_files(int f_in, struct file_lis
+ fname, fd2, F_LENGTH(file));
log_item(log_code, file, &initial_stats, iflags, NULL);
+#ifdef HAVE_LIBODBC
exit_cleanup(RERR_FILEIO);
}
-@@ -679,6 +729,12 @@ int recv_files(int f_in, struct file_lis
+@@ -674,6 +724,12 @@ int recv_files(int f_in, struct file_lis
rprintf(msgtype,
"%s: %s failed verification -- update %s%s.\n",
errstr, fname, keptstr, redostr);
+ keptstr, redostr);
+#endif
}
- if (!phase) {
- SIVAL(numbuf, 0, i);
+ if (!phase)
+ send_msg_int(MSG_REDO, i);
--- old/sender.c
+++ new/sender.c
-@@ -355,6 +355,9 @@ void send_files(struct file_list *flist,
+@@ -305,6 +305,9 @@ void send_files(struct file_list *flist,
end_progress(st.st_size);
log_item(log_code, file, &initial_stats, iflags, NULL);
extern int preserve_devices;
extern int preserve_specials;
extern int preserve_links;
-@@ -95,7 +96,8 @@ path
+@@ -93,7 +94,8 @@ path
****************************************************************************/
static int make_bak_dir(char *fullpath)
{
char *rel = fullpath + backup_dir_len;
char *end = rel + strlen(rel);
char *p = end;
-@@ -127,15 +129,24 @@ static int make_bak_dir(char *fullpath)
+@@ -125,15 +127,24 @@ static int make_bak_dir(char *fullpath)
if (p >= rel) {
/* Try to transfer the directory settings of the
* actual dir that the files are coming from. */
}
}
*p = '/';
-@@ -173,15 +184,18 @@ static int robust_move(const char *src,
+@@ -171,15 +182,18 @@ static int robust_move(const char *src,
* We will move the file to be deleted into a parallel directory tree. */
static int keep_backup(const char *fname)
{
if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
return 1; /* the file could have disappeared */
-@@ -191,6 +205,13 @@ static int keep_backup(const char *fname
+@@ -189,6 +203,13 @@ static int keep_backup(const char *fname
return 0;
}
/* Check to see if this is a device file, or link */
if ((am_root && preserve_devices && IS_DEVICE(file->mode))
|| (preserve_specials && IS_SPECIAL(file->mode))) {
-@@ -261,7 +282,7 @@ static int keep_backup(const char *fname
+@@ -259,7 +280,7 @@ static int keep_backup(const char *fname
if (robust_move(fname, buf) != 0) {
rsyserr(FERROR, errno, "keep_backup failed: %s -> \"%s\"",
full_fname(fname), buf);
extern int preserve_links;
extern int preserve_hard_links;
extern int preserve_devices;
-@@ -143,6 +144,8 @@ static void list_file_entry(struct file_
-
+@@ -144,6 +145,8 @@ static void list_file_entry(struct file_
permstring(permbuf, f->mode);
+ len = F_LENGTH(f);
+ /* TODO: indicate '+' if the entry has an ACL. */
+
+ extra_len += (S_ISDIR(mode) ? 2 : 1) * sizeof (union flist_extras);
+#endif
+
- sum_len = always_checksum && S_ISREG(mode) ? MD4_SUM_LENGTH : 0;
+ if (always_checksum && S_ISREG(mode))
+ extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
- alloc_len = file_struct_len + dirname_len + basename_len
-@@ -725,6 +734,11 @@ static struct file_struct *recv_file_ent
+@@ -732,6 +741,11 @@ static struct file_struct *recv_file_ent
read_buf(f, bp, checksum_len);
}
return file;
}
-@@ -969,6 +983,8 @@ void unmake_file(struct file_struct *fil
- {
- union flist_extras *start = (union flist_extras *)file
- - (flist_extra_ndx - 1);
-+ if (preserve_acls && S_ISDIR(file->mode))
-+ start--;
- free(start);
- }
-
-@@ -977,6 +993,9 @@ static struct file_struct *send_file_nam
+@@ -992,6 +1006,9 @@ static struct file_struct *send_file_nam
unsigned short flags)
{
struct file_struct *file;
file = make_file(fname, flist, stp, flags,
f == -2 ? SERVER_FILTERS : ALL_FILTERS);
-@@ -986,11 +1005,24 @@ static struct file_struct *send_file_nam
+@@ -1001,11 +1018,24 @@ static struct file_struct *send_file_nam
if (chmod_modes && !S_ISLNK(file->mode))
file->mode = tweak_mode(file->mode, chmod_modes);
extern int preserve_links;
extern int preserve_devices;
extern int preserve_specials;
-@@ -89,6 +90,7 @@ extern int one_file_system;
- extern int file_struct_len;
+@@ -87,6 +88,7 @@ extern int force_delete;
+ extern int one_file_system;
extern struct stats stats;
extern dev_t filesystem_dev;
+extern mode_t orig_umask;
extern char *backup_dir;
extern char *backup_suffix;
extern int backup_suffix_len;
-@@ -447,22 +449,27 @@ static void do_delete_pass(struct file_l
+@@ -445,22 +447,27 @@ static void do_delete_pass(struct file_l
rprintf(FINFO, " \r");
}
int32 iflags, uchar fnamecmp_type, const char *xname)
{
if (statret >= 0) { /* A from-dest-dir statret can == 1! */
-@@ -470,20 +477,24 @@ void itemize(struct file_struct *file, i
+@@ -468,20 +475,24 @@ void itemize(struct file_struct *file, i
: S_ISDIR(file->mode) ? !omit_dir_times
: !S_ISLNK(file->mode);
-- if (S_ISREG(file->mode) && file->length != st->st_size)
-+ if (S_ISREG(file->mode) && file->length != sxp->st.st_size)
+- if (S_ISREG(file->mode) && F_LENGTH(file) != st->st_size)
++ if (S_ISREG(file->mode) && F_LENGTH(file) != sxp->st.st_size)
iflags |= ITEM_REPORT_SIZE;
if ((iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !keep_time
&& !(iflags & ITEM_MATCHED)
} else
iflags |= ITEM_IS_NEW;
-@@ -735,7 +746,7 @@ void check_for_finished_hlinks(int itemi
+@@ -733,7 +744,7 @@ void check_for_finished_hlinks(int itemi
* handling the file, -1 if no dest-linking occurred, or a non-negative
* value if we found an alternate basis file. */
static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
int maybe_ATTRS_REPORT, enum logcode code)
{
int best_match = -1;
-@@ -744,7 +755,7 @@ static int try_dests_reg(struct file_str
+@@ -742,7 +753,7 @@ static int try_dests_reg(struct file_str
do {
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
continue;
switch (match_level) {
case 0:
-@@ -752,16 +763,20 @@ static int try_dests_reg(struct file_str
+@@ -750,16 +761,20 @@ static int try_dests_reg(struct file_str
match_level = 1;
/* FALL THROUGH */
case 1:
continue;
best_match = j;
match_level = 3;
-@@ -776,7 +791,7 @@ static int try_dests_reg(struct file_str
+@@ -774,7 +789,7 @@ static int try_dests_reg(struct file_str
if (j != best_match) {
j = best_match;
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
return -1;
}
-@@ -784,15 +799,20 @@ static int try_dests_reg(struct file_str
+@@ -782,15 +797,20 @@ static int try_dests_reg(struct file_str
#ifdef SUPPORT_HARD_LINKS
if (link_dest) {
int i = itemizing && (verbose > 1 || stdout_format_has_i > 1);
+ if (hard_link_one(file, ndx, fname, 0, sxp,
cmpbuf, 1, i, code) < 0)
goto try_a_copy;
- if (preserve_hard_links && IS_HLINKED(file))
+ if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, j);
} else
#endif
if (verbose > 1 && maybe_ATTRS_REPORT) {
rprintf(FCLIENT, "%s is uptodate\n", fname);
}
-@@ -808,8 +828,13 @@ static int try_dests_reg(struct file_str
+@@ -806,8 +826,13 @@ static int try_dests_reg(struct file_str
}
return -1;
}
set_file_attrs(fname, file, NULL, 0);
if (maybe_ATTRS_REPORT
&& ((!itemizing && verbose && match_level == 2)
-@@ -830,7 +855,7 @@ static int try_dests_reg(struct file_str
+@@ -828,7 +853,7 @@ static int try_dests_reg(struct file_str
* handling the file, or -1 if no dest-linking occurred, or a non-negative
* value if we found an alternate basis file. */
static int try_dests_non(struct file_struct *file, char *fname, int ndx,
int maybe_ATTRS_REPORT, enum logcode code)
{
char lnk[MAXPATHLEN];
-@@ -862,24 +887,24 @@ static int try_dests_non(struct file_str
+@@ -860,24 +885,24 @@ static int try_dests_non(struct file_str
do {
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
continue;
break;
#endif
-@@ -893,7 +918,7 @@ static int try_dests_non(struct file_str
+@@ -891,7 +916,7 @@ static int try_dests_non(struct file_str
break;
case TYPE_SPECIAL:
case TYPE_DEVICE:
continue;
break;
#ifdef SUPPORT_LINKS
-@@ -910,7 +935,11 @@ static int try_dests_non(struct file_str
+@@ -908,7 +933,11 @@ static int try_dests_non(struct file_str
match_level = 2;
best_match = j;
}
match_level = 3;
best_match = j;
break;
-@@ -923,7 +952,7 @@ static int try_dests_non(struct file_str
+@@ -921,7 +950,7 @@ static int try_dests_non(struct file_str
if (j != best_match) {
j = best_match;
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
return -1;
}
-@@ -954,7 +983,15 @@ static int try_dests_non(struct file_str
+@@ -952,7 +981,15 @@ static int try_dests_non(struct file_str
: ITEM_LOCAL_CHANGE
+ (match_level == 3 ? ITEM_XNAME_FOLLOWS : 0);
char *lp = match_level == 3 ? "" : NULL;
}
if (verbose > 1 && maybe_ATTRS_REPORT) {
rprintf(FCLIENT, "%s%s is uptodate\n",
-@@ -967,6 +1004,7 @@ static int try_dests_non(struct file_str
+@@ -965,6 +1002,7 @@ static int try_dests_non(struct file_str
}
static int phase = 0;
/* Acts on the_file_list->file's ndx'th item, whose name is fname. If a dir,
* make sure it exists, and has the right permissions/timestamp info. For
-@@ -988,7 +1026,8 @@ static void recv_generator(char *fname,
+@@ -986,7 +1024,8 @@ static void recv_generator(char *fname,
static int need_fuzzy_dirlist = 0;
struct file_struct *fuzzy_file = NULL;
int fd = -1, f_copy = -1;
struct file_struct *back_file = NULL;
int statret, real_ret, stat_errno;
char *fnamecmp, *partialptr, *backupptr = NULL;
-@@ -1044,6 +1083,9 @@ static void recv_generator(char *fname,
+@@ -1042,6 +1081,9 @@ static void recv_generator(char *fname,
} else if (!dry_run)
return;
}
if (dry_run > 1) {
statret = -1;
stat_errno = ENOENT;
-@@ -1051,7 +1093,7 @@ static void recv_generator(char *fname,
+@@ -1049,7 +1091,7 @@ static void recv_generator(char *fname,
const char *dn = file->dirname ? file->dirname : ".";
if (parent_dirname != dn && strcmp(parent_dirname, dn) != 0) {
if (relative_paths && !implied_dirs
&& create_directory_path(fname) < 0) {
rsyserr(FERROR, errno,
"recv_generator: mkdir %s failed",
-@@ -1063,6 +1105,10 @@ static void recv_generator(char *fname,
+@@ -1061,6 +1103,10 @@ static void recv_generator(char *fname,
}
if (fuzzy_basis)
need_fuzzy_dirlist = 1;
}
parent_dirname = dn;
-@@ -1072,7 +1118,7 @@ static void recv_generator(char *fname,
+@@ -1070,7 +1116,7 @@ static void recv_generator(char *fname,
need_fuzzy_dirlist = 0;
}
keep_dirlinks && S_ISDIR(file->mode));
stat_errno = errno;
}
-@@ -1090,8 +1136,9 @@ static void recv_generator(char *fname,
+@@ -1088,8 +1134,9 @@ static void recv_generator(char *fname,
* mode based on the local permissions and some heuristics. */
if (!preserve_perms) {
int exists = statret == 0
}
if (S_ISDIR(file->mode)) {
-@@ -1100,8 +1147,8 @@ static void recv_generator(char *fname,
+@@ -1098,8 +1145,8 @@ static void recv_generator(char *fname,
* file of that name and it is *not* a directory, then
* we need to delete it. If it doesn't exist, then
* (perhaps recursively) create it. */
return;
statret = -1;
}
-@@ -1110,14 +1157,14 @@ static void recv_generator(char *fname,
+@@ -1108,14 +1155,14 @@ static void recv_generator(char *fname,
dry_run++;
}
real_ret = statret;
itemizing, maybe_ATTRS_REPORT, code);
if (j == -2) {
itemizing = 0;
-@@ -1126,7 +1173,11 @@ static void recv_generator(char *fname,
+@@ -1124,7 +1171,11 @@ static void recv_generator(char *fname,
statret = 1;
}
if (itemizing && f_out != -1) {
statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
}
if (real_ret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) {
-@@ -1146,21 +1197,21 @@ static void recv_generator(char *fname,
+@@ -1144,21 +1195,21 @@ static void recv_generator(char *fname,
return;
}
}
+ goto cleanup;
}
- if (preserve_hard_links && IS_HLINKED(file)
+ if (preserve_hard_links && F_IS_HLINKED(file)
- && hard_link_check(file, ndx, fname, statret, &st,
+ && hard_link_check(file, ndx, fname, statret, &sx,
itemizing, code, HL_CHECK_MASTER))
if (preserve_links && S_ISLNK(file->mode)) {
#ifdef SUPPORT_LINKS
-@@ -1179,14 +1230,14 @@ static void recv_generator(char *fname,
+@@ -1177,14 +1228,14 @@ static void recv_generator(char *fname,
char lnk[MAXPATHLEN];
int len;
- set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
+ itemize(file, ndx, 0, &sx, 0, 0, NULL);
+ set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
- if (preserve_hard_links && IS_HLINKED(file))
+ if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, -1);
if (remove_source_files == 1)
-@@ -1195,10 +1246,10 @@ static void recv_generator(char *fname,
+@@ -1193,10 +1244,10 @@ static void recv_generator(char *fname,
}
/* Not the right symlink (or not a symlink), so
* delete it. */
itemizing, maybe_ATTRS_REPORT, code);
if (j == -2) {
#ifndef CAN_HARDLINK_SYMLINK
-@@ -1214,7 +1265,7 @@ static void recv_generator(char *fname,
+@@ -1212,7 +1263,7 @@ static void recv_generator(char *fname,
statret = 1;
}
- if (preserve_hard_links && IS_HLINKED(file)
+ if (preserve_hard_links && F_IS_HLINKED(file)
- && hard_link_check(file, ndx, fname, -1, &st,
+ && hard_link_check(file, ndx, fname, -1, &sx,
itemizing, code, HL_SKIP))
return;
if (do_symlink(sl, fname) != 0) {
-@@ -1223,7 +1274,7 @@ static void recv_generator(char *fname,
+@@ -1221,7 +1272,7 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code != FNONE && verbose)
-@@ -1246,31 +1297,36 @@ static void recv_generator(char *fname,
+@@ -1244,31 +1295,36 @@ static void recv_generator(char *fname,
if (statret == 0) {
char *t;
if (IS_DEVICE(file->mode)) {
+ itemize(file, ndx, 0, &sx, 0, 0, NULL);
+ }
+ set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
- if (preserve_hard_links && IS_HLINKED(file))
+ if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, -1);
if (remove_source_files == 1)
goto return_with_success;
itemizing, maybe_ATTRS_REPORT, code);
if (j == -2) {
#ifndef CAN_HARDLINK_SPECIAL
-@@ -1286,7 +1342,7 @@ static void recv_generator(char *fname,
+@@ -1284,7 +1340,7 @@ static void recv_generator(char *fname,
statret = 1;
}
- if (preserve_hard_links && IS_HLINKED(file)
+ if (preserve_hard_links && F_IS_HLINKED(file)
- && hard_link_check(file, ndx, fname, -1, &st,
+ && hard_link_check(file, ndx, fname, -1, &sx,
itemizing, code, HL_SKIP))
return;
if (verbose > 2) {
-@@ -1299,7 +1355,11 @@ static void recv_generator(char *fname,
+@@ -1297,7 +1353,11 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code != FNONE && verbose)
-@@ -1309,7 +1369,7 @@ static void recv_generator(char *fname,
+@@ -1307,7 +1367,7 @@ static void recv_generator(char *fname,
if (remove_source_files == 1)
goto return_with_success;
}
}
if (!S_ISREG(file->mode)) {
-@@ -1343,7 +1403,7 @@ static void recv_generator(char *fname,
+@@ -1341,7 +1401,7 @@ static void recv_generator(char *fname,
}
if (update_only && statret == 0
if (verbose > 1)
rprintf(FINFO, "%s is newer\n", fname);
return;
-@@ -1352,20 +1412,20 @@ static void recv_generator(char *fname,
+@@ -1350,20 +1410,20 @@ static void recv_generator(char *fname,
fnamecmp = fname;
fnamecmp_type = FNAMECMP_FNAME;
}
if (j >= 0) {
fnamecmp = fnamecmpbuf;
-@@ -1375,7 +1435,7 @@ static void recv_generator(char *fname,
+@@ -1373,7 +1433,7 @@ static void recv_generator(char *fname,
}
real_ret = statret;
if (partial_dir && (partialptr = partial_dir_fname(fname)) != NULL
&& link_stat(partialptr, &partial_st, 0) == 0
-@@ -1394,7 +1454,7 @@ static void recv_generator(char *fname,
+@@ -1392,7 +1452,7 @@ static void recv_generator(char *fname,
rprintf(FINFO, "fuzzy basis selected for %s: %s\n",
fname, fnamecmpbuf);
}
-- st.st_size = fuzzy_file->length;
-+ sx.st.st_size = fuzzy_file->length;
+- st.st_size = F_LENGTH(fuzzy_file);
++ sx.st.st_size = F_LENGTH(fuzzy_file);
statret = 0;
fnamecmp = fnamecmpbuf;
fnamecmp_type = FNAMECMP_FUZZY;
-@@ -1403,7 +1463,7 @@ static void recv_generator(char *fname,
+@@ -1401,7 +1461,7 @@ static void recv_generator(char *fname,
if (statret != 0) {
- if (preserve_hard_links && IS_HLINKED(file)
+ if (preserve_hard_links && F_IS_HLINKED(file)
- && hard_link_check(file, ndx, fname, statret, &st,
+ && hard_link_check(file, ndx, fname, statret, &sx,
itemizing, code, HL_SKIP))
return;
if (stat_errno == ENOENT)
-@@ -1413,36 +1473,49 @@ static void recv_generator(char *fname,
+@@ -1411,36 +1471,49 @@ static void recv_generator(char *fname,
return;
}
-- if (append_mode && st.st_size > file->length)
-+ if (append_mode && sx.st.st_size > file->length)
+- if (append_mode && st.st_size > F_LENGTH(file))
++ if (append_mode && sx.st.st_size > F_LENGTH(file))
return;
if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
}
- set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
+ set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
- if (preserve_hard_links && IS_HLINKED(file))
+ if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, -1);
if (remove_source_files != 1)
- return;
fnamecmp = partialptr;
fnamecmp_type = FNAMECMP_PARTIAL_DIR;
statret = 0;
-@@ -1466,17 +1539,21 @@ static void recv_generator(char *fname,
+@@ -1464,17 +1537,21 @@ static void recv_generator(char *fname,
pretend_missing:
/* pretend the file didn't exist */
- if (preserve_hard_links && IS_HLINKED(file)
+ if (preserve_hard_links && F_IS_HLINKED(file)
- && hard_link_check(file, ndx, fname, statret, &st,
+ && hard_link_check(file, ndx, fname, statret, &sx,
itemizing, code, HL_SKIP))
}
if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) {
close(fd);
-@@ -1487,7 +1564,7 @@ static void recv_generator(char *fname,
+@@ -1485,7 +1562,7 @@ static void recv_generator(char *fname,
full_fname(backupptr));
unmake_file(back_file);
close(fd);
}
if ((f_copy = do_open(backupptr,
O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0) {
-@@ -1495,14 +1572,14 @@ static void recv_generator(char *fname,
+@@ -1493,14 +1570,14 @@ static void recv_generator(char *fname,
full_fname(backupptr));
unmake_file(back_file);
close(fd);
}
if (verbose > 2)
-@@ -1520,24 +1597,32 @@ static void recv_generator(char *fname,
+@@ -1518,24 +1595,32 @@ static void recv_generator(char *fname,
iflags |= ITEM_BASIS_TYPE_FOLLOWS;
if (fnamecmp_type == FNAMECMP_FUZZY)
iflags |= ITEM_XNAME_FOLLOWS;
+ get_acl(fnamecmp, &real_sx);
+#endif
+ itemize(file, -1, real_ret, &real_sx, iflags, fnamecmp_type,
- fuzzy_file ? fuzzy_file->basename : NULL);
+ fuzzy_file ? F_BASENAME(fuzzy_file) : NULL);
+#ifdef SUPPORT_ACLS
+ if (preserve_acls)
+ free_acl(&real_sx);
}
if (!do_xfers) {
- if (preserve_hard_links && IS_HLINKED(file))
+ if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, -1);
- return;
+ goto cleanup;
if (f_copy >= 0) {
close(f_copy);
-@@ -1550,6 +1635,13 @@ static void recv_generator(char *fname,
+@@ -1548,6 +1633,13 @@ static void recv_generator(char *fname,
}
close(fd);
}
void generate_files(int f_out, struct file_list *flist, char *local_name)
-@@ -1611,6 +1703,8 @@ void generate_files(int f_out, struct fi
+@@ -1609,6 +1701,8 @@ void generate_files(int f_out, struct fi
* notice that and let us know via the redo pipe (or its closing). */
ignore_timeout = 1;
extern int link_dest;
+extern int preserve_acls;
extern int make_backups;
- extern int flist_extra_ndx;
extern int remove_source_files;
-@@ -155,15 +156,19 @@ void init_hard_links(void)
+ extern int stdout_format_has_i;
+@@ -154,15 +155,19 @@ void init_hard_links(void)
#ifdef SUPPORT_HARD_LINKS
static int maybe_hard_link(struct file_struct *file, int ndx,
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
0, "");
}
-@@ -178,13 +183,13 @@ static int maybe_hard_link(struct file_s
+@@ -177,13 +182,13 @@ static int maybe_hard_link(struct file_s
return -1;
}
}
enum logcode code, int skip)
{
#ifdef SUPPORT_HARD_LINKS
-@@ -228,7 +233,7 @@ int hard_link_check(struct file_struct *
+@@ -227,7 +232,7 @@ int hard_link_check(struct file_struct *
|| st2.st_ino != st3.st_ino)
continue;
statret = 1;
if (verbose < 2 || !stdout_format_has_i) {
itemizing = 0;
code = FNONE;
-@@ -238,12 +243,16 @@ int hard_link_check(struct file_struct *
+@@ -237,12 +242,16 @@ int hard_link_check(struct file_struct *
if (!unchanged_file(cmpbuf, file, &st3))
continue;
statret = 1;
toname, &st2, itemizing, code);
if (remove_source_files == 1 && do_xfers)
send_msg_int(MSG_SUCCESS, ndx);
-@@ -258,7 +267,7 @@ int hard_link_check(struct file_struct *
+@@ -257,7 +266,7 @@ int hard_link_check(struct file_struct *
#ifdef SUPPORT_HARD_LINKS
int hard_link_one(struct file_struct *file, int ndx, char *fname,
int itemizing, enum logcode code)
{
if (do_link(toname, fname)) {
-@@ -274,7 +283,11 @@ int hard_link_one(struct file_struct *fi
+@@ -273,7 +282,11 @@ int hard_link_one(struct file_struct *fi
}
if (itemizing) {
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
terse ? "" : toname);
}
-@@ -291,14 +304,15 @@ void hard_link_cluster(struct file_struc
+@@ -290,14 +303,15 @@ void hard_link_cluster(struct file_struc
#ifdef SUPPORT_HARD_LINKS
char hlink1[MAXPATHLEN];
char *hlink2;
return;
if (!(file->flags & FLAG_HLINK_FIRST)) {
while (!(file->flags & FLAG_HLINK_LAST)) {
-@@ -314,9 +328,13 @@ void hard_link_cluster(struct file_struc
+@@ -313,9 +327,13 @@ void hard_link_cluster(struct file_struc
if (hl->hlindex != SKIPPED_LINK)
continue;
hlink2 = f_name(file, NULL);
+#endif /* SUPPORT_ACLS */
--- old/log.c
+++ new/log.c
-@@ -618,8 +618,10 @@ static void log_formatted(enum logcode c
+@@ -625,8 +625,10 @@ static void log_formatted(enum logcode c
c[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
c[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
c[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
/* A large opt value means that set_refuse_options()
* turned this option off. */
@@ -1223,6 +1253,8 @@ int parse_arguments(int *argc, const cha
- preserve_uid = flist_extra_ndx++;
+ preserve_uid = ++flist_extra_cnt;
if (preserve_gid)
- preserve_gid = flist_extra_ndx++;
+ preserve_gid = ++flist_extra_cnt;
+ if (preserve_acls)
-+ preserve_acls = flist_extra_ndx++;
++ preserve_acls = ++flist_extra_cnt;
*argv = poptGetArgs(pc);
*argc = count_args(*argv);
if (preserve_gid)
--- old/receiver.c
+++ new/receiver.c
-@@ -48,6 +48,7 @@ extern int keep_partial;
+@@ -47,6 +47,7 @@ extern int keep_partial;
extern int checksum_seed;
extern int inplace;
extern int delay_updates;
extern struct stats stats;
extern char *stdout_format;
extern char *tmpdir;
-@@ -348,6 +349,10 @@ int recv_files(int f_in, struct file_lis
+@@ -347,6 +348,10 @@ int recv_files(int f_in, struct file_lis
int itemizing = am_server ? logfile_format_has_i : stdout_format_has_i;
enum logcode log_code = log_before_transfer ? FLOG : FINFO;
int max_phase = protocol_version >= 29 ? 2 : 1;
int i, recv_ok;
if (verbose > 2)
-@@ -551,7 +556,16 @@ int recv_files(int f_in, struct file_lis
+@@ -550,7 +555,16 @@ int recv_files(int f_in, struct file_lis
* mode based on the local permissions and some heuristics. */
if (!preserve_perms) {
int exists = fd1 != -1;
--- old/rsync.h
+++ new/rsync.h
-@@ -495,6 +495,14 @@ struct idev {
+@@ -496,6 +496,14 @@ struct idev {
#define IN_LOOPBACKNET 127
#endif
#define GID_NONE ((gid_t)-1)
#define HL_CHECK_MASTER 0
-@@ -540,10 +548,12 @@ union flist_extras {
- /* When enabled, all entries have these: */
- #define F_UID(f) FLIST_EXTRA(f, preserve_uid).uid
- #define F_GID(f) FLIST_EXTRA(f, preserve_gid).gid
-+#define F_ACL(f) FLIST_EXTRA(f, preserve_acls).num
+@@ -551,10 +559,12 @@ extern int preserve_gid;
+ /* When the associated option is on, all entries will have these present: */
+ #define F_UID(f) REQ_EXTRA(f, preserve_uid)->uid
+ #define F_GID(f) REQ_EXTRA(f, preserve_gid)->gid
++#define F_ACL(f) REQ_EXTRA(f, preserve_acls)->unum
/* These are per-entry optional and mutally exclusive: */
- #define F_IDEV(f) FLIST_EXTRA(f, flist_extra_ndx).idev
- #define F_HLIST(f) FLIST_EXTRA(f, flist_extra_ndx).hlist
-+#define F_DEFACL(f) FLIST_EXTRA(f, flist_extra_ndx).num
+ #define F_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev
+ #define F_HLIST(f) OPT_EXTRA(f, LEN64_BUMP(f))->hlist
++#define F_DEFACL(f) OPT_EXTRA(f, LEN64_BUMP(f))->unum
- /* These are per-entry optional, but always both or neither: */
- #define F_DMAJOR(f) FLIST_EXTRA(f, flist_extra_ndx + (IS_HLINKED(f)? 1 : 0)).num
-@@ -667,6 +677,17 @@ struct stats {
+ /* These are per-entry optional, but always both or neither:
+ * (Note: a device doesn't need to use LEN64_BUMP(f).) */
+@@ -689,6 +699,17 @@ struct stats {
struct chmod_mode_struct;
#include "byteorder.h"
#include "lib/mdfour.h"
#include "lib/wildmatch.h"
-@@ -685,6 +706,16 @@ struct chmod_mode_struct;
+@@ -707,6 +728,16 @@ struct chmod_mode_struct;
#define NORETURN __attribute__((__noreturn__))
#endif
+extern int preserve_atimes;
extern int relative_paths;
extern int implied_dirs;
- extern int flist_extra_ndx;
-@@ -135,6 +136,7 @@ void show_flist_stats(void)
+ extern int flist_extra_cnt;
+@@ -134,6 +135,7 @@ void show_flist_stats(void)
static void list_file_entry(struct file_struct *f)
{
char permbuf[PERMSTRING_SIZE];
+ time_t atime = preserve_atimes ? F_ATIME(f) : 0;
+ double len;
- if (!f->basename) {
- /* this can happen if duplicate names were removed */
-@@ -145,16 +147,18 @@ static void list_file_entry(struct file_
+ if (!F_IS_ACTIVE(f)) {
+@@ -146,14 +148,16 @@ static void list_file_entry(struct file_
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(f->mode)) {
- rprintf(FINFO, "%s %11.0f %s %s -> %s\n",
+ rprintf(FINFO, "%s %11.0f %s %s %s -> %s\n",
- permbuf,
- (double)f->length, timestring(f->modtime),
+ permbuf, len, timestring(f->modtime),
+ preserve_atimes ? timestring(atime) : "",
f_name(f, NULL), F_SYMLINK(f));
} else
{
- rprintf(FINFO, "%s %11.0f %s %s\n",
+ rprintf(FINFO, "%s %11.0f %s %s %s\n",
- permbuf,
- (double)f->length, timestring(f->modtime),
+ permbuf, len, timestring(f->modtime),
+ preserve_atimes ? timestring(atime) : "",
f_name(f, NULL));
}
}
-@@ -312,6 +316,7 @@ static void send_file_entry(struct file_
+@@ -311,6 +315,7 @@ static void send_file_entry(struct file_
{
unsigned short flags;
static time_t modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
-@@ -327,7 +332,7 @@ static void send_file_entry(struct file_
+@@ -326,7 +331,7 @@ static void send_file_entry(struct file_
if (!file) {
write_byte(f, 0);
dev = 0, rdev = MAKEDEV(0, 0);
rdev_major = 0;
uid = 0, gid = 0;
-@@ -377,6 +382,13 @@ static void send_file_entry(struct file_
+@@ -376,6 +381,13 @@ static void send_file_entry(struct file_
flags |= XMIT_SAME_TIME;
else
modtime = file->modtime;
#ifdef SUPPORT_HARD_LINKS
if (tmp_idev.dev != 0) {
-@@ -429,6 +441,8 @@ static void send_file_entry(struct file_
+@@ -428,6 +440,8 @@ static void send_file_entry(struct file_
write_int(f, modtime);
if (!(flags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
if (preserve_uid && !(flags & XMIT_SAME_UID)) {
if (!numeric_ids)
add_uid(uid);
-@@ -495,7 +509,7 @@ static void send_file_entry(struct file_
+@@ -494,7 +508,7 @@ static void send_file_entry(struct file_
static struct file_struct *recv_file_entry(struct file_list *flist,
unsigned short flags, int f)
{
static mode_t mode;
static int64 dev;
static dev_t rdev;
-@@ -515,7 +529,7 @@ static struct file_struct *recv_file_ent
+@@ -514,7 +528,7 @@ static struct file_struct *recv_file_ent
struct file_struct *file;
if (!flist) {
dev = 0, rdev = MAKEDEV(0, 0);
rdev_major = 0;
uid = 0, gid = 0;
-@@ -571,6 +585,8 @@ static struct file_struct *recv_file_ent
+@@ -570,6 +584,8 @@ static struct file_struct *recv_file_ent
modtime = (time_t)read_int(f);
if (!(flags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
if (chmod_modes && !S_ISLNK(mode))
mode = tweak_mode(mode, chmod_modes);
-@@ -643,6 +659,8 @@ static struct file_struct *recv_file_ent
+@@ -654,6 +670,8 @@ static struct file_struct *recv_file_ent
F_UID(file) = uid;
if (preserve_gid)
F_GID(file) = gid;
if (dirname_len) {
file->dirname = lastdir = bp;
-@@ -906,6 +924,8 @@ struct file_struct *make_file(const char
+@@ -930,6 +948,8 @@ struct file_struct *make_file(const char
F_UID(file) = st.st_uid;
if (preserve_gid)
F_GID(file) = st.st_gid;
extern int omit_dir_times;
extern int delete_mode;
extern int delete_before;
-@@ -477,6 +478,9 @@ void itemize(struct file_struct *file, i
+@@ -475,6 +476,9 @@ void itemize(struct file_struct *file, i
&& (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
|| (keep_time && cmp_time(file->modtime, st->st_mtime) != 0))
iflags |= ITEM_REPORT_TIME;
if ((file->mode & CHMOD_BITS) != (st->st_mode & CHMOD_BITS))
iflags |= ITEM_REPORT_PERMS;
if (preserve_uid && am_root && F_UID(file) != st->st_uid)
-@@ -787,6 +791,8 @@ static int try_dests_reg(struct file_str
+@@ -785,6 +789,8 @@ static int try_dests_reg(struct file_str
if (hard_link_one(file, ndx, fname, 0, stp,
cmpbuf, 1, i, code) < 0)
goto try_a_copy;
+ if (preserve_atimes)
+ set_file_attrs(fname, file, stp, 0);
- if (preserve_hard_links && IS_HLINKED(file))
+ if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, j);
} else
--- old/log.c
+extern int preserve_atimes;
extern int preserve_uid;
extern int preserve_gid;
- extern int flist_extra_ndx;
-@@ -618,7 +619,8 @@ static void log_formatted(enum logcode c
+ extern int stdout_format_has_i;
+@@ -625,7 +626,8 @@ static void log_formatted(enum logcode c
c[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
c[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
c[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
{"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
{"super", 0, POPT_ARG_VAL, &am_root, 2, 0, 0 },
@@ -1223,6 +1228,8 @@ int parse_arguments(int *argc, const cha
- preserve_uid = flist_extra_ndx++;
+ preserve_uid = ++flist_extra_cnt;
if (preserve_gid)
- preserve_gid = flist_extra_ndx++;
+ preserve_gid = ++flist_extra_cnt;
+ if (preserve_atimes)
-+ preserve_atimes = flist_extra_ndx++;
++ preserve_atimes = ++flist_extra_cnt;
*argv = poptGetArgs(pc);
*argc = count_args(*argv);
/* These flags are used in the live flist data. */
-@@ -120,6 +121,7 @@
+@@ -121,6 +122,7 @@
#define ATTRS_REPORT (1<<0)
#define ATTRS_SKIP_MTIME (1<<1)
#define FULL_FLUSH 1
#define NORMAL_FLUSH 0
-@@ -532,6 +534,7 @@ union flist_extras {
- struct idev *idev; /* The hard-link info during matching */
- struct hlist *hlist; /* The hard-link info after matching */
- int32 num; /* A general-purpose number */
-+ time_t time; /* A time value */
- };
-
- #define FLIST_EXTRA(f,j) ((union flist_extras *)(f))[-(j)]
-@@ -540,6 +543,7 @@ union flist_extras {
- /* When enabled, all entries have these: */
- #define F_UID(f) FLIST_EXTRA(f, preserve_uid).uid
- #define F_GID(f) FLIST_EXTRA(f, preserve_gid).gid
-+#define F_ATIME(f) FLIST_EXTRA(f, preserve_atimes).time
+@@ -511,6 +513,7 @@ struct file_struct {
+ union flist_extras {
+ uid_t uid; /* The user ID number */
+ uid_t gid; /* The group ID number or GID_NONE */
++ time_t utime; /* A unix-time value */
+ struct idev *idev; /* The hard-link info during matching */
+ struct hlist *hlist; /* The hard-link info after matching */
+ uint32 unum; /* An unsigned number */
+@@ -551,6 +554,7 @@ extern int preserve_gid;
+ /* When the associated option is on, all entries will have these present: */
+ #define F_UID(f) REQ_EXTRA(f, preserve_uid)->uid
+ #define F_GID(f) REQ_EXTRA(f, preserve_gid)->gid
++#define F_ATIME(f) REQ_EXTRA(f, preserve_atimes)->utime
/* These are per-entry optional and mutally exclusive: */
- #define F_IDEV(f) FLIST_EXTRA(f, flist_extra_ndx).idev
+ #define F_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev
--- old/rsync.yo
+++ new/rsync.yo
@@ -328,8 +328,9 @@ to the detailed description below for a
extern int size_only;
extern OFF_T max_size;
extern OFF_T min_size;
-@@ -378,6 +379,8 @@ void itemize(struct file_struct *file, i
+@@ -507,6 +508,9 @@ void itemize(struct file_struct *file, i
/* Perform our quick-check heuristic for determining if a file is unchanged. */
int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
{
+ if (date_only)
+ return cmp_time(st->st_mtime, file->modtime) == 0;
- if (st->st_size != file->length)
++
+ if (st->st_size != F_LENGTH(file))
return 0;
--- old/options.c
int daemon_bwlimit = 0;
int bwlimit = 0;
int fuzzy_basis = 0;
-@@ -343,6 +344,7 @@ void usage(enum logcode F)
+@@ -340,6 +341,7 @@ void usage(enum logcode F)
rprintf(F," --timeout=TIME set I/O timeout in seconds\n");
rprintf(F," -I, --ignore-times don't skip files that match in size and mod-time\n");
rprintf(F," --size-only skip files that match in size\n");
rprintf(F," --modify-window=NUM compare mod-times with reduced accuracy\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");
-@@ -463,6 +465,7 @@ static struct poptOption long_options[]
+@@ -460,6 +462,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 },
{"update", 'u', POPT_ARG_NONE, &update_only, 0, 0, 0 },
{"existing", 0, POPT_ARG_NONE, &ignore_non_existing, 0, 0, 0 },
-@@ -1676,6 +1679,9 @@ void server_options(char **args,int *arg
+@@ -1682,6 +1685,9 @@ void server_options(char **args,int *arg
args[ac++] = "--size-only";
}
goto oom;
--- old/rsync.yo
+++ new/rsync.yo
-@@ -360,6 +360,7 @@ to the detailed description below for a
+@@ -361,6 +361,7 @@ to the detailed description below for a
--timeout=TIME set I/O timeout in seconds
-I, --ignore-times don't skip files that match size and time
--size-only skip files that match in size
--modify-window=NUM compare mod-times with reduced accuracy
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
-@@ -477,6 +478,12 @@ regardless of timestamp. This is useful
+@@ -478,6 +479,12 @@ regardless of timestamp. This is useful
after using another mirroring system which may not preserve timestamps
exactly.
extern int module_id;
extern int ignore_errors;
extern int numeric_ids;
-@@ -723,6 +724,15 @@ static struct file_struct *recv_file_ent
+@@ -730,6 +731,15 @@ static struct file_struct *recv_file_ent
bp = tmp_sum;
}
read_buf(f, bp, checksum_len);
return file;
--- old/generator.c
+++ new/generator.c
-@@ -71,6 +71,7 @@ extern int ignore_timeout;
+@@ -70,6 +70,7 @@ extern int ignore_timeout;
extern int protocol_version;
extern int fuzzy_basis;
extern int always_checksum;
extern int checksum_len;
extern char *partial_dir;
extern char *basis_dir[];
-@@ -507,7 +508,8 @@ void itemize(struct file_struct *file, i
+@@ -505,7 +506,8 @@ void itemize(struct file_struct *file, i
/* Perform our quick-check heuristic for determining if a file is unchanged. */
+int unchanged_file(char *fn, int fnamecmp_type, struct file_struct *file,
+ STRUCT_STAT *st)
{
- if (st->st_size != file->length)
+ if (st->st_size != F_LENGTH(file))
return 0;
-@@ -516,6 +518,8 @@ int unchanged_file(char *fn, struct file
+@@ -514,6 +516,8 @@ int unchanged_file(char *fn, struct file
of the file time to determine whether to sync */
if (always_checksum && S_ISREG(st->st_mode)) {
char sum[MD4_SUM_LENGTH];
file_checksum(fn, sum, st->st_size);
return memcmp(sum, F_SUM(file), checksum_len) == 0;
}
-@@ -752,7 +756,7 @@ static int try_dests_reg(struct file_str
+@@ -750,7 +754,7 @@ static int try_dests_reg(struct file_str
match_level = 1;
/* FALL THROUGH */
case 1:
continue;
best_match = j;
match_level = 2;
-@@ -1420,7 +1424,7 @@ static void recv_generator(char *fname,
+@@ -1418,7 +1422,7 @@ static void recv_generator(char *fname,
;
else if (fnamecmp_type == FNAMECMP_FUZZY)
;
handle_partial_dir(partialptr, PDIR_DELETE);
--- old/hlink.c
+++ new/hlink.c
-@@ -235,7 +235,7 @@ int hard_link_check(struct file_struct *
+@@ -234,7 +234,7 @@ int hard_link_check(struct file_struct *
}
break;
}
--- old/rsync.h
+++ new/rsync.h
-@@ -61,6 +61,7 @@
- #define FLAG_SENT (1<<1) /* sender/generator */
- #define FLAG_XFER_DIR (1<<2) /* sender/receiver/generator */
- #define FLAG_MOUNT_DIR (1<<3) /* sender/generator */
-+#define FLAG_SUM_DIFFERS (1<<3) /* receiver/generator (non-dirs) */
- #define FLAG_MISSING_DIR (1<<4) /* generator (dirs only) */
- #define FLAG_HLINK_INFO (1<<5) /* receiver/generator */
+@@ -66,6 +66,7 @@
#define FLAG_HLINK_FIRST (1<<6) /* receiver/generator */
+ #define FLAG_HLINK_LAST (1<<7) /* receiver/generator */
+ #define FLAG_LENGTH64 (1<<8) /* sender/receiver/generator */
++#define FLAG_SUM_DIFFERS (1<<9) /* receiver/generator */
+
+ /* update this if you make incompatible changes */
+ #define PROTOCOL_VERSION 30
extern int preserve_uid;
extern int preserve_gid;
extern int relative_paths;
-@@ -313,6 +314,9 @@ static void send_file_entry(struct file_
+@@ -312,6 +313,9 @@ static void send_file_entry(struct file_
unsigned short flags;
static time_t modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
static uint32 rdev_major;
-@@ -343,6 +347,12 @@ static void send_file_entry(struct file_
+@@ -342,6 +346,12 @@ static void send_file_entry(struct file_
flags |= XMIT_SAME_MODE;
else
mode = file->mode;
if ((preserve_devices && IS_DEVICE(mode))
|| (preserve_specials && IS_SPECIAL(mode))) {
if (protocol_version < 28) {
-@@ -429,6 +439,10 @@ static void send_file_entry(struct file_
+@@ -428,6 +438,10 @@ static void send_file_entry(struct file_
write_int(f, modtime);
if (!(flags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
if (preserve_uid && !(flags & XMIT_SAME_UID)) {
if (!numeric_ids)
add_uid(uid);
-@@ -497,6 +511,9 @@ static struct file_struct *recv_file_ent
+@@ -496,6 +510,9 @@ static struct file_struct *recv_file_ent
{
static time_t modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
static uint32 rdev_major;
-@@ -571,9 +588,12 @@ static struct file_struct *recv_file_ent
+@@ -570,9 +587,12 @@ static struct file_struct *recv_file_ent
modtime = (time_t)read_int(f);
if (!(flags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
if (preserve_uid && !(flags & XMIT_SAME_UID))
uid = (uid_t)read_int(f);
-@@ -639,6 +659,10 @@ static struct file_struct *recv_file_ent
- file->modtime = modtime;
- file->length = file_length;
+@@ -650,6 +670,10 @@ static struct file_struct *recv_file_ent
+ OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32);
+ }
file->mode = mode;
+#ifdef SUPPORT_FLAGS
+ if (preserve_fileflags)
if (preserve_uid)
F_UID(file) = uid;
if (preserve_gid)
-@@ -902,6 +926,10 @@ struct file_struct *make_file(const char
- file->modtime = st.st_mtime;
- file->length = st.st_size;
+@@ -926,6 +950,10 @@ struct file_struct *make_file(const char
+ OPT_EXTRA(file, 0)->unum = (uint32)(st.st_size >> 32);
+ }
file->mode = st.st_mode;
+#ifdef SUPPORT_FLAGS
+ if (preserve_fileflags)
if (preserve_gid)
--- old/generator.c
+++ new/generator.c
-@@ -101,6 +101,12 @@ int non_perishable_cnt = 0;
+@@ -99,6 +99,12 @@ int non_perishable_cnt = 0;
static int deletion_count = 0; /* used to implement --max-delete */
static FILE *delete_delay_fp = NULL;
/* For calling delete_item() and delete_dir_contents(). */
#define DEL_RECURSE (1<<1) /* recurse */
#define DEL_DIR_IS_EMPTY (1<<2) /* internal delete_FUNCTIONS use only */
-@@ -116,7 +122,6 @@ enum delret {
+@@ -114,7 +120,6 @@ enum delret {
/* Forward declaration for delete_item(). */
static enum delret delete_dir_contents(char *fname, int flags);
static int is_backup_file(char *fn)
{
int k = strlen(fn) - backup_suffix_len;
-@@ -129,17 +134,20 @@ static int is_backup_file(char *fn)
+@@ -127,17 +132,20 @@ static int is_backup_file(char *fn)
* Note that fbuf must point to a MAXPATHLEN buffer if the mode indicates it's
* a directory! (The buffer is used for recursion, but returned unchanged.)
*/
if (S_ISDIR(mode) && !(flags & DEL_DIR_IS_EMPTY)) {
ignore_perishable = 1;
/* If DEL_RECURSE is not set, this just reports emptiness. */
-@@ -251,7 +259,7 @@ static enum delret delete_dir_contents(c
+@@ -249,7 +257,7 @@ static enum delret delete_dir_contents(c
if (S_ISDIR(fp->mode)
&& delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS)
ret = DR_NOT_EMPTY;
ret = DR_NOT_EMPTY;
}
-@@ -403,10 +411,10 @@ static void delete_in_dir(struct file_li
+@@ -401,10 +409,10 @@ static void delete_in_dir(struct file_li
}
if (flist_find(flist, fp) < 0) {
f_name(fp, delbuf);
}
}
-@@ -1101,7 +1109,7 @@ static void recv_generator(char *fname,
+@@ -1099,7 +1107,7 @@ static void recv_generator(char *fname,
* we need to delete it. If it doesn't exist, then
* (perhaps recursively) create it. */
if (statret == 0 && !S_ISDIR(st.st_mode)) {
return;
statret = -1;
}
-@@ -1195,7 +1203,7 @@ static void recv_generator(char *fname,
+@@ -1193,7 +1201,7 @@ static void recv_generator(char *fname,
}
/* Not the right symlink (or not a symlink), so
* delete it. */
return;
} else if (basis_dir[0] != NULL) {
int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
-@@ -1267,7 +1275,7 @@ static void recv_generator(char *fname,
+@@ -1265,7 +1273,7 @@ static void recv_generator(char *fname,
goto return_with_success;
return;
}
return;
} else if (basis_dir[0] != NULL) {
int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
-@@ -1353,7 +1361,7 @@ static void recv_generator(char *fname,
+@@ -1351,7 +1359,7 @@ static void recv_generator(char *fname,
fnamecmp_type = FNAMECMP_FNAME;
if (statret == 0 && !S_ISREG(st.st_mode)) {
snprintf(err_buf, sizeof err_buf,
"--write-batch and --read-batch can not be used together\n");
@@ -1223,6 +1241,8 @@ int parse_arguments(int *argc, const cha
- preserve_uid = flist_extra_ndx++;
+ preserve_uid = ++flist_extra_cnt;
if (preserve_gid)
- preserve_gid = flist_extra_ndx++;
+ preserve_gid = ++flist_extra_cnt;
+ if (preserve_fileflags)
-+ preserve_fileflags = flist_extra_ndx++;
++ preserve_fileflags = ++flist_extra_cnt;
*argv = poptGetArgs(pc);
*argc = count_args(*argv);
/* These flags are used in the live flist data. */
-@@ -347,6 +348,10 @@ enum msgcode {
+@@ -348,6 +349,10 @@ enum msgcode {
#define schar char
#endif
/* Find a variable that is either exactly 32-bits or longer.
* If some code depends on 32-bit truncation, it will need to
* take special action in a "#if SIZEOF_INT32 > 4" section. */
-@@ -540,6 +545,7 @@ union flist_extras {
- /* When enabled, all entries have these: */
- #define F_UID(f) FLIST_EXTRA(f, preserve_uid).uid
- #define F_GID(f) FLIST_EXTRA(f, preserve_gid).gid
-+#define F_FFLAGS(f) FLIST_EXTRA(f, preserve_fileflags).num
+@@ -551,6 +556,7 @@ extern int preserve_gid;
+ /* When the associated option is on, all entries will have these present: */
+ #define F_UID(f) REQ_EXTRA(f, preserve_uid)->uid
+ #define F_GID(f) REQ_EXTRA(f, preserve_gid)->gid
++#define F_FFLAGS(f) REQ_EXTRA(f, preserve_fileflags).num
/* These are per-entry optional and mutally exclusive: */
- #define F_IDEV(f) FLIST_EXTRA(f, flist_extra_ndx).idev
+ #define F_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev
--- old/rsync.yo
+++ new/rsync.yo
@@ -321,6 +321,7 @@ to the detailed description below for a
extern int size_only;
extern OFF_T max_size;
extern OFF_T min_size;
-@@ -378,7 +379,7 @@ void itemize(struct file_struct *file, i
+@@ -507,7 +508,7 @@ void itemize(struct file_struct *file, i
/* Perform our quick-check heuristic for determining if a file is unchanged. */
int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
{
-- if (st->st_size != file->length)
-+ if (!times_only && st->st_size != file->length)
+- if (st->st_size != F_LENGTH(file))
++ if (!times_only && st->st_size != F_LENGTH(file))
return 0;
/* if always checksum is set then we use the checksum instead
char *rsync_path = RSYNC_PATH;
char *backup_dir = NULL;
char backup_dir_buf[MAXPATHLEN];
-@@ -343,6 +346,7 @@ void usage(enum logcode F)
+@@ -340,6 +343,7 @@ void usage(enum logcode F)
rprintf(F," --timeout=TIME set I/O timeout in seconds\n");
rprintf(F," -I, --ignore-times don't skip files that match in size and mod-time\n");
rprintf(F," --size-only skip files that match in size\n");
rprintf(F," --modify-window=NUM compare mod-times with reduced accuracy\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");
-@@ -380,6 +384,8 @@ void usage(enum logcode F)
+@@ -377,6 +381,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 INET6
rprintf(F," -4, --ipv4 prefer IPv4\n");
-@@ -463,6 +469,7 @@ static struct poptOption long_options[]
+@@ -460,6 +466,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 },
{"update", 'u', POPT_ARG_NONE, &update_only, 0, 0, 0 },
{"existing", 0, POPT_ARG_NONE, &ignore_non_existing, 0, 0, 0 },
-@@ -541,6 +548,8 @@ static struct poptOption long_options[]
+@@ -539,6 +546,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 },
{"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 },
-@@ -1410,6 +1419,16 @@ int parse_arguments(int *argc, const cha
+@@ -1409,6 +1418,16 @@ int parse_arguments(int *argc, const cha
}
}
if (files_from) {
char *h, *p;
int q;
-@@ -1676,6 +1695,25 @@ void server_options(char **args,int *arg
+@@ -1682,6 +1701,25 @@ void server_options(char **args,int *arg
args[ac++] = "--size-only";
}
goto oom;
--- old/pipe.c
+++ new/pipe.c
-@@ -166,3 +166,77 @@ pid_t local_child(int argc, char **argv,
+@@ -165,3 +165,77 @@ pid_t local_child(int argc, char **argv,
return pid;
}
extern char *stdout_format;
extern char *tmpdir;
extern char *partial_dir;
-@@ -351,6 +352,8 @@ int recv_files(int f_in, struct file_lis
+@@ -348,6 +349,8 @@ int recv_files(int f_in, struct file_lis
enum logcode log_code = log_before_transfer ? FLOG : FINFO;
int max_phase = protocol_version >= 29 ? 2 : 1;
int i, recv_ok;
if (verbose > 2)
rprintf(FINFO,"recv_files(%d) starting\n",flist->count);
-@@ -365,6 +368,23 @@ int recv_files(int f_in, struct file_lis
+@@ -362,6 +365,23 @@ int recv_files(int f_in, struct file_lis
updating_basis = inplace;
while (1) {
cleanup_disable();
-@@ -610,6 +630,9 @@ int recv_files(int f_in, struct file_lis
+@@ -607,6 +627,9 @@ int recv_files(int f_in, struct file_lis
else if (!am_server && verbose && do_progress)
rprintf(FINFO, "%s\n", fname);
+
/* recv file data */
recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
- fname, fd2, file->length);
-@@ -624,6 +647,16 @@ int recv_files(int f_in, struct file_lis
+ fname, fd2, F_LENGTH(file));
+@@ -621,6 +644,16 @@ int recv_files(int f_in, struct file_lis
exit_cleanup(RERR_FILEIO);
}
if (partialptr == fname)
--- old/rsync.h
+++ new/rsync.h
-@@ -104,6 +104,7 @@
+@@ -105,6 +105,7 @@
#define IOERR_DEL_LIMIT (1<<2)
#define MAX_ARGS 1000
--- old/rsync.yo
+++ new/rsync.yo
-@@ -360,6 +360,7 @@ to the detailed description below for a
+@@ -361,6 +361,7 @@ to the detailed description below for a
--timeout=TIME set I/O timeout in seconds
-I, --ignore-times don't skip files that match size and time
--size-only skip files that match in size
--modify-window=NUM compare mod-times with reduced accuracy
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
-@@ -397,6 +398,8 @@ to the detailed description below for a
+@@ -398,6 +399,8 @@ to the detailed description below for a
--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
--checksum-seed=NUM set block/file checksum seed (advanced)
-4, --ipv4 prefer IPv4
-@@ -1759,6 +1762,33 @@ file previously generated by bf(--write-
+@@ -1772,6 +1775,33 @@ file previously generated by bf(--write-
If em(FILE) is bf(-), the batch data will be read from standard input.
See the "BATCH MODE" section for details.
extern char *stdout_format;
-@@ -224,6 +225,26 @@ void send_files(struct file_list *flist,
+@@ -174,6 +175,26 @@ void send_files(struct file_list *flist,
enum logcode log_code = log_before_transfer ? FLOG : FINFO;
int f_xfer = write_batch < 0 ? batch_fd : f_out;
int i, j;
if (verbose > 2)
rprintf(FINFO, "send_files starting\n");
-@@ -297,6 +318,7 @@ void send_files(struct file_list *flist,
+@@ -247,6 +268,7 @@ void send_files(struct file_list *flist,
return;
}
fd = do_open(fname, O_RDONLY, 0);
if (fd == -1) {
if (errno == ENOENT) {
-@@ -325,6 +347,33 @@ void send_files(struct file_list *flist,
+@@ -275,6 +297,33 @@ void send_files(struct file_list *flist,
return;
}
if (st.st_size) {
int32 read_size = MAX(s->blength * 3, MAX_MAP_SIZE);
mbuf = map_file(fd, st.st_size, read_size, s->blength);
-@@ -366,6 +415,8 @@ void send_files(struct file_list *flist,
+@@ -316,6 +365,8 @@ void send_files(struct file_list *flist,
}
}
close(fd);
extern int preserve_devices;
extern int preserve_specials;
extern int preserve_links;
-@@ -137,6 +138,9 @@ static int make_bak_dir(char *fullpath)
+@@ -135,6 +136,9 @@ static int make_bak_dir(char *fullpath)
#ifdef SUPPORT_ACLS
sx.acc_acl = sx.def_acl = NULL;
#endif
if (!(file = make_file(rel, NULL, NULL, 0, NO_FILTERS)))
continue;
#ifdef SUPPORT_ACLS
-@@ -145,6 +149,12 @@ static int make_bak_dir(char *fullpath)
+@@ -143,6 +147,12 @@ static int make_bak_dir(char *fullpath)
cache_acl(file, &sx);
}
#endif
set_file_attrs(fullpath, file, NULL, 0);
free(file);
}
-@@ -196,6 +206,9 @@ static int keep_backup(const char *fname
+@@ -194,6 +204,9 @@ static int keep_backup(const char *fname
#ifdef SUPPORT_ACLS
sx.acc_acl = sx.def_acl = NULL;
#endif
if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
return 1; /* the file could have disappeared */
-@@ -211,6 +224,12 @@ static int keep_backup(const char *fname
+@@ -209,6 +222,12 @@ static int keep_backup(const char *fname
cache_acl(file, &sx);
}
#endif
extern int preserve_links;
extern int preserve_hard_links;
extern int preserve_devices;
-@@ -738,6 +739,10 @@ static struct file_struct *recv_file_ent
+@@ -745,6 +746,10 @@ static struct file_struct *recv_file_ent
if (preserve_acls)
receive_acl(file, f);
#endif
return file;
}
-@@ -991,7 +996,7 @@ static struct file_struct *send_file_nam
+@@ -1006,7 +1011,7 @@ static struct file_struct *send_file_nam
unsigned short flags)
{
struct file_struct *file;
statx sx;
#endif
-@@ -1011,6 +1016,13 @@ static struct file_struct *send_file_nam
+@@ -1026,6 +1031,13 @@ static struct file_struct *send_file_nam
return NULL;
}
#endif
maybe_emit_filelist_progress(flist->count + flist_count_offset);
-@@ -1021,6 +1033,10 @@ static struct file_struct *send_file_nam
+@@ -1036,6 +1048,10 @@ static struct file_struct *send_file_nam
if (preserve_acls && f >= 0)
send_acl(&sx, f);
#endif
default:
/* A large opt value means that set_refuse_options()
@@ -1255,6 +1276,8 @@ int parse_arguments(int *argc, const cha
- preserve_gid = flist_extra_ndx++;
+ preserve_gid = ++flist_extra_cnt;
if (preserve_acls)
- preserve_acls = flist_extra_ndx++;
+ preserve_acls = ++flist_extra_cnt;
+ if (preserve_xattrs)
-+ preserve_xattrs = flist_extra_ndx++;
++ preserve_xattrs = ++flist_extra_cnt;
*argv = poptGetArgs(pc);
*argc = count_args(*argv);
* will enable owner-writability using chmod, if necessary.
--- old/rsync.h
+++ new/rsync.h
-@@ -503,6 +503,10 @@ struct idev {
+@@ -504,6 +504,10 @@ struct idev {
#define ACLS_NEED_MASK 1
#endif
#define GID_NONE ((gid_t)-1)
#define HL_CHECK_MASTER 0
-@@ -549,6 +553,7 @@ union flist_extras {
- #define F_UID(f) FLIST_EXTRA(f, preserve_uid).uid
- #define F_GID(f) FLIST_EXTRA(f, preserve_gid).gid
- #define F_ACL(f) FLIST_EXTRA(f, preserve_acls).num
-+#define F_XATTR(f) FLIST_EXTRA(f, preserve_xattrs).num
+@@ -560,6 +564,7 @@ extern int preserve_gid;
+ #define F_UID(f) REQ_EXTRA(f, preserve_uid)->uid
+ #define F_GID(f) REQ_EXTRA(f, preserve_gid)->gid
+ #define F_ACL(f) REQ_EXTRA(f, preserve_acls)->unum
++#define F_XATTR(f) REQ_EXTRA(f, preserve_xattrs)->unum
/* These are per-entry optional and mutally exclusive: */
- #define F_IDEV(f) FLIST_EXTRA(f, flist_extra_ndx).idev
-@@ -712,6 +717,9 @@ typedef struct {
+ #define F_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev
+@@ -734,6 +739,9 @@ typedef struct {
struct rsync_acl *acc_acl; /* access ACL */
struct rsync_acl *def_acl; /* default ACL */
#endif