} else {
if (remove_sent_files
|| (preserve_hard_links
-@@ -416,6 +438,9 @@ int recv_files(int f_in, struct file_lis
+@@ -417,6 +439,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");
discard_receive_data(f_in, file->length);
if (fd1 != -1)
close(fd1);
-@@ -607,12 +650,19 @@ int recv_files(int f_in, struct file_lis
+@@ -605,12 +648,19 @@ int recv_files(int f_in, struct file_lis
+ fname, fd2, file->length);
- if (!log_before_transfer)
- log_item(file, &initial_stats, iflags, NULL);
+ log_item(log_code, file, &initial_stats, iflags, NULL);
+#ifdef HAVE_LIBODBC
+ db_log_transfer(file, &initial_stats, "receive");
+#endif
exit_cleanup(RERR_FILEIO);
}
-@@ -671,6 +721,12 @@ int recv_files(int f_in, struct file_lis
+@@ -669,6 +719,12 @@ int recv_files(int f_in, struct file_lis
rprintf(msgtype,
"%s: %s failed verification -- update %s%s.\n",
errstr, fname, keptstr, redostr);
SIVAL(numbuf, 0, i);
--- old/sender.c
+++ new/sender.c
-@@ -354,6 +354,9 @@ void send_files(struct file_list *flist,
+@@ -353,6 +353,9 @@ void send_files(struct file_list *flist,
+ end_progress(st.st_size);
- if (!log_before_transfer)
- log_item(file, &initial_stats, iflags, NULL);
+ log_item(log_code, file, &initial_stats, iflags, NULL);
+#ifdef HAVE_LIBODBC
+ db_log_transfer(file, &initial_stats,"send");
+#endif
+ itemize(file, ndx, 0, sxp, 0, 0, NULL);
+ }
if (verbose > 1 && maybe_ATTRS_REPORT) {
- code = logfile_format_has_i || dry_run
- ? FCLIENT : FINFO;
-@@ -686,8 +706,13 @@ static int try_dests_reg(struct file_str
+ code = logfile_format_has_i || dry_run ? FNAME : FINFO;
+ rprintf(code, "%s is uptodate\n", fname);
+@@ -685,8 +705,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)
-@@ -712,13 +737,18 @@ static int try_dests_non(struct file_str
+@@ -710,13 +735,18 @@ static int try_dests_non(struct file_str
enum logcode code)
{
char fnamebuf[MAXPATHLEN];
continue;
if (S_ISLNK(file->mode)) {
#ifdef SUPPORT_LINKS
-@@ -731,10 +761,10 @@ static int try_dests_non(struct file_str
+@@ -729,10 +759,10 @@ static int try_dests_non(struct file_str
#endif
continue;
} else if (IS_SPECIAL(file->mode)) {
continue;
} else {
rprintf(FERROR,
-@@ -765,7 +795,15 @@ static int try_dests_non(struct file_str
+@@ -763,7 +793,15 @@ static int try_dests_non(struct file_str
int changes = compare_dest ? 0 : ITEM_LOCAL_CHANGE
+ (link_dest ? ITEM_XNAME_FOLLOWS : 0);
char *lp = link_dest ? "" : NULL;
+#endif
}
if (verbose > 1 && maybe_ATTRS_REPORT) {
- code = logfile_format_has_i || dry_run
-@@ -779,6 +817,7 @@ static int try_dests_non(struct file_str
+ code = logfile_format_has_i || dry_run ? FNAME : FINFO;
+@@ -776,6 +814,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
-@@ -800,7 +839,8 @@ static void recv_generator(char *fname,
+@@ -797,7 +836,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;
-@@ -851,6 +891,9 @@ static void recv_generator(char *fname,
+@@ -848,6 +888,9 @@ static void recv_generator(char *fname,
dry_run--;
missing_below = -1;
}
if (dry_run > 1) {
statret = -1;
stat_errno = ENOENT;
-@@ -858,7 +901,7 @@ static void recv_generator(char *fname,
+@@ -855,7 +898,7 @@ static void recv_generator(char *fname,
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",
-@@ -870,6 +913,10 @@ static void recv_generator(char *fname,
+@@ -867,6 +910,10 @@ static void recv_generator(char *fname,
}
if (fuzzy_basis)
need_fuzzy_dirlist = 1;
}
parent_dirname = dn;
-@@ -878,7 +925,7 @@ static void recv_generator(char *fname,
+@@ -875,7 +922,7 @@ static void recv_generator(char *fname,
need_fuzzy_dirlist = 0;
}
keep_dirlinks && S_ISDIR(file->mode));
stat_errno = errno;
}
-@@ -896,8 +943,9 @@ static void recv_generator(char *fname,
+@@ -893,8 +940,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)) {
-@@ -906,8 +954,8 @@ static void recv_generator(char *fname,
+@@ -903,8 +951,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;
}
-@@ -916,7 +964,11 @@ static void recv_generator(char *fname,
+@@ -913,7 +961,11 @@ static void recv_generator(char *fname,
dry_run++;
}
if (itemizing && f_out != -1) {
statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
}
if (statret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) {
-@@ -928,19 +980,19 @@ static void recv_generator(char *fname,
+@@ -925,19 +977,19 @@ static void recv_generator(char *fname,
full_fname(fname));
}
}
if (preserve_links && S_ISLNK(file->mode)) {
#ifdef SUPPORT_LINKS
-@@ -958,7 +1010,7 @@ static void recv_generator(char *fname,
+@@ -955,7 +1007,7 @@ static void recv_generator(char *fname,
char lnk[MAXPATHLEN];
int len;
&& (len = readlink(fname, lnk, MAXPATHLEN-1)) > 0) {
lnk[len] = 0;
/* A link already pointing to the
-@@ -966,10 +1018,10 @@ static void recv_generator(char *fname,
+@@ -963,10 +1015,10 @@ static void recv_generator(char *fname,
* required. */
if (strcmp(lnk, file->u.link) == 0) {
if (itemizing) {
maybe_ATTRS_REPORT);
if (preserve_hard_links
&& file->link_u.links) {
-@@ -982,9 +1034,9 @@ static void recv_generator(char *fname,
+@@ -979,9 +1031,9 @@ static void recv_generator(char *fname,
}
/* Not the right symlink (or not a symlink), so
* delete it. */
statret = -1;
} else if (basis_dir[0] != NULL) {
if (try_dests_non(file, fname, ndx, itemizing,
-@@ -1000,7 +1052,7 @@ static void recv_generator(char *fname,
+@@ -997,7 +1049,7 @@ static void recv_generator(char *fname,
}
}
if (preserve_hard_links && file->link_u.links
itemizing, code, HL_SKIP))
return;
if (do_symlink(file->u.link,fname) != 0) {
-@@ -1009,7 +1061,7 @@ static void recv_generator(char *fname,
+@@ -1006,7 +1058,7 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code && verbose) {
-@@ -1043,18 +1095,22 @@ static void recv_generator(char *fname,
+@@ -1040,18 +1092,22 @@ static void recv_generator(char *fname,
itemizing = code = 0;
}
}
statret = -1;
if (verbose > 2) {
rprintf(FINFO,"mknod(%s,0%o,0x%x)\n",
-@@ -1067,7 +1123,7 @@ static void recv_generator(char *fname,
+@@ -1064,7 +1120,7 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code && verbose)
-@@ -1079,12 +1135,12 @@ static void recv_generator(char *fname,
+@@ -1076,12 +1132,12 @@ static void recv_generator(char *fname,
}
} else {
if (itemizing)
}
if (!S_ISREG(file->mode)) {
-@@ -1118,7 +1174,7 @@ static void recv_generator(char *fname,
+@@ -1115,7 +1171,7 @@ static void recv_generator(char *fname,
}
if (update_only && statret == 0
if (verbose > 1)
rprintf(FINFO, "%s is newer\n", fname);
return;
-@@ -1127,18 +1183,18 @@ static void recv_generator(char *fname,
+@@ -1124,18 +1180,18 @@ static void recv_generator(char *fname,
fnamecmp = fname;
fnamecmp_type = FNAMECMP_FNAME;
if (j != -1) {
fnamecmp = fnamecmpbuf;
fnamecmp_type = j;
-@@ -1147,7 +1203,7 @@ static void recv_generator(char *fname,
+@@ -1144,7 +1200,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
-@@ -1166,7 +1222,7 @@ static void recv_generator(char *fname,
+@@ -1163,7 +1219,7 @@ static void recv_generator(char *fname,
rprintf(FINFO, "fuzzy basis selected for %s: %s\n",
fname, fnamecmpbuf);
}
statret = 0;
fnamecmp = fnamecmpbuf;
fnamecmp_type = FNAMECMP_FUZZY;
-@@ -1175,7 +1231,7 @@ static void recv_generator(char *fname,
+@@ -1172,7 +1228,7 @@ static void recv_generator(char *fname,
if (statret != 0) {
if (preserve_hard_links && file->link_u.links
itemizing, code, HL_SKIP))
return;
if (stat_errno == ENOENT)
-@@ -1185,31 +1241,44 @@ static void recv_generator(char *fname,
+@@ -1182,31 +1238,44 @@ static void recv_generator(char *fname,
return;
}
fnamecmp = partialptr;
fnamecmp_type = FNAMECMP_PARTIAL_DIR;
statret = 0;
-@@ -1233,17 +1302,21 @@ static void recv_generator(char *fname,
+@@ -1230,17 +1299,21 @@ static void recv_generator(char *fname,
pretend_missing:
/* pretend the file didn't exist */
if (preserve_hard_links && file->link_u.links
}
if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) {
close(fd);
-@@ -1254,7 +1327,7 @@ static void recv_generator(char *fname,
+@@ -1251,7 +1324,7 @@ static void recv_generator(char *fname,
full_fname(backupptr));
free(back_file);
close(fd);
}
if ((f_copy = do_open(backupptr,
O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0) {
-@@ -1262,14 +1335,14 @@ static void recv_generator(char *fname,
+@@ -1259,14 +1332,14 @@ static void recv_generator(char *fname,
full_fname(backupptr));
free(back_file);
close(fd);
}
if (verbose > 2)
-@@ -1287,24 +1360,32 @@ static void recv_generator(char *fname,
+@@ -1284,24 +1357,32 @@ static void recv_generator(char *fname,
iflags |= ITEM_BASIS_TYPE_FOLLOWS;
if (fnamecmp_type == FNAMECMP_FUZZY)
iflags |= ITEM_XNAME_FOLLOWS;
if (f_copy >= 0) {
close(f_copy);
-@@ -1317,6 +1398,13 @@ static void recv_generator(char *fname,
+@@ -1314,6 +1395,13 @@ static void recv_generator(char *fname,
}
close(fd);
}
void generate_files(int f_out, struct file_list *flist, char *local_name)
-@@ -1376,6 +1464,8 @@ void generate_files(int f_out, struct fi
+@@ -1373,6 +1461,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 log_format_has_i;
+ extern int stdout_format_has_i;
extern char *basis_dir[];
@@ -143,15 +144,19 @@ void init_hard_links(void)
statret = 1;
- st = &st3;
+ sxp->st = st3;
- if (verbose < 2 || !log_format_has_i)
+ if (verbose < 2 || !stdout_format_has_i)
itemizing = code = 0;
break;
@@ -215,12 +220,16 @@ int hard_link_check(struct file_struct *
+int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
--- old/log.c
+++ new/log.c
-@@ -592,8 +592,10 @@ static void log_formatted(enum logcode c
+@@ -594,8 +594,10 @@ static void log_formatted(enum logcode c
n[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
n[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
n[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
rprintf(F," --chmod=CHMOD change destination permissions\n");
rprintf(F," -o, --owner preserve owner (super-user only)\n");
rprintf(F," -g, --group preserve group\n");
-@@ -415,6 +424,9 @@ static struct poptOption long_options[]
+@@ -416,6 +425,9 @@ static struct poptOption long_options[]
{"no-perms", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
{"no-p", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
{"executability", 'E', POPT_ARG_NONE, &preserve_executability, 0, 0, 0 },
{"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 },
{"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
{"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
-@@ -1080,6 +1092,24 @@ int parse_arguments(int *argc, const cha
+@@ -1083,6 +1095,24 @@ int parse_arguments(int *argc, const cha
usage(FINFO);
exit_cleanup(0);
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1526,6 +1556,10 @@ void server_options(char **args,int *arg
+@@ -1529,6 +1559,10 @@ void server_options(char **args,int *arg
if (preserve_hard_links)
argstr[x++] = 'H';
extern int delay_updates;
+extern mode_t orig_umask;
extern struct stats stats;
- extern char *log_format;
+ extern char *stdout_format;
extern char *tmpdir;
-@@ -344,6 +345,10 @@ int recv_files(int f_in, struct file_lis
- int save_make_backups = make_backups;
- int itemizing = am_server ? logfile_format_has_i : log_format_has_i;
+@@ -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 dflt_perms = (ACCESSPERMS & ~orig_umask);
+#ifdef SUPPORT_ACLS
int i, recv_ok;
if (verbose > 2)
-@@ -541,7 +546,16 @@ int recv_files(int f_in, struct file_lis
+@@ -543,7 +548,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;
}
if (ret == 0) /* ret == 1 if symlink could not be set */
updated = 1;
-@@ -225,6 +247,11 @@ int set_file_attrs(char *fname, struct f
+@@ -224,6 +246,11 @@ int set_file_attrs(char *fname, struct f
else
rprintf(code, "%s is uptodate\n", fname);
}
--chmod=CHMOD change destination permissions
-o, --owner preserve owner (super-user only)
-g, --group preserve group
-@@ -744,7 +745,9 @@ quote(itemize(
+@@ -745,7 +746,9 @@ quote(itemize(
permissions, though the bf(--executability) option might change just
the execute permission for the file.
it() New files get their "normal" permission bits set to the source
their special permission bits disabled except in the case where a new
directory inherits a setgid bit from its parent directory.
))
-@@ -775,9 +778,11 @@ The preservation of the destination's se
+@@ -776,9 +779,11 @@ The preservation of the destination's se
directories when bf(--perms) is off was added in rsync 2.6.7. Older rsync
versions erroneously preserved the three special permission bits for
newly-created files when bf(--perms) was off, while overriding the
dit(bf(-E, --executability)) This option causes rsync to preserve the
executability (or non-executability) of regular files when bf(--perms) is
-@@ -795,6 +800,15 @@ quote(itemize(
+@@ -796,6 +801,15 @@ quote(itemize(
If bf(--perms) is enabled, this option is ignored.
dit(bf(--chmod)) This option tells rsync to apply one or more
comma-separated "chmod" strings to the permission of the files in the
transfer. The resulting value is treated as though it was the permissions
-@@ -1376,8 +1390,8 @@ if the receiving rsync is at least versi
+@@ -1377,8 +1391,8 @@ if the receiving rsync is at least versi
with older versions of rsync, but that also turns on the output of other
verbose messages).
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.
-@@ -1426,7 +1440,11 @@ quote(itemize(
+@@ -1427,7 +1441,11 @@ quote(itemize(
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).
f_name(f, NULL));
}
}
-@@ -306,6 +315,7 @@ static void send_file_entry(struct file_
+@@ -298,6 +307,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;
-@@ -321,7 +331,7 @@ static void send_file_entry(struct file_
+@@ -313,7 +323,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;
-@@ -331,7 +341,7 @@ static void send_file_entry(struct file_
+@@ -323,7 +333,7 @@ static void send_file_entry(struct file_
f_name(file, fname);
if (file->mode == mode)
flags |= XMIT_SAME_MODE;
-@@ -367,6 +377,12 @@ static void send_file_entry(struct file_
+@@ -359,6 +369,12 @@ static void send_file_entry(struct file_
flags |= XMIT_SAME_TIME;
else
modtime = file->modtime;
#ifdef SUPPORT_HARD_LINKS
if (file->link_u.idev) {
-@@ -420,6 +436,8 @@ static void send_file_entry(struct file_
+@@ -412,6 +428,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);
-@@ -486,6 +504,7 @@ static struct file_struct *receive_file_
+@@ -478,6 +496,7 @@ static struct file_struct *receive_file_
unsigned short flags, int f)
{
static time_t modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
-@@ -504,7 +523,7 @@ static struct file_struct *receive_file_
+@@ -496,7 +515,7 @@ static struct file_struct *receive_file_
struct file_struct *file;
if (!flist) {
dev = 0, rdev = makedev(0, 0);
rdev_major = 0;
uid = 0, gid = 0;
-@@ -560,6 +579,8 @@ static struct file_struct *receive_file_
+@@ -552,6 +571,8 @@ static struct file_struct *receive_file_
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);
-@@ -615,6 +636,8 @@ static struct file_struct *receive_file_
+@@ -607,6 +628,8 @@ static struct file_struct *receive_file_
file->mode = mode;
file->uid = uid;
file->gid = gid;
if (dirname_len) {
file->dirname = lastdir = bp;
-@@ -640,12 +663,12 @@ static struct file_struct *receive_file_
+@@ -632,12 +655,12 @@ static struct file_struct *receive_file_
&& lastname[del_hier_name_len-1] == '.'
&& lastname[del_hier_name_len-2] == '/')
del_hier_name_len -= 2;
else
in_del_hier = 0;
}
-@@ -861,12 +884,14 @@ struct file_struct *make_file(char *fnam
+@@ -851,12 +874,14 @@ struct file_struct *make_file(char *fnam
memset(bp, 0, file_struct_len);
bp += file_struct_len;
#ifdef SUPPORT_HARD_LINKS
if (flist && flist->hlink_pool) {
-@@ -979,7 +1004,7 @@ static void send_if_directory(int f, str
+@@ -969,7 +994,7 @@ static void send_if_directory(int f, str
char is_dot_dir = fbuf[ol-1] == '.' && (ol == 1 || fbuf[ol-2] == '/');
if (S_ISDIR(file->mode)
void *save_filters;
unsigned int len = strlen(fbuf);
if (len > 1 && fbuf[len-1] == '/')
-@@ -1585,8 +1610,9 @@ static void clean_flist(struct file_list
+@@ -1581,8 +1606,9 @@ static void clean_flist(struct file_list
}
/* Make sure we don't lose track of a user-specified
* top directory. */
clear_file(flist->files[drop], flist);
-@@ -1710,7 +1736,7 @@ static void output_flist(struct file_lis
+@@ -1706,7 +1732,7 @@ static void output_flist(struct file_lis
file->dirname ? file->dirname : "",
file->dirname ? "/" : "", NS(file->basename),
S_ISDIR(file->mode) ? "/" : "", (int)file->mode,
continue;
name = fp->basename;
-@@ -656,6 +661,8 @@ static int try_dests_reg(struct file_str
+@@ -663,6 +668,8 @@ static int try_dests_reg(struct file_str
itemizing && verbose > 1,
code) < 0)
goto try_a_copy;
+ set_file_attrs(fname, file, stp, 0);
if (preserve_hard_links && file->link_u.links)
hard_link_cluster(file, ndx, itemizing, code);
- } else if (itemizing)
-@@ -922,7 +929,7 @@ static void recv_generator(char *fname,
+ } else
+@@ -929,7 +936,7 @@ static void recv_generator(char *fname,
&& verbose && code && f_out != -1)
rprintf(code, "%s/\n", fname);
if (delete_during && f_out != -1 && !phase && dry_run < 2
delete_in_dir(the_file_list, fname, file, &st);
return;
}
-@@ -1211,7 +1218,7 @@ static void recv_generator(char *fname,
+@@ -1218,7 +1225,7 @@ static void recv_generator(char *fname,
if (fuzzy_dirlist) {
int j = flist_find(fuzzy_dirlist, file);
if (j >= 0) /* don't use changing file as future fuzzy basis */
+++ new/hlink.c
@@ -28,6 +28,7 @@ extern int link_dest;
extern int make_backups;
- extern int log_format_has_i;
+ extern int stdout_format_has_i;
extern char *basis_dir[];
+extern unsigned int file_struct_len;
extern struct file_list *the_file_list;
extern int protocol_version;
extern int preserve_times;
+extern int preserve_atimes;
- extern int log_format_has_i;
- extern int log_format_has_o_or_i;
- extern int daemon_log_format_has_o_or_i;
-@@ -603,7 +604,8 @@ static void log_formatted(enum logcode c
+ extern int stdout_format_has_i;
+ extern int stdout_format_has_o_or_i;
+ extern int logfile_format_has_o_or_i;
+@@ -594,7 +595,8 @@ static void log_formatted(enum logcode c
n[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
n[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
n[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -301,8 +302,9 @@ void usage(enum logcode F)
+@@ -305,8 +306,9 @@ void usage(enum logcode F)
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," --super receiver attempts super-user activities\n");
rprintf(F," -S, --sparse handle sparse files efficiently\n");
rprintf(F," -n, --dry-run show what would have been transferred\n");
-@@ -413,6 +415,9 @@ static struct poptOption long_options[]
+@@ -419,6 +421,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, 2, 0, 0 },
{"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
{"super", 0, POPT_ARG_VAL, &am_root, 2, 0, 0 },
-@@ -1518,6 +1523,8 @@ void server_options(char **args,int *arg
+@@ -1537,6 +1542,8 @@ void server_options(char **args,int *arg
argstr[x++] = 'D';
if (preserve_times)
argstr[x++] = 't';
--- old/rsync.c
+++ new/rsync.c
@@ -35,6 +35,7 @@ extern int dry_run;
- extern int daemon_log_format_has_i;
+ extern int logfile_format_has_i;
extern int preserve_perms;
extern int preserve_executability;
+extern int preserve_atimes;
#define FULL_FLUSH 1
#define NORMAL_FLUSH 0
-@@ -522,9 +524,12 @@ struct file_struct {
+@@ -523,9 +525,12 @@ struct file_struct {
uid_t uid;
gid_t gid;
mode_t mode;
--super receiver attempts super-user activities
-S, --sparse handle sparse files efficiently
-n, --dry-run show what would have been transferred
-@@ -858,6 +859,12 @@ it is preserving modification times (see
+@@ -861,6 +862,12 @@ it is preserving modification times (see
the directories on the receiving side, it is a good idea to use bf(-O).
This option is inferred if you use bf(--backup) without bf(--backup-dir).
dit(bf(--super)) This tells the receiving side to attempt super-user
activities even if the receiving rsync wasn't run by the super-user. These
activities include: preserving users via the bf(--owner) option, preserving
-@@ -1373,7 +1380,7 @@ with older versions of rsync, but that a
+@@ -1378,7 +1385,7 @@ with older versions of rsync, but that a
verbose messages).
The "%i" escape has a cryptic output that is 9 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.
-@@ -1413,7 +1420,7 @@ quote(itemize(
+@@ -1418,7 +1425,7 @@ quote(itemize(
by the file transfer.
it() A bf(t) means the modification time is different and is being updated
to the sender's value (requires bf(--times)). An alternate value of bf(T)
anytime a symlink is transferred, or when a file or device is transferred
without bf(--times).
it() A bf(p) means the permissions are different and are being updated to
-@@ -1422,7 +1429,10 @@ quote(itemize(
+@@ -1427,7 +1434,10 @@ quote(itemize(
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).
+extern unsigned int file_struct_len;
extern struct stats stats;
extern struct file_list *the_file_list;
- extern char *log_format;
+ extern char *stdout_format;
@@ -129,7 +130,7 @@ void successful_send(int ndx)
file = the_file_list->files[ndx];
return;
if (file->dir.root) {
offset = stringjoin(fname, sizeof fname,
-@@ -373,7 +374,7 @@ void send_files(struct file_list *flist,
+@@ -371,7 +372,7 @@ void send_files(struct file_list *flist,
rprintf(FINFO, "sender finished %s\n", fname);
/* Flag that we actually sent this entry. */
}
--- old/util.c
+++ new/util.c
-@@ -116,7 +116,7 @@ void overflow_exit(char *str)
+@@ -121,7 +121,7 @@ void overflow_exit(char *str)
exit_cleanup(RERR_MALLOC);
}
{
#if !defined HAVE_LUTIMES || !defined HAVE_UTIMES
if (S_ISLNK(mode))
-@@ -124,9 +124,13 @@ int set_modtime(char *fname, time_t modt
+@@ -129,9 +129,13 @@ int set_modtime(char *fname, time_t modt
#endif
if (verbose > 2) {
}
if (dry_run)
-@@ -135,7 +139,7 @@ int set_modtime(char *fname, time_t modt
+@@ -140,7 +144,7 @@ int set_modtime(char *fname, time_t modt
{
#ifdef HAVE_UTIMES
struct timeval t[2];
t[0].tv_usec = 0;
t[1].tv_sec = modtime;
t[1].tv_usec = 0;
-@@ -146,12 +150,12 @@ int set_modtime(char *fname, time_t modt
+@@ -151,12 +155,12 @@ int set_modtime(char *fname, time_t modt
return utimes(fname, t);
#elif defined HAVE_UTIMBUF
struct utimbuf tbuf;
int daemon_bwlimit = 0;
int bwlimit = 0;
int fuzzy_basis = 0;
-@@ -151,6 +152,8 @@ char *log_format = NULL;
- char *logfile_name = NULL;
+@@ -151,6 +152,8 @@ char *logfile_name = NULL;
char *logfile_format = NULL;
+ char *stdout_format = NULL;
char *password_file = NULL;
+char *source_filter = NULL;
+char *dest_filter = NULL;
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");
-@@ -373,6 +377,8 @@ void usage(enum logcode F)
+@@ -374,6 +378,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");
-@@ -453,6 +459,7 @@ static struct poptOption long_options[]
+@@ -454,6 +460,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 },
-@@ -528,6 +535,8 @@ static struct poptOption long_options[]
+@@ -531,6 +538,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 },
-@@ -1406,6 +1415,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;
-@@ -1671,6 +1690,25 @@ void server_options(char **args,int *arg
+@@ -1675,6 +1694,25 @@ void server_options(char **args,int *arg
args[ac++] = "--size-only";
}
goto oom;
--- old/pipe.c
+++ new/pipe.c
-@@ -159,3 +159,77 @@ pid_t local_child(int argc, char **argv,
+@@ -166,3 +166,77 @@ pid_t local_child(int argc, char **argv,
return pid;
}
+}
--- old/receiver.c
+++ new/receiver.c
-@@ -49,6 +49,7 @@ extern int inplace;
+@@ -48,6 +48,7 @@ extern int checksum_seed;
+ extern int inplace;
extern int delay_updates;
extern struct stats stats;
- extern char *log_format;
+extern char *dest_filter;
+ extern char *stdout_format;
extern char *tmpdir;
extern char *partial_dir;
- extern char *basis_dir[];
-@@ -345,6 +346,8 @@ int recv_files(int f_in, struct file_lis
- int itemizing = am_server ? logfile_format_has_i : log_format_has_i;
+@@ -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;
+ pid_t pid = 0;
if (verbose > 2)
rprintf(FINFO,"recv_files(%d) starting\n",flist->count);
-@@ -357,6 +360,23 @@ int recv_files(int f_in, struct file_lis
+@@ -360,6 +363,23 @@ int recv_files(int f_in, struct file_lis
if (delay_updates)
delayed_bits = bitbag_create(flist->count);
while (1) {
cleanup_disable();
-@@ -599,6 +619,9 @@ int recv_files(int f_in, struct file_lis
+@@ -600,6 +620,9 @@ int recv_files(int f_in, struct file_lis
else if (!am_server && verbose && do_progress)
rprintf(FINFO, "%s\n", fname);
--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
-@@ -395,6 +396,8 @@ to the detailed description below for a
+@@ -396,6 +397,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
-@@ -1732,6 +1735,33 @@ file previously generated by bf(--write-
+@@ -1733,6 +1736,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.
version of rsync. For instance, if rsync 2.6.4 is being used with the
--- old/sender.c
+++ new/sender.c
-@@ -44,6 +44,7 @@ extern int write_batch;
+@@ -43,6 +43,7 @@ extern int batch_fd;
+ extern int write_batch;
extern struct stats stats;
extern struct file_list *the_file_list;
- extern char *log_format;
+extern char *source_filter;
+ extern char *stdout_format;
- /**
-@@ -221,6 +222,26 @@ void send_files(struct file_list *flist,
- int itemizing = am_server ? logfile_format_has_i : log_format_has_i;
+@@ -222,6 +223,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;
+ char *filter_argv[MAX_FILTER_ARGS + 1];
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);
-@@ -365,6 +414,8 @@ void send_files(struct file_list *flist,
+@@ -364,6 +413,8 @@ void send_files(struct file_list *flist,
}
}
close(fd);
continue;
}
-@@ -1185,7 +1189,7 @@ static void recv_generator(char *fname,
+@@ -1182,7 +1186,7 @@ static void recv_generator(char *fname,
return;
}
return;
if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
-@@ -1240,7 +1244,7 @@ static void recv_generator(char *fname,
+@@ -1237,7 +1241,7 @@ static void recv_generator(char *fname,
goto notify_others;
}
if (!(backupptr = get_backup_name(fname))) {
close(fd);
return;
-@@ -1331,9 +1335,12 @@ void generate_files(int f_out, struct fi
+@@ -1328,9 +1332,12 @@ void generate_files(int f_out, struct fi
int save_ignore_existing = ignore_existing;
int save_ignore_non_existing = ignore_non_existing;
int save_do_progress = do_progress;
+
if (protocol_version >= 29) {
itemizing = 1;
- maybe_ATTRS_REPORT = log_format_has_i ? 0 : ATTRS_REPORT;
-@@ -1361,7 +1368,7 @@ void generate_files(int f_out, struct fi
+ maybe_ATTRS_REPORT = stdout_format_has_i ? 0 : ATTRS_REPORT;
+@@ -1358,7 +1365,7 @@ void generate_files(int f_out, struct fi
do_delete_pass(flist);
do_progress = 0;
whole_file = 0;
if (verbose >= 2) {
rprintf(FINFO, "delta-transmission %s\n",
-@@ -1370,12 +1377,6 @@ void generate_files(int f_out, struct fi
+@@ -1367,12 +1374,6 @@ void generate_files(int f_out, struct fi
: "enabled");
}
for (i = 0; i < flist->count; i++) {
struct file_struct *file = flist->files[i];
-@@ -1419,23 +1420,34 @@ void generate_files(int f_out, struct fi
+@@ -1416,23 +1417,34 @@ void generate_files(int f_out, struct fi
delete_in_dir(NULL, NULL, NULL, NULL);
phase++;
if (local_name)
strlcpy(fbuf, local_name, sizeof fbuf);
else
-@@ -1447,27 +1459,43 @@ void generate_files(int f_out, struct fi
+@@ -1444,27 +1456,43 @@ void generate_files(int f_out, struct fi
phase++;
ignore_non_existing = save_ignore_non_existing;
ignore_existing = save_ignore_existing;
int keep_partial = 0;
int safe_symlinks = 0;
int copy_unsafe_links = 0;
-@@ -1301,6 +1301,7 @@ int parse_arguments(int *argc, const cha
+@@ -1304,6 +1304,7 @@ int parse_arguments(int *argc, const cha
if (do_progress && !verbose && !log_before_transfer && !am_server)
verbose = 1;
do_xfers = 0;
--- old/pipe.c
+++ new/pipe.c
-@@ -58,7 +58,7 @@ pid_t piped_child(char **command, int *f
+@@ -59,7 +59,7 @@ pid_t piped_child(char **command, int *f
exit_cleanup(RERR_IPC);
}
if (pid == -1) {
rsyserr(FERROR, errno, "fork");
exit_cleanup(RERR_IPC);
-@@ -122,7 +122,7 @@ pid_t local_child(int argc, char **argv,
+@@ -123,7 +123,7 @@ pid_t local_child(int argc, char **argv,
exit_cleanup(RERR_IPC);
}
-extern int do_progress;
+extern int recv_progress;
extern int log_before_transfer;
- extern int log_format_has_i;
+ extern int stdout_format_has_i;
extern int logfile_format_has_i;
@@ -154,7 +154,7 @@ static int receive_data(int f_in, char *
if (sum.remainder)
show_progress(offset, total_size);
if (i > 0) {
-@@ -243,7 +243,7 @@ static int receive_data(int f_in, char *
+@@ -245,7 +245,7 @@ static int receive_data(int f_in, char *
ftruncate(fd, offset);
#endif
end_progress(total_size);
if (fd != -1 && offset > 0 && sparse_end(fd) != 0) {
-@@ -294,12 +294,12 @@ static void handle_delayed_updates(struc
+@@ -296,12 +296,12 @@ static void handle_delayed_updates(struc
"rename failed for %s (from %s)",
full_fname(fname), partialptr);
} else {
handle_partial_dir(partialptr, PDIR_DELETE);
}
}
-@@ -349,11 +349,6 @@ int recv_files(int f_in, struct file_lis
+@@ -352,11 +352,6 @@ int recv_files(int f_in, struct file_lis
if (verbose > 2)
rprintf(FINFO,"recv_files(%d) starting\n",flist->count);
if (delay_updates)
delayed_bits = bitbag_create(flist->count);
-@@ -374,7 +369,7 @@ int recv_files(int f_in, struct file_lis
+@@ -377,7 +372,7 @@ int recv_files(int f_in, struct file_lis
rprintf(FINFO, "recv_files phase=%d\n", phase);
if (phase == 2 && delay_updates)
handle_delayed_updates(flist, local_name);
if (keep_partial && !partial_dir)
make_backups = 0; /* prevents double backup */
if (append_mode) {
-@@ -596,7 +591,7 @@ int recv_files(int f_in, struct file_lis
+@@ -597,7 +592,7 @@ int recv_files(int f_in, struct file_lis
/* log the transfer */
if (log_before_transfer)
- log_item(file, &initial_stats, iflags, NULL);
+ log_item(FNAME, file, &initial_stats, iflags, NULL);
- else if (!am_server && verbose && do_progress)
+ else if (!am_server && verbose && recv_progress)
rprintf(FINFO, "%s\n", fname);
extern int am_starting_up;
extern int allow_8bit_chars;
extern int preserve_uid;
-@@ -303,5 +302,5 @@ const char *who_am_i(void)
+@@ -302,5 +301,5 @@ const char *who_am_i(void)
{
if (am_starting_up)
return am_server ? "server" : "client";