/* === Send functions === */
/* The general strategy with the tag_type <-> character mapping is that
-@@ -631,6 +728,10 @@ static void send_rsync_acl(rsync_acl *ra
+@@ -631,6 +728,11 @@ static void send_rsync_acl(rsync_acl *ra
* This also frees the ACL data. */
void send_acl(statx *sxp, int f)
{
+ old_send_acl(sxp, f);
+ return;
+ }
-
++
if (!sxp->acc_acl) {
sxp->acc_acl = create_racl();
-@@ -649,6 +750,146 @@ void send_acl(statx *sxp, int f)
+ rsync_acl_fake_perms(sxp->acc_acl, sxp->st.st_mode);
+@@ -648,6 +750,146 @@ void send_acl(statx *sxp, int f)
}
}
/* === Receive functions === */
static uchar recv_acl_access(uchar *name_follows_val, int f)
-@@ -768,6 +1009,11 @@ static int recv_rsync_acl(item_list *rac
+@@ -767,6 +1009,11 @@ static int recv_rsync_acl(item_list *rac
/* Receive the ACL info the sender has included for this file-list entry. */
void receive_acl(struct file_struct *file, int f)
{
if (!fnamebak)
return 0;
-@@ -94,7 +118,8 @@ path
- static int make_bak_dir(char *fullpath)
+@@ -95,7 +119,8 @@ static int make_bak_dir(char *fullpath)
{
- STRUCT_STAT st;
+ statx sx;
+ struct file_struct *file;
- char *rel = fullpath + backup_dir_len;
+ int dir_len = deleting ? backup_dir_dels_len : backup_dir_len;
+ char *rel = fullpath + dir_len;
char *end = rel + strlen(rel);
char *p = end;
-@@ -184,7 +209,8 @@ static int keep_backup(const char *fname
+@@ -198,7 +223,8 @@ static int keep_backup(const char *fname
if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
return 1; /* the file could have disappeared */
unmake_file(file);
return 0;
}
-@@ -284,3 +310,13 @@ int make_backup(const char *fname)
+@@ -306,3 +332,13 @@ int make_backup(const char *fname)
return keep_backup(fname);
return make_simple_backup(fname);
}
+}
--- old/generator.c
+++ new/generator.c
-@@ -93,6 +93,9 @@ extern dev_t filesystem_dev;
+@@ -94,6 +94,9 @@ extern mode_t orig_umask;
extern char *backup_dir;
extern char *backup_suffix;
extern int backup_suffix_len;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct filter_list_struct server_filter_list;
-@@ -123,10 +126,14 @@ enum delret {
+@@ -127,10 +130,14 @@ enum delret {
static enum delret delete_dir_contents(char *fname, int flags);
}
/* Delete a file or directory. If DEL_RECURSE is set in the flags, this will
-@@ -162,9 +169,9 @@ static enum delret delete_item(char *fbu
+@@ -166,9 +173,9 @@ static enum delret delete_item(char *fbu
if (S_ISDIR(mode)) {
what = "rmdir";
ok = do_rmdir(fbuf) == 0;
char *sockopts = NULL;
int rsync_port = 0;
int compare_dest = 0;
-@@ -288,6 +294,8 @@ void usage(enum logcode F)
+@@ -293,6 +299,8 @@ void usage(enum logcode F)
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");
rprintf(F," --inplace update destination files in-place (SEE MAN PAGE)\n");
rprintf(F," --append append data onto shorter files\n");
-@@ -516,7 +524,9 @@ static struct poptOption long_options[]
+@@ -527,7 +535,9 @@ static struct poptOption long_options[]
{"bwlimit", 0, POPT_ARG_INT, &bwlimit, 0, 0, 0 },
{"backup", 'b', POPT_ARG_NONE, &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 },
-@@ -1242,6 +1252,8 @@ int parse_arguments(int *argc, const cha
+@@ -1271,6 +1281,8 @@ int parse_arguments(int *argc, const cha
tmpdir = sanitize_path(NULL, tmpdir, NULL, 0, NULL);
if (backup_dir)
backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, NULL);
}
if (server_filter_list.head && !am_sender) {
struct filter_list_struct *elp = &server_filter_list;
-@@ -1259,6 +1271,14 @@ int parse_arguments(int *argc, const cha
+@@ -1288,6 +1300,14 @@ int parse_arguments(int *argc, const cha
if (check_filter(elp, backup_dir, 1) < 0)
goto options_rejected;
}
}
if (!backup_suffix)
-@@ -1270,6 +1290,16 @@ int parse_arguments(int *argc, const cha
+@@ -1299,6 +1319,16 @@ int parse_arguments(int *argc, const cha
backup_suffix);
return 0;
}
if (backup_dir) {
backup_dir_len = strlcpy(backup_dir_buf, backup_dir, sizeof backup_dir_buf);
backup_dir_remainder = sizeof backup_dir_buf - backup_dir_len;
-@@ -1293,6 +1323,31 @@ int parse_arguments(int *argc, const cha
+@@ -1322,6 +1352,31 @@ int parse_arguments(int *argc, const cha
"P *%s", backup_suffix);
- parse_rule(&filter_list, backup_dir_buf, 0, 0);
+ parse_rule(&filter_list, backup_dir_buf, 0, 0);
}
+ /* If backup_dir_dels not supplied default to backup_dir if it has been supplied */
+ if (backup_dir && !backup_dir_dels) {
if (make_backups && !backup_dir)
omit_dir_times = 1;
-@@ -1660,6 +1715,10 @@ void server_options(char **args,int *arg
+@@ -1689,6 +1744,10 @@ void server_options(char **args,int *arg
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) {
-@@ -1668,7 +1727,13 @@ void server_options(char **args,int *arg
+@@ -1697,7 +1756,13 @@ void server_options(char **args,int *arg
goto oom;
args[ac++] = arg;
}
--- old/flist.c
+++ new/flist.c
-@@ -56,6 +56,7 @@ extern int non_perishable_cnt;
+@@ -57,6 +57,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 struct stats stats;
-@@ -86,6 +87,8 @@ static int64 tmp_dev, tmp_ino;
+@@ -87,6 +88,8 @@ static int64 tmp_dev, tmp_ino;
#endif
static char tmp_sum[MD4_SUM_LENGTH];
static char empty_sum[MD4_SUM_LENGTH];
static int flist_count_offset; /* for --delete --progress */
-@@ -268,6 +271,45 @@ static mode_t from_wire_mode(int mode)
+@@ -271,6 +274,45 @@ static mode_t from_wire_mode(int mode)
return mode;
}
static void send_directory(int f, struct file_list *flist, int ndx,
char *fbuf, int len, int flags);
-@@ -1711,6 +1753,25 @@ struct file_list *recv_file_list(int f)
+@@ -1744,6 +1786,25 @@ struct file_list *recv_file_list(int f)
clean_flist(flist, relative_paths, 1);
extern int whole_file;
extern int list_only;
extern int new_root_dir;
-@@ -95,6 +96,7 @@ extern char *backup_suffix;
+@@ -96,6 +97,7 @@ extern char *backup_suffix;
extern int backup_suffix_len;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct filter_list_struct server_filter_list;
int ignore_perishable = 0;
int non_perishable_cnt = 0;
-@@ -102,6 +104,7 @@ int maybe_ATTRS_REPORT = 0;
+@@ -103,6 +105,7 @@ int maybe_ATTRS_REPORT = 0;
static dev_t dev_zero;
static int deletion_count = 0; /* used to implement --max-delete */
static int deldelay_size = 0, deldelay_cnt = 0;
static char *deldelay_buf = NULL;
static int deldelay_fd = -1;
-@@ -110,7 +113,8 @@ static int dir_tweaking;
+@@ -111,7 +114,8 @@ static int dir_tweaking;
static int need_retouch_dir_times;
static const char *solo_file = NULL;
#define DEL_RECURSE (1<<1) /* recurse */
#define DEL_DIR_IS_EMPTY (1<<2) /* internal delete_FUNCTIONS use only */
-@@ -132,11 +136,120 @@ static int is_backup_file(char *fn)
+@@ -133,11 +137,120 @@ static int is_backup_file(char *fn)
return k > 0 && strcmp(fn+k, backup_suffix) == 0;
}
*/
static enum delret delete_item(char *fbuf, int mode, char *replace, int flags)
{
-@@ -158,6 +271,8 @@ static enum delret delete_item(char *fbu
+@@ -159,6 +272,8 @@ static enum delret delete_item(char *fbu
goto check_ret;
/* OK: try to delete the directory. */
}
if (!replace && max_delete >= 0 && ++deletion_count > max_delete)
return DR_AT_LIMIT;
-@@ -204,6 +319,8 @@ static enum delret delete_item(char *fbu
+@@ -205,6 +320,8 @@ static enum delret delete_item(char *fbu
* its contents, otherwise just checks for content. Returns DR_SUCCESS or
* DR_NOT_EMPTY. Note that fname must point to a MAXPATHLEN buffer! (The
* buffer is used for recursion, but returned unchanged.)
*/
static enum delret delete_dir_contents(char *fname, int flags)
{
-@@ -223,7 +340,9 @@ static enum delret delete_dir_contents(c
+@@ -224,7 +341,9 @@ static enum delret delete_dir_contents(c
save_filters = push_local_filters(fname, dlen);
non_perishable_cnt = 0;
ret = non_perishable_cnt ? DR_NOT_EMPTY : DR_SUCCESS;
if (!dirlist->count)
-@@ -260,6 +379,8 @@ static enum delret delete_dir_contents(c
+@@ -261,6 +380,8 @@ 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;
if (delete_item(fname, fp->mode, NULL, flags) != DR_SUCCESS)
ret = DR_NOT_EMPTY;
}
-@@ -412,13 +533,17 @@ static void do_delayed_deletions(char *d
+@@ -413,13 +534,17 @@ static void do_delayed_deletions(char *d
* all the --delete-WHEN options. Note that the fbuf pointer must point to a
* MAXPATHLEN buffer with the name of the directory in it (the functions we
* call will append names onto the end, but the old dir value will be restored
int dlen, i;
if (!flist) {
-@@ -429,21 +554,28 @@ static void delete_in_dir(struct file_li
+@@ -430,21 +555,28 @@ static void delete_in_dir(struct file_li
if (verbose > 2)
rprintf(FINFO, "delete_in_dir(%s)\n", fbuf);
if (one_file_system) {
if (file->flags & FLAG_TOP_DIR)
filesystem_dev = *fs_dev;
-@@ -453,6 +585,11 @@ static void delete_in_dir(struct file_li
+@@ -454,6 +586,11 @@ static void delete_in_dir(struct file_li
dirlist = get_dirlist(fbuf, dlen, 0);
/* If an item in dirlist is not found in flist, delete it
* from the filesystem. */
for (i = dirlist->count; i--; ) {
-@@ -465,16 +602,23 @@ static void delete_in_dir(struct file_li
+@@ -466,16 +603,23 @@ static void delete_in_dir(struct file_li
f_name(fp, NULL));
continue;
}
flist_free(dirlist);
}
-@@ -504,9 +648,9 @@ static void do_delete_pass(struct file_l
+@@ -505,9 +649,9 @@ static void do_delete_pass(struct file_l
|| !S_ISDIR(st.st_mode))
continue;
if (do_progress && !am_server)
rprintf(FINFO, " \r");
-@@ -1023,6 +1167,7 @@ static int try_dests_non(struct file_str
+@@ -1041,6 +1185,7 @@ static int try_dests_non(struct file_str
return j;
}
+static struct bitbag *delayed_bits = NULL;
static int phase = 0;
+ static int dflt_perms;
- /* Acts on cur_flist->file's ndx'th item, whose name is fname. If a dir,
-@@ -1214,8 +1359,12 @@ static void recv_generator(char *fname,
+@@ -1237,8 +1382,12 @@ static void recv_generator(char *fname,
}
}
else if (delete_during && f_out != -1 && !phase && dry_run < 2
- && (file->flags & FLAG_XFER_DIR))
-- delete_in_dir(cur_flist, fname, file, &real_st.st_dev);
+- delete_in_dir(cur_flist, fname, file, &real_sx.st.st_dev);
+ && (file->flags & FLAG_XFER_DIR)) {
+ if (detect_renamed && real_ret != 0)
+ unexplored_dirs++;
-+ delete_in_dir(cur_flist, fname, file, &real_st.st_dev,
++ delete_in_dir(cur_flist, fname, file, &real_sx.st.st_dev,
+ delete_during < 0 ? DEL_NO_DELETIONS : 0);
+ }
- return;
+ goto cleanup;
}
-@@ -1479,8 +1628,14 @@ static void recv_generator(char *fname,
+@@ -1510,8 +1659,14 @@ static void recv_generator(char *fname,
if (preserve_hard_links && F_HLINK_NOT_LAST(file))
- return;
+ goto cleanup;
#endif
- if (stat_errno == ENOENT)
+ if (stat_errno == ENOENT) {
+ }
rsyserr(FERROR, stat_errno, "recv_generator: failed to stat %s",
full_fname(fname));
- return;
-@@ -1775,6 +1930,12 @@ void generate_files(int f_out, const cha
+ goto cleanup;
+@@ -1818,6 +1973,12 @@ void generate_files(int f_out, const cha
if (verbose > 2)
rprintf(FINFO, "generator starting pid=%ld\n", (long)getpid());
if (delete_before && !solo_file && cur_flist->count > 0)
do_delete_pass(cur_flist);
if (delete_during == 2) {
-@@ -1785,7 +1946,7 @@ void generate_files(int f_out, const cha
+@@ -1828,7 +1989,7 @@ void generate_files(int f_out, const cha
}
do_progress = 0;
whole_file = 0;
if (verbose >= 2) {
rprintf(FINFO, "delta-transmission %s\n",
-@@ -1810,7 +1971,7 @@ void generate_files(int f_out, const cha
+@@ -1855,7 +2016,7 @@ void generate_files(int f_out, const cha
dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
} else
dirdev = MAKEDEV(0, 0);
}
}
for (i = cur_flist->low; i <= cur_flist->high; i++) {
-@@ -1863,7 +2024,21 @@ void generate_files(int f_out, const cha
+@@ -1909,7 +2070,21 @@ void generate_files(int f_out, const cha
} while ((cur_flist = cur_flist->next) != NULL);
if (delete_during)
int numeric_ids = 0;
int allow_8bit_chars = 0;
int force_delete = 0;
-@@ -343,6 +344,7 @@ void usage(enum logcode F)
+@@ -351,6 +352,7 @@ void usage(enum logcode F)
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");
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");
-@@ -497,6 +499,7 @@ static struct poptOption long_options[]
+@@ -508,6 +510,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, &fuzzy_basis, 0, 0, 0 },
{"compress", 'z', POPT_ARG_NONE, 0, 'z', 0, 0 },
{"compress-level", 0, POPT_ARG_INT, &def_compress_level, 'z', 0, 0 },
-@@ -1368,7 +1371,7 @@ int parse_arguments(int *argc, const cha
+@@ -1397,7 +1400,7 @@ int parse_arguments(int *argc, const cha
inplace = 1;
}
partial_dir = tmp_partialdir;
if (inplace) {
-@@ -1377,6 +1380,7 @@ int parse_arguments(int *argc, const cha
+@@ -1406,6 +1409,7 @@ int parse_arguments(int *argc, const cha
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;
}
-@@ -1690,6 +1694,8 @@ void server_options(char **args,int *arg
+@@ -1719,6 +1723,8 @@ void server_options(char **args,int *arg
args[ac++] = "--super";
if (size_only)
args[ac++] = "--size-only";
if (modify_window_set) {
--- old/rsync.yo
+++ new/rsync.yo
-@@ -364,6 +364,7 @@ to the detailed description below for a
+@@ -365,6 +365,7 @@ to the detailed description below for a
--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
--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
-@@ -1296,6 +1297,15 @@ Note that the use of the bf(--delete) op
+@@ -1305,6 +1306,15 @@ Note that the use of the bf(--delete) op
fuzzy-match files, so either use bf(--delete-after) or specify some
filename exclusions if you need to prevent this.
files against doing transfers (if the files are missing in the destination
--- old/util.c
+++ new/util.c
-@@ -1027,6 +1027,32 @@ int handle_partial_dir(const char *fname
+@@ -1026,6 +1026,32 @@ int handle_partial_dir(const char *fname
return 1;
}
extern int module_id;
extern int ignore_errors;
extern int numeric_ids;
-@@ -850,6 +851,15 @@ static struct file_struct *recv_file_ent
+@@ -859,6 +860,15 @@ static struct file_struct *recv_file_ent
memcpy(bp, F_SUM(first), checksum_len);
} else
read_buf(f, bp, checksum_len);
-+ if (pre_checksum && sum_len) {
++ if (pre_checksum && bp != tmp_sum) {
+ STRUCT_STAT st;
+ char *fname = f_name(file, NULL);
+ if (stat(fname, &st) == 0 && st.st_size == file_length) {
+ }
}
- if (S_ISREG(mode) || S_ISLNK(mode))
+ #ifdef SUPPORT_ACLS
--- old/generator.c
+++ new/generator.c
@@ -73,6 +73,7 @@ extern int protocol_version;
extern int checksum_len;
extern char *partial_dir;
extern char *basis_dir[];
-@@ -569,7 +570,8 @@ void itemize(struct file_struct *file, i
+@@ -590,7 +591,8 @@ void itemize(const char *fname, struct f
/* Perform our quick-check heuristic for determining if a file is unchanged. */
{
if (st->st_size != F_LENGTH(file))
return 0;
-@@ -578,6 +580,8 @@ int unchanged_file(char *fn, struct file
+@@ -599,6 +601,8 @@ int unchanged_file(char *fn, struct file
of the file time to determine whether to sync */
if (always_checksum > 0 && 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;
}
-@@ -816,7 +820,7 @@ static int try_dests_reg(struct file_str
+@@ -819,7 +823,7 @@ static int try_dests_reg(struct file_str
match_level = 1;
/* FALL THROUGH */
case 1:
-- if (!unchanged_file(cmpbuf, file, stp))
-+ if (!unchanged_file(cmpbuf, 0, file, stp))
+- if (!unchanged_file(cmpbuf, file, &sxp->st))
++ if (!unchanged_file(cmpbuf, 0, file, &sxp->st))
continue;
best_match = j;
match_level = 2;
-@@ -1508,7 +1512,7 @@ static void recv_generator(char *fname,
+@@ -1524,7 +1528,7 @@ static void recv_generator(char *fname,
;
else if (fnamecmp_type == FNAMECMP_FUZZY)
;
-- else if (unchanged_file(fnamecmp, file, &st)) {
-+ else if (unchanged_file(fnamecmp, fnamecmp_type, file, &st)) {
+- else if (unchanged_file(fnamecmp, file, &sx.st)) {
++ else if (unchanged_file(fnamecmp, fnamecmp_type, file, &sx.st)) {
if (partialptr) {
do_unlink(partialptr);
handle_partial_dir(partialptr, PDIR_DELETE);
--- old/hlink.c
+++ new/hlink.c
-@@ -382,7 +382,7 @@ int hard_link_check(struct file_struct *
+@@ -384,7 +384,7 @@ int hard_link_check(struct file_struct *
}
break;
}
-- if (!unchanged_file(cmpbuf, file, &alt_st))
-+ if (!unchanged_file(cmpbuf, 0, file, &alt_st))
+- if (!unchanged_file(cmpbuf, file, &alt_sx.st))
++ if (!unchanged_file(cmpbuf, 0, file, &alt_sx.st))
continue;
statret = 1;
- *stp = alt_st;
+ if (unchanged_attrs(cmpbuf, file, &alt_sx))
--- old/main.c
+++ new/main.c
-@@ -46,6 +46,7 @@ extern int module_id;
+@@ -45,6 +45,7 @@ extern int module_id;
extern int copy_links;
extern int copy_dirlinks;
extern int keep_dirlinks;
extern int preserve_hard_links;
extern int protocol_version;
extern int file_total;
-@@ -73,6 +74,9 @@ extern char *password_file;
+@@ -72,6 +73,9 @@ extern char *password_file;
extern char curr_dir[MAXPATHLEN];
extern struct filter_list_struct server_filter_list;
int local_server = 0;
int new_root_dir = 0;
mode_t orig_umask = 0;
-@@ -793,6 +797,7 @@ static void do_server_recv(int f_in, int
+@@ -792,6 +796,7 @@ static void do_server_recv(int f_in, int
struct file_list *flist;
char *local_name = NULL;
char *dir = NULL;
int save_verbose = verbose;
if (filesfrom_fd >= 0) {
-@@ -839,6 +844,10 @@ static void do_server_recv(int f_in, int
+@@ -838,6 +843,10 @@ static void do_server_recv(int f_in, int
filesfrom_fd = -1;
}
flist = recv_file_list(f_in);
if (!flist) {
rprintf(FERROR,"server_recv: recv_file_list error\n");
-@@ -848,6 +857,9 @@ static void do_server_recv(int f_in, int
+@@ -847,6 +856,9 @@ static void do_server_recv(int f_in, int
recv_additional_file_list(f_in);
verbose = save_verbose;
if (argc > 0)
local_name = get_local_name(flist,argv[0]);
-@@ -927,6 +939,7 @@ int client_run(int f_in, int f_out, pid_
+@@ -926,6 +938,7 @@ int client_run(int f_in, int f_out, pid_
{
struct file_list *flist = NULL;
int exit_code = 0, exit_code2 = 0;
char *local_name = NULL;
cleanup_child_pid = pid;
-@@ -1007,12 +1020,19 @@ int client_run(int f_in, int f_out, pid_
+@@ -1006,12 +1019,19 @@ int client_run(int f_in, int f_out, pid_
filesfrom_fd = -1;
}
--- old/rsync.h
+++ new/rsync.h
-@@ -71,6 +71,7 @@
+@@ -70,6 +70,7 @@
#define FLAG_HLINK_LAST (1<<7) /* receiver/generator */
#define FLAG_HLINK_DONE (1<<8) /* receiver/generator */
#define FLAG_LENGTH64 (1<<9) /* sender/receiver/generator */
--- old/compat.c
+++ new/compat.c
-@@ -56,6 +56,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -62,6 +62,8 @@ void setup_protocol(int f_out,int f_in)
preserve_uid = ++file_extra_cnt;
if (preserve_gid)
preserve_gid = ++file_extra_cnt;
+ if (preserve_fileflags)
+ preserve_fileflags = ++file_extra_cnt;
+ if (preserve_acls && !am_sender)
+ preserve_acls = ++file_extra_cnt;
- if (remote_protocol == 0) {
- if (!read_batch)
--- old/configure.in
+++ new/configure.in
-@@ -554,7 +554,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
+@@ -559,7 +559,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
memmove lchown vsnprintf snprintf vasprintf asprintf setsid glob strpbrk \
strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \
setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
AC_CHECK_FUNCS(getpgrp tcgetpgrp)
--- old/flist.c
+++ new/flist.c
-@@ -46,6 +46,7 @@ extern int preserve_links;
+@@ -47,6 +47,7 @@ extern int preserve_links;
extern int preserve_hard_links;
extern int preserve_devices;
extern int preserve_specials;
extern int preserve_uid;
extern int preserve_gid;
extern int relative_paths;
-@@ -347,6 +348,9 @@ static void send_file_entry(int f, struc
+@@ -350,6 +351,9 @@ static void send_file_entry(int f, struc
{
static time_t modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
static uint32 rdev_major;
-@@ -367,6 +371,12 @@ static void send_file_entry(int f, struc
+@@ -370,6 +374,12 @@ static void send_file_entry(int f, struc
flags |= XMIT_SAME_MODE;
else
mode = file->mode;
if ((preserve_devices && IS_DEVICE(mode))
|| (preserve_specials && IS_SPECIAL(mode))) {
if (protocol_version < 28) {
-@@ -480,6 +490,10 @@ static void send_file_entry(int f, struc
+@@ -483,6 +493,10 @@ static void send_file_entry(int f, struc
write_int(f, modtime);
if (!(flags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
+ write_int(f, (int)fileflags);
+#endif
if (preserve_uid && !(flags & XMIT_SAME_UID)) {
- write_int(f, uid);
+ write_abbrevint30(f, uid);
if (flags & XMIT_USER_NAME_FOLLOWS) {
-@@ -555,6 +569,9 @@ static struct file_struct *recv_file_ent
+@@ -561,6 +575,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;
-@@ -650,9 +667,12 @@ static struct file_struct *recv_file_ent
+@@ -656,9 +673,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));
+#endif
if (preserve_uid && !(flags & XMIT_SAME_UID)) {
- uid = (uid_t)read_int(f);
-@@ -754,6 +774,10 @@ static struct file_struct *recv_file_ent
+ uid = (uid_t)read_abbrevint30(f);
+@@ -766,6 +786,10 @@ static struct file_struct *recv_file_ent
OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32);
}
file->mode = mode;
if (preserve_uid)
F_OWNER(file) = uid;
if (preserve_gid)
-@@ -1051,6 +1075,10 @@ struct file_struct *make_file(const char
+@@ -1071,6 +1095,10 @@ struct file_struct *make_file(const char
OPT_EXTRA(file, 0)->unum = (uint32)(st.st_size >> 32);
}
file->mode = st.st_mode;
if (preserve_gid)
--- old/generator.c
+++ new/generator.c
-@@ -107,6 +107,12 @@ static char *deldelay_buf = NULL;
- static int deldelay_fd = -1;
- static BOOL solo_file = 0;
+@@ -111,6 +111,12 @@ static int dir_tweaking;
+ static int need_retouch_dir_times;
+ static const char *solo_file = NULL;
+#ifdef SUPPORT_FLAGS
+#define FILEFLAGS(ff) ff
/* 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 */
-@@ -122,7 +128,6 @@ enum delret {
+@@ -126,7 +132,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;
-@@ -135,17 +140,20 @@ static int is_backup_file(char *fn)
+@@ -139,17 +144,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. */
-@@ -257,7 +265,7 @@ static enum delret delete_dir_contents(c
+@@ -261,7 +269,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;
}
-@@ -313,8 +321,9 @@ static int remember_delete(struct file_s
+@@ -317,8 +325,9 @@ static int remember_delete(struct file_s
while (1) {
len = snprintf(deldelay_buf + deldelay_cnt,
if ((deldelay_cnt += len) <= deldelay_size)
break;
if (deldelay_fd < 0 && !start_delete_delay_temp())
-@@ -327,7 +336,7 @@ static int remember_delete(struct file_s
+@@ -331,7 +340,7 @@ static int remember_delete(struct file_s
return 1;
}
{
static int read_pos = 0;
int j, len, mode;
-@@ -369,7 +378,7 @@ static int read_delay_line(char *buf)
+@@ -373,7 +382,7 @@ static int read_delay_line(char *buf)
bp = deldelay_buf + read_pos;
invalid_data:
rprintf(FERROR, "ERROR: invalid data in delete-delay file.\n");
return -1;
-@@ -392,15 +401,15 @@ static int read_delay_line(char *buf)
+@@ -396,15 +405,15 @@ static int read_delay_line(char *buf)
static void do_delayed_deletions(char *delbuf)
{
if (deldelay_fd >= 0)
close(deldelay_fd);
}
-@@ -468,7 +477,7 @@ static void delete_in_dir(struct file_li
+@@ -472,7 +481,7 @@ static void delete_in_dir(struct file_li
if (!remember_delete(fp, delbuf))
break;
} else
}
}
-@@ -1174,7 +1183,7 @@ static void recv_generator(char *fname,
+@@ -1178,7 +1187,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)) {
-- if (delete_item(fname, st.st_mode, "directory", del_opts) != 0)
-+ if (delete_item(fname, st.st_mode, FILEFLAGS(st.st_flags), "directory", del_opts) != 0)
+ if (statret == 0 && !S_ISDIR(sx.st.st_mode)) {
+- if (delete_item(fname, sx.st.st_mode, "directory", del_opts) != 0)
++ if (delete_item(fname, sx.st.st_mode, FILEFLAGS(sx.st.st_flags), "directory", del_opts) != 0)
return;
statret = -1;
}
-@@ -1275,7 +1284,7 @@ static void recv_generator(char *fname,
+@@ -1291,7 +1300,7 @@ static void recv_generator(char *fname,
}
/* Not the right symlink (or not a symlink), so
* delete it. */
-- if (delete_item(fname, st.st_mode, "symlink", del_opts) != 0)
-+ if (delete_item(fname, st.st_mode, FILEFLAGS(st.st_flags), "symlink", del_opts) != 0)
- return;
+- if (delete_item(fname, sx.st.st_mode, "symlink", del_opts) != 0)
++ if (delete_item(fname, sx.st.st_mode, FILEFLAGS(sx.st.st_flags), "symlink", del_opts) != 0)
+ goto cleanup;
} else if (basis_dir[0] != NULL) {
- int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
-@@ -1352,7 +1361,7 @@ static void recv_generator(char *fname,
+ int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx,
+@@ -1368,7 +1377,7 @@ static void recv_generator(char *fname,
goto return_with_success;
- return;
+ goto cleanup;
}
-- if (delete_item(fname, st.st_mode, t, del_opts) != 0)
-+ if (delete_item(fname, st.st_mode, FILEFLAGS(st.st_flags), t, del_opts) != 0)
- return;
+- if (delete_item(fname, sx.st.st_mode, t, del_opts) != 0)
++ if (delete_item(fname, sx.st.st_mode, FILEFLAGS(sx.st.st_flags), t, del_opts) != 0)
+ goto cleanup;
} else if (basis_dir[0] != NULL) {
- int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
-@@ -1441,7 +1450,7 @@ static void recv_generator(char *fname,
+ int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx,
+@@ -1457,7 +1466,7 @@ static void recv_generator(char *fname,
fnamecmp_type = FNAMECMP_FNAME;
- if (statret == 0 && !S_ISREG(st.st_mode)) {
-- if (delete_item(fname, st.st_mode, "regular file", del_opts) != 0)
-+ if (delete_item(fname, st.st_mode, FILEFLAGS(st.st_flags), "regular file", del_opts) != 0)
- return;
+ if (statret == 0 && !S_ISREG(sx.st.st_mode)) {
+- if (delete_item(fname, sx.st.st_mode, "regular file", del_opts) != 0)
++ if (delete_item(fname, sx.st.st_mode, FILEFLAGS(sx.st.st_flags), "regular file", del_opts) != 0)
+ goto cleanup;
statret = -1;
stat_errno = ENOENT;
--- old/options.c
+++ new/options.c
-@@ -48,6 +48,7 @@ int copy_links = 0;
- int preserve_links = 0;
+@@ -48,6 +48,7 @@ int preserve_links = 0;
int preserve_hard_links = 0;
+ int preserve_acls = 0;
int preserve_perms = 0;
+int preserve_fileflags = 0;
int preserve_executability = 0;
int preserve_devices = 0;
int preserve_specials = 0;
-@@ -201,6 +202,7 @@ static void print_rsync_version(enum log
- char const *hardlinks = "no ";
+@@ -202,6 +203,7 @@ static void print_rsync_version(enum log
+ char const *acls = "no ";
char const *links = "no ";
char const *ipv6 = "no ";
+ char const *fileflags = "no ";
STRUCT_STAT *dumstat;
#ifdef HAVE_SOCKETPAIR
-@@ -223,6 +225,10 @@ static void print_rsync_version(enum log
+@@ -228,6 +230,10 @@ static void print_rsync_version(enum log
ipv6 = "";
#endif
+
rprintf(f, "%s version %s protocol version %d\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION);
- rprintf(f, "Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.\n");
-@@ -233,8 +239,8 @@ static void print_rsync_version(enum log
+ rprintf(f, "Copyright (C) 1996-2007 by Andrew Tridgell, Wayne Davison, and others.\n");
+@@ -238,8 +244,8 @@ static void print_rsync_version(enum log
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
-- rprintf(f, " %sappend\n",
-- have_inplace);
-+ rprintf(f, " %sappend, %sfile-flags\n",
-+ have_inplace, fileflags);
+- rprintf(f, " %sappend, %sACLs\n",
+- have_inplace, acls);
++ rprintf(f, " %sappend, %sACLs, %sfile-flags\n",
++ have_inplace, acls, fileflags);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -300,6 +306,7 @@ void usage(enum logcode F)
+@@ -305,6 +311,7 @@ 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," --fileflags preserve file-flags\n");
rprintf(F," -E, --executability preserve the file's executability\n");
rprintf(F," --chmod=CHMOD affect file and/or directory permissions\n");
- rprintf(F," -o, --owner preserve owner (super-user only)\n");
-@@ -421,6 +428,8 @@ static struct poptOption long_options[]
+ #ifdef SUPPORT_ACLS
+@@ -429,6 +436,8 @@ static struct poptOption long_options[]
{"perms", 'p', POPT_ARG_VAL, &preserve_perms, 1, 0, 0 },
{"no-perms", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
{"no-p", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
+ {"fileflags", 0, POPT_ARG_VAL, &preserve_fileflags, 1, 0, 0 },
+ {"no-fileflags", 0, POPT_ARG_VAL, &preserve_fileflags, 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 },
-@@ -1132,6 +1141,15 @@ int parse_arguments(int *argc, const cha
+ {"acls", 'A', POPT_ARG_NONE, 0, 'A', 0, 0 },
+ {"no-acls", 0, POPT_ARG_VAL, &preserve_acls, 0, 0, 0 },
+@@ -1161,6 +1170,15 @@ int parse_arguments(int *argc, const cha
}
#endif
if (write_batch && read_batch) {
snprintf(err_buf, sizeof err_buf,
"--write-batch and --read-batch can not be used together\n");
-@@ -1595,6 +1613,9 @@ void server_options(char **args,int *arg
+@@ -1624,6 +1642,9 @@ void server_options(char **args,int *arg
if (xfer_dirs && !recurse && delete_mode && am_sender)
args[ac++] = "--no-r";
goto oom;
--- old/rsync.c
+++ new/rsync.c
-@@ -30,9 +30,12 @@
- #include <langinfo.h>
- #endif
-
-+#define NOCHANGE_FLAGS (UF_IMMUTABLE|UF_APPEND|UF_NOUNLINK|SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK)
-+
- extern int verbose;
+@@ -33,6 +33,7 @@ extern int verbose;
extern int dry_run;
+ extern int preserve_acls;
extern int preserve_perms;
+extern int preserve_fileflags;
extern int preserve_executability;
extern int preserve_times;
extern int omit_dir_times;
-@@ -226,6 +229,41 @@ mode_t dest_mode(mode_t flist_mode, mode
+@@ -53,6 +54,8 @@ extern int make_backups;
+ extern struct file_list *cur_flist, *first_flist, *dir_flist;
+ extern struct chmod_mode_struct *daemon_chmod_modes;
+
++#define NOCHANGE_FLAGS (UF_IMMUTABLE|UF_APPEND|UF_NOUNLINK|SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK)
++
+ #if defined HAVE_ICONV_OPEN && defined HAVE_ICONV_H
+ iconv_t ic_chck = (iconv_t)-1;
+
+@@ -228,6 +231,41 @@ mode_t dest_mode(mode_t flist_mode, mode
return new_mode;
}
+}
+#endif
+
- int set_file_attrs(char *fname, struct file_struct *file, STRUCT_STAT *st,
+ int set_file_attrs(char *fname, struct file_struct *file, statx *sxp,
int flags)
{
-@@ -324,6 +362,15 @@ int set_file_attrs(char *fname, struct f
+@@ -346,6 +384,15 @@ int set_file_attrs(char *fname, struct f
}
#endif
if (verbose > 1 && flags & ATTRS_REPORT) {
if (updated)
rprintf(FCLIENT, "%s\n", fname);
-@@ -371,6 +418,9 @@ void finish_transfer(char *fname, char *
+@@ -398,6 +445,9 @@ void finish_transfer(char *fname, char *
set_file_attrs(fnametmp, file, NULL,
ok_to_set_time ? 0 : ATTRS_SKIP_MTIME);
/* move tmp file over real file */
if (verbose > 2)
rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
-@@ -385,6 +435,9 @@ void finish_transfer(char *fname, char *
+@@ -412,6 +462,9 @@ void finish_transfer(char *fname, char *
}
if (ret == 0) {
/* The file was moved into place (not copied), so it's done. */
/* The file was copied, so tweak the perms of the copied file. If it
--- old/rsync.h
+++ new/rsync.h
-@@ -57,6 +57,7 @@
+@@ -56,6 +56,7 @@
#define XMIT_RDEV_MINOR_IS_SMALL (1<<11)
#define XMIT_USER_NAME_FOLLOWS (1<<12) /* protocols >= 30 */
#define XMIT_GROUP_NAME_FOLLOWS (1<<13) /* protocols >= 30 */
/* These flags are used in the live flist data. */
-@@ -388,6 +389,10 @@ enum msgcode {
+@@ -389,6 +390,10 @@ enum msgcode {
#endif
#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. */
-@@ -565,6 +570,7 @@ struct file_struct {
+@@ -570,6 +575,7 @@ struct file_struct {
extern int file_extra_cnt;
extern int preserve_uid;
extern int preserve_gid;
+extern int preserve_fileflags;
+ extern int preserve_acls;
#define FILE_STRUCT_LEN (offsetof(struct file_struct, basename))
- #define EXTRA_LEN (sizeof (union file_extras))
-@@ -597,6 +603,7 @@ extern int preserve_gid;
+@@ -603,6 +609,7 @@ extern int preserve_acls;
/* When the associated option is on, all entries will have these present: */
#define F_OWNER(f) REQ_EXTRA(f, preserve_uid)->unum
#define F_GROUP(f) REQ_EXTRA(f, preserve_gid)->unum
+#define F_FFLAGS(f) REQ_EXTRA(f, preserve_fileflags).unum
+ #define F_ACL(f) REQ_EXTRA(f, preserve_acls)->unum
/* These items are per-entry optional and mutally exclusive: */
- #define F_HL_GNUM(f) OPT_EXTRA(f, LEN64_BUMP(f))->num
--- old/rsync.yo
+++ new/rsync.yo
@@ -321,6 +321,7 @@ to the detailed description below for a
+ --flags preserve file flags
-E, --executability preserve executability
--chmod=CHMOD affect file and/or directory permissions
- -o, --owner preserve owner (super-user only)
-@@ -510,7 +511,9 @@ specified, in which case bf(-r) is not i
+ -A, --acls preserve ACLs (implies -p)
+@@ -511,7 +512,9 @@ specified, in which case bf(-r) is not i
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-":
-@@ -805,6 +808,13 @@ quote(itemization(
-
- If bf(--perms) is enabled, this option is ignored.
+@@ -831,6 +834,13 @@ dit(bf(-A, --acls)) This option causes r
+ ACLs to be the same as the source ACLs. This nonstandard option only
+ works if the remote rsync also supports it. bf(--acls) implies bf(--perms).
+dit(bf(--flags)) This option causes rsync to update the change file flags
+to be the same as the source file, if your OS supports the bf(chflags)(2)
transfer. The resulting value is treated as though it was the permissions
--- old/syscall.c
+++ new/syscall.c
-@@ -153,6 +153,15 @@ int do_chmod(const char *path, mode_t mo
+@@ -152,6 +152,15 @@ int do_chmod(const char *path, mode_t mo
}
#endif
@@ -35,7 +35,7 @@ OBJS1=flist.o rsync.o generator.o receiv
util.o main.o checksum.o match.o syscall.o log.o backup.o
OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o \
- fileio.o batch.o clientname.o chmod.o
+ fileio.o batch.o clientname.o chmod.o acls.o
-OBJS3=progress.o pipe.o
+OBJS3=progress.o pipe.o hashlink.o
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
popt/popthelp.o popt/poptparse.o
--- old/flist.c
+++ new/flist.c
-@@ -59,6 +59,7 @@ extern int copy_unsafe_links;
+@@ -60,6 +60,7 @@ extern int copy_unsafe_links;
extern int protocol_version;
extern int sanitize_paths;
extern struct stats stats;
extern char curr_dir[MAXPATHLEN];
-@@ -715,7 +716,7 @@ static struct file_struct *recv_file_ent
- }
+@@ -724,7 +725,7 @@ static struct file_struct *recv_file_ent
+ extra_len += (S_ISDIR(mode) ? 2 : 1) * EXTRA_LEN;
#endif
- if (always_checksum && S_ISREG(mode))
char *config_file = NULL;
char *shell_cmd = NULL;
char *logfile_name = NULL;
-@@ -346,6 +347,7 @@ void usage(enum logcode F)
+@@ -354,6 +355,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," -C, --cvs-exclude auto-ignore files the same way CVS does\n");
-@@ -395,7 +397,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -403,7 +405,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
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_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
-@@ -497,6 +499,7 @@ static struct poptOption long_options[]
+@@ -508,6 +510,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, &fuzzy_basis, 0, 0, 0 },
{"compress", 'z', POPT_ARG_NONE, 0, 'z', 0, 0 },
{"compress-level", 0, POPT_ARG_INT, &def_compress_level, 'z', 0, 0 },
-@@ -1093,6 +1096,21 @@ int parse_arguments(int *argc, const cha
- usage(FINFO);
- exit_cleanup(0);
+@@ -1122,6 +1125,21 @@ int parse_arguments(int *argc, const cha
+ #endif
+
+ case OPT_LINK_BY_HASH:
+#ifdef HAVE_LINK
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1755,6 +1773,11 @@ void server_options(char **args,int *arg
+@@ -1784,6 +1802,11 @@ void server_options(char **args,int *arg
}
}
}
static void handle_delayed_updates(char *local_name)
-@@ -622,7 +633,7 @@ int recv_files(int f_in, char *local_nam
+@@ -635,7 +646,7 @@ int recv_files(int f_in, char *local_nam
/* recv file data */
recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
--- old/rsync.c
+++ new/rsync.c
-@@ -51,6 +51,7 @@ extern int flist_eof;
+@@ -50,6 +50,7 @@ extern int inplace;
+ extern int flist_eof;
extern int keep_dirlinks;
extern int make_backups;
- extern mode_t orig_umask;
+extern char *link_by_hash_dir;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct chmod_mode_struct *daemon_chmod_modes;
-@@ -373,8 +374,15 @@ void finish_transfer(char *fname, char *
+@@ -401,8 +402,15 @@ void finish_transfer(char *fname, char *
/* move tmp file over real file */
if (verbose > 2)
rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
ret == -2 ? "copy" : "rename",
--- old/rsync.h
+++ new/rsync.h
-@@ -750,6 +750,14 @@ struct stats {
+@@ -758,6 +758,14 @@ struct stats {
int current_file_index;
};
+
struct chmod_mode_struct;
- #include "byteorder.h"
+ #define EMPTY_ITEM_LIST {NULL, 0, 0}
--- old/rsync.yo
+++ new/rsync.yo
-@@ -367,6 +367,7 @@ to the detailed description below for a
+@@ -368,6 +368,7 @@ to the detailed description below for a
--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
@@ -27,7 +27,7 @@ VERSION=@VERSION@
.SUFFIXES: .c .o
- HEADERS=byteorder.h config.h errcode.h proto.h rsync.h lib/pool_alloc.h
+ HEADERS=byteorder.h config.h errcode.h proto.h rsync.h smb_acls.h lib/pool_alloc.h
-LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o \
+LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
- lib/permstring.o lib/pool_alloc.o @LIBOBJS@
+ lib/permstring.o lib/pool_alloc.o lib/sysacls.o @LIBOBJS@
ZLIBOBJ=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o zlib/crc32.o
--- old/checksum.c
+++ new/checksum.c
-@@ -21,6 +21,7 @@
+@@ -20,6 +20,7 @@
*/
#include "rsync.h"
int csum_length = SHORT_SUM_LENGTH; /* initial value */
-@@ -28,6 +29,7 @@ int csum_length = SHORT_SUM_LENGTH; /* i
+@@ -27,6 +28,7 @@ int csum_length = SHORT_SUM_LENGTH; /* i
extern int checksum_seed;
extern int protocol_version;
/*
a simple 32 bit checksum that can be upadted from either end
-@@ -58,6 +60,7 @@ void get_checksum2(char *buf, int32 len,
+@@ -57,6 +59,7 @@ void get_checksum2(char *buf, int32 len,
static char *buf1;
static int32 len1;
struct mdfour m;
if (len > len1) {
if (buf1)
-@@ -68,7 +71,10 @@ void get_checksum2(char *buf, int32 len,
+@@ -67,7 +70,10 @@ void get_checksum2(char *buf, int32 len,
out_of_memory("get_checksum2");
}
memcpy(buf1,buf,len);
if (checksum_seed) {
-@@ -77,7 +83,10 @@ void get_checksum2(char *buf, int32 len,
+@@ -76,7 +82,10 @@ void get_checksum2(char *buf, int32 len,
}
for(i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
}
/*
* Prior to version 27 an incorrect MD4 checksum was computed
-@@ -86,10 +95,16 @@ void get_checksum2(char *buf, int32 len,
+@@ -85,10 +94,16 @@ void get_checksum2(char *buf, int32 len,
* even when there are no more bytes.
*/
if (len - i > 0 || protocol_version >= 27) {
}
-@@ -99,6 +114,7 @@ void file_checksum(char *fname,char *sum
+@@ -98,6 +113,7 @@ void file_checksum(char *fname,char *sum
OFF_T i, len = size;
struct mdfour m;
int32 remainder;
int fd;
memset(sum,0,MD4_SUM_LENGTH);
-@@ -109,11 +125,19 @@ void file_checksum(char *fname,char *sum
+@@ -108,11 +124,19 @@ void file_checksum(char *fname,char *sum
buf = map_file(fd, size, MAX_MAP_SIZE, CSUM_CHUNK);
}
/* Prior to version 27 an incorrect MD4 checksum was computed
-@@ -121,10 +145,17 @@ void file_checksum(char *fname,char *sum
+@@ -120,10 +144,17 @@ void file_checksum(char *fname,char *sum
* are multiples of 64. This is fixed by calling mdfour_update()
* even when there are no more bytes. */
remainder = (int32)(len - i);
close(fd);
unmap_file(buf);
-@@ -134,11 +165,15 @@ void file_checksum(char *fname,char *sum
+@@ -133,11 +164,15 @@ void file_checksum(char *fname,char *sum
static int32 sumresidue;
static char sumrbuf[CSUM_CHUNK];
static struct mdfour md;
sumresidue = 0;
SIVAL(s, 0, seed);
sum_update(s, 4);
-@@ -163,13 +198,19 @@ void sum_update(const char *p, int32 len
+@@ -162,13 +197,19 @@ void sum_update(const char *p, int32 len
if (sumresidue) {
int32 i = CSUM_CHUNK - sumresidue;
memcpy(sumrbuf + sumresidue, p, i);
len -= CSUM_CHUNK;
p += CSUM_CHUNK;
}
-@@ -181,8 +222,15 @@ void sum_update(const char *p, int32 len
+@@ -180,8 +221,15 @@ void sum_update(const char *p, int32 len
void sum_end(char *sum)
{
int fuzzy_basis = 0;
size_t bwlimit_writemax = 0;
int ignore_existing = 0;
-@@ -378,6 +379,7 @@ void usage(enum logcode F)
+@@ -386,6 +387,7 @@ void usage(enum logcode F)
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");
rprintf(F," -6, --ipv6 prefer IPv6\n");
-@@ -492,6 +494,7 @@ static struct poptOption long_options[]
+@@ -503,6 +505,7 @@ static struct poptOption long_options[]
{"whole-file", 'W', POPT_ARG_VAL, &whole_file, 1, 0, 0 },
{"no-whole-file", 0, POPT_ARG_VAL, &whole_file, 0, 0, 0 },
{"no-W", 0, POPT_ARG_VAL, &whole_file, 0, 0, 0 },
{"checksum", 'c', POPT_ARG_NONE, &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 },
-@@ -1656,6 +1659,9 @@ void server_options(char **args,int *arg
+@@ -1685,6 +1688,9 @@ void server_options(char **args,int *arg
args[ac++] = arg;
}
--- old/generator.c
+++ new/generator.c
-@@ -44,6 +44,7 @@ extern int preserve_uid;
+@@ -45,6 +45,7 @@ extern int preserve_uid;
extern int preserve_gid;
extern int preserve_times;
extern int omit_dir_times;
extern int delete_mode;
extern int delete_before;
extern int delete_during;
-@@ -543,10 +544,11 @@ void itemize(struct file_struct *file, i
+@@ -554,10 +555,11 @@ void itemize(const char *fname, struct f
iflags |= ITEM_REPORT_TIME;
- if (!BITS_EQUAL(st->st_mode, file->mode, CHMOD_BITS))
+ if (!BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
iflags |= ITEM_REPORT_PERMS;
-- if (preserve_uid && am_root && F_UID(file) != st->st_uid)
-+ if (preserve_uid && am_root && F_UID(file) != st->st_uid
-+ && !(omit_dir_changes && S_ISDIR(st->st_mode)))
+- if (preserve_uid && am_root && F_UID(file) != sxp->st.st_uid)
++ if (preserve_uid && am_root && F_UID(file) != sxp->st.st_uid
++ && !(omit_dir_changes && S_ISDIR(sxp->st.st_mode)))
iflags |= ITEM_REPORT_OWNER;
- if (preserve_gid && F_GID(file) != GID_NONE
-- && st->st_gid != F_GID(file))
-+ if (preserve_gid && F_GID(file) != GID_NONE && st->st_gid != F_GID(file)
-+ && !(omit_dir_changes && S_ISDIR(st->st_mode)))
+- && sxp->st.st_gid != F_GID(file))
++ if (preserve_gid && F_GID(file) != GID_NONE && sxp->st.st_gid != F_GID(file)
++ && !(omit_dir_changes && S_ISDIR(sxp->st.st_mode)))
iflags |= ITEM_REPORT_GROUP;
- } else
- iflags |= ITEM_IS_NEW;
-@@ -1165,7 +1167,7 @@ static void recv_generator(char *fname,
+ #ifdef SUPPORT_ACLS
+ if (preserve_acls && !S_ISLNK(file->mode)) {
+@@ -1193,7 +1195,7 @@ static void recv_generator(char *fname,
statret = -1;
new_root_dir = 0;
}
- if (!preserve_perms) { /* See comment in non-dir code below. */
+ if (!preserve_perms || omit_dir_changes) { /* See comment in non-dir code below. */
- file->mode = dest_mode(file->mode, st.st_mode,
- statret == 0);
+ file->mode = dest_mode(file->mode, sx.st.st_mode,
+ dflt_perms, statret == 0);
}
--- old/options.c
+++ new/options.c
-@@ -54,6 +54,7 @@ int preserve_uid = 0;
+@@ -55,6 +55,7 @@ int preserve_uid = 0;
int preserve_gid = 0;
int preserve_times = 0;
int omit_dir_times = 0;
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -308,6 +309,7 @@ void usage(enum logcode F)
+@@ -317,6 +318,7 @@ void usage(enum logcode F)
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve times\n");
rprintf(F," -O, --omit-dir-times omit directories when preserving times\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");
-@@ -425,6 +427,7 @@ static struct poptOption long_options[]
+@@ -437,6 +439,7 @@ static struct poptOption long_options[]
{"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 },
{"no-super", 0, POPT_ARG_VAL, &am_root, 0, 0, 0 },
-@@ -1292,6 +1295,9 @@ int parse_arguments(int *argc, const cha
+@@ -1322,6 +1325,9 @@ int parse_arguments(int *argc, const cha
"P *%s", backup_suffix);
- parse_rule(&filter_list, backup_dir_buf, 0, 0);
+ parse_rule(&filter_list, backup_dir_buf, 0, 0);
}
+
+ if (omit_dir_changes)
if (make_backups && !backup_dir)
omit_dir_times = 1;
-@@ -1525,6 +1531,8 @@ void server_options(char **args,int *arg
+@@ -1551,6 +1557,8 @@ void server_options(char **args,int *arg
argstr[x++] = 'm';
if (omit_dir_times == 2)
argstr[x++] = 'O';
argstr[x++] = 'L';
--- old/rsync.c
+++ new/rsync.c
-@@ -35,6 +35,7 @@ extern int preserve_perms;
+@@ -36,6 +36,7 @@ extern int preserve_perms;
extern int preserve_executability;
extern int preserve_times;
extern int omit_dir_times;
extern int am_root;
extern int am_server;
extern int am_sender;
-@@ -265,9 +266,11 @@ int set_file_attrs(char *fname, struct f
+@@ -275,9 +276,11 @@ int set_file_attrs(char *fname, struct f
updated = 1;
}
-- change_uid = am_root && preserve_uid && st->st_uid != F_UID(file);
-+ change_uid = am_root && preserve_uid && st->st_uid != F_UID(file)
-+ && !(omit_dir_changes && S_ISDIR(st->st_mode));
+- change_uid = am_root && preserve_uid && sxp->st.st_uid != F_UID(file);
++ change_uid = am_root && preserve_uid && sxp->st.st_uid != F_UID(file)
++ && !(omit_dir_changes && S_ISDIR(sxp->st.st_mode));
change_gid = preserve_gid && F_GID(file) != GID_NONE
-- && st->st_gid != F_GID(file);
-+ && st->st_gid != F_GID(file)
-+ && !(omit_dir_changes && S_ISDIR(st->st_mode));
+- && sxp->st.st_gid != F_GID(file);
++ && sxp->st.st_gid != F_GID(file)
++ && !(omit_dir_changes && S_ISDIR(sxp->st.st_mode));
#if !defined HAVE_LCHOWN && !defined CHOWN_MODIFIES_SYMLINK
- if (S_ISLNK(st->st_mode))
+ if (S_ISLNK(sxp->st.st_mode))
;
--- old/cleanup.c
+++ new/cleanup.c
-@@ -26,6 +26,9 @@
+@@ -25,6 +25,9 @@
extern int am_server;
extern int am_daemon;
extern int io_error;
extern int keep_partial;
extern int log_got_error;
extern char *partial_dir;
-@@ -117,6 +120,14 @@ NORETURN void _exit_cleanup(int code, co
+@@ -116,6 +119,14 @@ NORETURN void _exit_cleanup(int code, co
code, file, line);
}
--- old/clientserver.c
+++ new/clientserver.c
-@@ -30,6 +30,9 @@ extern int am_sender;
+@@ -29,6 +29,9 @@ extern int am_sender;
extern int am_server;
extern int am_daemon;
extern int am_root;
extern int rsync_port;
extern int ignore_errors;
extern int kluge_around_eof;
-@@ -107,8 +110,18 @@ int start_socket_client(char *host, char
+@@ -106,8 +109,18 @@ int start_socket_client(char *host, char
set_socket_options(fd, sockopts);
ret = start_inband_exchange(user, path, fd, fd, argc);
}
int start_inband_exchange(const char *user, char *path, int f_in, int f_out,
-@@ -169,6 +182,33 @@ int start_inband_exchange(const char *us
+@@ -168,6 +181,33 @@ int start_inband_exchange(const char *us
if (verbose > 1)
print_child_argv(sargs);
p = strchr(path,'/');
if (p) *p = 0;
io_printf(f_out, "%s\n", path);
-@@ -197,6 +237,10 @@ int start_inband_exchange(const char *us
+@@ -196,6 +236,10 @@ int start_inband_exchange(const char *us
* server to terminate the listing of modules.
* We don't want to go on and transfer
* anything; just exit. */
exit(0);
}
-@@ -204,6 +248,10 @@ int start_inband_exchange(const char *us
+@@ -203,6 +247,10 @@ int start_inband_exchange(const char *us
rprintf(FERROR, "%s\n", line);
/* This is always fatal; the server will now
* close the socket. */
#define MAX_BATCH_NAME_LEN 256 /* Must be less than MAXPATHLEN-13 */
char *batch_name = NULL;
-@@ -201,6 +209,7 @@ static void print_rsync_version(enum log
- char const *hardlinks = "no ";
+@@ -202,6 +210,7 @@ static void print_rsync_version(enum log
+ char const *acls = "no ";
char const *links = "no ";
char const *ipv6 = "no ";
+ char const *ssl = "no ";
STRUCT_STAT *dumstat;
#ifdef HAVE_SOCKETPAIR
-@@ -223,6 +232,10 @@ static void print_rsync_version(enum log
+@@ -228,6 +237,10 @@ static void print_rsync_version(enum log
ipv6 = "";
#endif
+
rprintf(f, "%s version %s protocol version %d\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION);
- rprintf(f, "Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.\n");
-@@ -233,8 +246,8 @@ static void print_rsync_version(enum log
+ rprintf(f, "Copyright (C) 1996-2007 by Andrew Tridgell, Wayne Davison, and others.\n");
+@@ -238,8 +251,8 @@ static void print_rsync_version(enum log
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
-- rprintf(f, " %sappend\n",
-- have_inplace);
-+ rprintf(f, " %sappend, %sSSL\n",
-+ have_inplace, ssl);
+- rprintf(f, " %sappend, %sACLs\n",
+- have_inplace, acls);
++ rprintf(f, " %sappend, %sACLs, %sSSL\n",
++ have_inplace, acls, ssl);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -382,6 +395,13 @@ void usage(enum logcode F)
+@@ -390,6 +403,13 @@ void usage(enum logcode F)
rprintf(F," -4, --ipv4 prefer IPv4\n");
rprintf(F," -6, --ipv6 prefer IPv6\n");
#endif
rprintf(F," --version print version number\n");
rprintf(F,"(-h) --help show this help (-h works with no other options)\n");
-@@ -395,7 +415,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -403,7 +423,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
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_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
-@@ -543,6 +563,13 @@ static struct poptOption long_options[]
+@@ -554,6 +574,13 @@ static struct poptOption long_options[]
{"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 },
/* All the following options switch us into daemon-mode option-parsing. */
{"config", 0, POPT_ARG_STRING, 0, OPT_DAEMON, 0, 0 },
{"daemon", 0, POPT_ARG_NONE, 0, OPT_DAEMON, 0, 0 },
-@@ -570,6 +597,13 @@ static void daemon_usage(enum logcode F)
+@@ -581,6 +608,13 @@ static void daemon_usage(enum logcode F)
rprintf(F," -4, --ipv4 prefer IPv4\n");
rprintf(F," -6, --ipv6 prefer IPv6\n");
#endif
rprintf(F," --help show this help screen\n");
rprintf(F,"\n");
-@@ -596,6 +630,13 @@ static struct poptOption long_daemon_opt
+@@ -607,6 +641,13 @@ static struct poptOption long_daemon_opt
{"protocol", 0, POPT_ARG_INT, &protocol_version, 0, 0, 0 },
{"server", 0, POPT_ARG_NONE, &am_server, 0, 0, 0 },
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
{"verbose", 'v', POPT_ARG_NONE, 0, 'v', 0, 0 },
{"no-verbose", 0, POPT_ARG_VAL, &verbose, 0, 0, 0 },
{"no-v", 0, POPT_ARG_VAL, &verbose, 0, 0, 0 },
-@@ -855,6 +896,12 @@ int parse_arguments(int *argc, const cha
+@@ -866,6 +907,12 @@ int parse_arguments(int *argc, const cha
verbose++;
break;
default:
rprintf(FERROR,
"rsync: %s: %s (in daemon mode)\n",
-@@ -878,6 +925,17 @@ int parse_arguments(int *argc, const cha
+@@ -889,6 +936,17 @@ int parse_arguments(int *argc, const cha
exit_cleanup(RERR_SYNTAX);
}
*argv = poptGetArgs(pc);
*argc = count_args(*argv);
am_starting_up = 0;
-@@ -1093,6 +1151,12 @@ int parse_arguments(int *argc, const cha
- usage(FINFO);
- exit_cleanup(0);
+@@ -1122,6 +1180,12 @@ int parse_arguments(int *argc, const cha
+ #endif
+
+#ifdef HAVE_OPENSSL
+ case OPT_USE_SSL:
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1371,6 +1435,17 @@ int parse_arguments(int *argc, const cha
+@@ -1400,6 +1464,17 @@ int parse_arguments(int *argc, const cha
if (delay_updates && !partial_dir)
partial_dir = tmp_partialdir;
if (inplace) {
#ifdef HAVE_FTRUNCATE
if (partial_dir) {
-@@ -1798,10 +1873,27 @@ char *check_for_hostspec(char *s, char *
+@@ -1827,10 +1902,27 @@ char *check_for_hostspec(char *s, char *
char *p;
int not_host;
int hostlen;
path = p + 1;
--- old/rsync.h
+++ new/rsync.h
-@@ -32,6 +32,7 @@
+@@ -31,6 +31,7 @@
#define DEFAULT_LOCK_FILE "/var/run/rsyncd.lock"
#define URL_PREFIX "rsync://"
#define BACKUP_SUFFIX "~"
-@@ -473,6 +474,11 @@ enum msgcode {
+@@ -474,6 +475,11 @@ enum msgcode {
# define SIZEOF_INT64 SIZEOF_OFF_T
#endif
--- old/configure.in
+++ new/configure.in
-@@ -555,7 +555,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
+@@ -560,7 +560,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \
setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
strerror putenv iconv_open locale_charset nl_langinfo \
int do_compression = 0;
int def_compress_level = Z_DEFAULT_COMPRESSION;
int am_root = 0;
-@@ -201,6 +202,7 @@ static void print_rsync_version(enum log
- char const *hardlinks = "no ";
+@@ -202,6 +203,7 @@ static void print_rsync_version(enum log
+ char const *acls = "no ";
char const *links = "no ";
char const *ipv6 = "no ";
+ char const *preallocation = "no ";
STRUCT_STAT *dumstat;
#ifdef HAVE_SOCKETPAIR
-@@ -223,6 +225,10 @@ static void print_rsync_version(enum log
+@@ -228,6 +230,10 @@ static void print_rsync_version(enum log
ipv6 = "";
#endif
+
rprintf(f, "%s version %s protocol version %d\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION);
- rprintf(f, "Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.\n");
-@@ -233,8 +239,8 @@ static void print_rsync_version(enum log
+ rprintf(f, "Copyright (C) 1996-2007 by Andrew Tridgell, Wayne Davison, and others.\n");
+@@ -238,8 +244,8 @@ static void print_rsync_version(enum log
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
-- rprintf(f, " %sappend\n",
-- have_inplace);
-+ rprintf(f, " %sappend, %spreallocation\n",
-+ have_inplace, preallocation);
+- rprintf(f, " %sappend, %sACLs\n",
+- have_inplace, acls);
++ rprintf(f, " %sappend, %sACLs, %spreallocation\n",
++ have_inplace, acls, preallocation);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -311,6 +317,9 @@ void usage(enum logcode F)
+@@ -319,6 +325,9 @@ void usage(enum logcode F)
rprintf(F," -O, --omit-dir-times omit directories when preserving times\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");
rprintf(F," -W, --whole-file copy files whole (without rsync algorithm)\n");
rprintf(F," -x, --one-file-system don't cross filesystem boundaries\n");
-@@ -468,6 +477,7 @@ static struct poptOption long_options[]
+@@ -479,6 +488,7 @@ static struct poptOption long_options[]
{"max-size", 0, POPT_ARG_STRING, &max_size_arg, OPT_MAX_SIZE, 0, 0 },
{"min-size", 0, POPT_ARG_STRING, &min_size_arg, OPT_MIN_SIZE, 0, 0 },
{"sparse", 'S', POPT_ARG_NONE, &sparse_files, 0, 0, 0 },
{"inplace", 0, POPT_ARG_NONE, &inplace, 0, 0, 0 },
{"append", 0, POPT_ARG_VAL, &append_mode, 1, 0, 0 },
{"del", 0, POPT_ARG_NONE, &delete_during, 0, 0, 0 },
-@@ -1132,6 +1142,15 @@ int parse_arguments(int *argc, const cha
+@@ -1161,6 +1171,15 @@ int parse_arguments(int *argc, const cha
}
#endif
if (write_batch && read_batch) {
snprintf(err_buf, sizeof err_buf,
"--write-batch and --read-batch can not be used together\n");
-@@ -1779,6 +1798,9 @@ void server_options(char **args,int *arg
+@@ -1808,6 +1827,9 @@ void server_options(char **args,int *arg
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
--- old/receiver.c
+++ new/receiver.c
-@@ -44,6 +44,7 @@ extern int cleanup_got_literal;
+@@ -43,6 +43,7 @@ extern int cleanup_got_literal;
extern int remove_source_files;
extern int append_mode;
extern int sparse_files;
extern int keep_partial;
extern int checksum_seed;
extern int inplace;
-@@ -137,6 +138,19 @@ static int receive_data(int f_in, char *
+@@ -136,6 +137,19 @@ static int receive_data(int f_in, char *
int32 i;
char *map = NULL;
read_sum_head(f_in, &sum);
if (fd_r >= 0 && size_r > 0) {
-@@ -244,8 +258,18 @@ static int receive_data(int f_in, char *
+@@ -243,8 +257,18 @@ static int receive_data(int f_in, char *
goto report_write_error;
#ifdef HAVE_FTRUNCATE
if (do_progress)
--- old/rsync.h
+++ new/rsync.h
-@@ -546,6 +546,10 @@ struct idev_node {
- #define IN_LOOPBACKNET 127
+@@ -551,6 +551,10 @@ struct idev_node {
+ #define ACLS_NEED_MASK 1
#endif
+#if defined HAVE_FTRUNCATE && defined HAVE_POSIX_FALLOCATE
union file_extras {
--- old/rsync.yo
+++ new/rsync.yo
-@@ -332,6 +332,7 @@ to the detailed description below for a
+@@ -333,6 +333,7 @@ to the detailed description below for a
-O, --omit-dir-times omit directories when preserving times
--super receiver attempts super-user activities
-S, --sparse handle sparse files efficiently
-n, --dry-run show what would have been transferred
-W, --whole-file copy files whole (without rsync algorithm)
-x, --one-file-system don't cross filesystem boundaries
-@@ -888,6 +889,19 @@ NOTE: Don't use this option when the des
+@@ -914,6 +915,19 @@ NOTE: Don't use this option when the des
filesystem. It doesn't seem to handle seeks over null regions
correctly and ends up corrupting the files.
--- old/t_stub.c
+++ new/t_stub.c
-@@ -23,6 +23,7 @@
+@@ -22,6 +22,7 @@
#include "rsync.h"
int modify_window = 0;
int human_readable = 0;
--- old/util.c
+++ new/util.c
-@@ -25,6 +25,7 @@
+@@ -24,6 +24,7 @@
extern int verbose;
extern int dry_run;
extern int module_id;
extern int modify_window;
extern int relative_paths;
-@@ -270,6 +271,10 @@ int copy_file(const char *source, const
+@@ -269,6 +270,10 @@ int copy_file(const char *source, const
int ofd;
char buf[1024 * 8];
int len; /* Number of bytes read into `buf'. */
ifd = do_open(source, O_RDONLY, 0);
if (ifd == -1) {
-@@ -289,7 +294,27 @@ int copy_file(const char *source, const
+@@ -288,7 +293,27 @@ int copy_file(const char *source, const
return -1;
}
if (full_write(ofd, buf, len) < 0) {
rsyserr(FERROR, errno, "write %s", full_fname(dest));
close(ifd);
-@@ -310,6 +335,16 @@ int copy_file(const char *source, const
+@@ -309,6 +334,16 @@ int copy_file(const char *source, const
full_fname(source));
}
INSTALLMAN=@INSTALL@
@@ -36,7 +38,7 @@ OBJS1=flist.o rsync.o generator.o receiv
OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o \
- fileio.o batch.o clientname.o chmod.o
+ fileio.o batch.o clientname.o chmod.o acls.o
OBJS3=progress.o pipe.o
-DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
+DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o $(SLPOBJ)
int fd;
--- old/configure.in
+++ new/configure.in
-@@ -619,6 +619,29 @@ if test $rsync_cv_can_hardlink_special =
+@@ -624,6 +624,29 @@ if test $rsync_cv_can_hardlink_special =
AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
fi
#include <sys/types.h>
--- old/loadparm.c
+++ new/loadparm.c
-@@ -108,6 +108,9 @@ typedef struct
+@@ -107,6 +107,9 @@ typedef struct
char *socket_options;
int rsync_port;
} global;
static global Globals;
-@@ -291,6 +294,9 @@ static struct parm_struct parm_table[] =
+@@ -290,6 +293,9 @@ static struct parm_struct parm_table[] =
{"motd file", P_STRING, P_GLOBAL,&Globals.motd_file, NULL,0},
{"pid file", P_STRING, P_GLOBAL,&Globals.pid_file, NULL,0},
{"port", P_INTEGER,P_GLOBAL,&Globals.rsync_port, NULL,0},
{"socket options", P_STRING, P_GLOBAL,&Globals.socket_options, NULL,0},
{"auth users", P_STRING, P_LOCAL, &sDefault.auth_users, NULL,0},
-@@ -381,6 +387,9 @@ FN_GLOBAL_STRING(lp_pid_file, &Globals.p
+@@ -380,6 +386,9 @@ FN_GLOBAL_STRING(lp_pid_file, &Globals.p
FN_GLOBAL_STRING(lp_socket_options, &Globals.socket_options)
FN_GLOBAL_INTEGER(lp_rsync_port, &Globals.rsync_port)
int dummy2;
--- old/options.c
+++ new/options.c
-@@ -201,6 +201,7 @@ static void print_rsync_version(enum log
- char const *hardlinks = "no ";
+@@ -202,6 +202,7 @@ static void print_rsync_version(enum log
+ char const *acls = "no ";
char const *links = "no ";
char const *ipv6 = "no ";
+ char const *slp = "no ";
STRUCT_STAT *dumstat;
#ifdef HAVE_SOCKETPAIR
-@@ -223,6 +224,10 @@ static void print_rsync_version(enum log
+@@ -228,6 +229,10 @@ static void print_rsync_version(enum log
ipv6 = "";
#endif
+
rprintf(f, "%s version %s protocol version %d\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION);
- rprintf(f, "Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.\n");
-@@ -233,8 +238,8 @@ static void print_rsync_version(enum log
+ rprintf(f, "Copyright (C) 1996-2007 by Andrew Tridgell, Wayne Davison, and others.\n");
+@@ -238,8 +243,8 @@ static void print_rsync_version(enum log
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
-- rprintf(f, " %sappend\n",
-- have_inplace);
-+ rprintf(f, " %sappend, %sSLP\n",
-+ have_inplace, slp);
+- rprintf(f, " %sappend, %sACLs\n",
+- have_inplace, acls);
++ rprintf(f, " %sappend, %sACLs, %sSLP\n",
++ have_inplace, acls, slp);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
--- old/rsync.h
+++ new/rsync.h
-@@ -173,6 +173,9 @@
+@@ -174,6 +174,9 @@
#define SIGNIFICANT_ITEM_FLAGS (~(\
ITEM_BASIS_TYPE_FOLLOWS | ITEM_XNAME_FOLLOWS | ITEM_LOCAL_CHANGE))
path = /var/ftp/pub
--- old/socket.c
+++ new/socket.c
-@@ -466,6 +466,16 @@ void start_accept_loop(int port, int (*f
+@@ -465,6 +465,16 @@ void start_accept_loop(int port, int (*f
{
fd_set deffds;
int *sp, maxfd, i;
#ifdef HAVE_SIGACTION
sigact.sa_flags = SA_NOCLDSTOP;
-@@ -494,14 +504,25 @@ void start_accept_loop(int port, int (*f
+@@ -493,14 +503,25 @@ void start_accept_loop(int port, int (*f
maxfd = sp[i];
}
/* close log file before the potentially very long select so
* file can be trimmed by another process instead of growing
-@@ -513,8 +534,18 @@ void start_accept_loop(int port, int (*f
+@@ -512,8 +533,18 @@ void start_accept_loop(int port, int (*f
#else
fds = deffds;
#endif