--- old/clientserver.c
+++ new/clientserver.c
-@@ -37,6 +37,7 @@ extern int sanitize_paths;
+@@ -36,6 +36,7 @@ extern int sanitize_paths;
extern int filesfrom_fd;
extern int remote_protocol;
extern int protocol_version;
extern int io_timeout;
extern int no_detach;
extern int default_af_hint;
-@@ -634,6 +635,8 @@ static int rsync_module(int f_in, int f_
+@@ -640,6 +641,8 @@ static int rsync_module(int f_in, int f_
else if (am_root < 0) /* Treat --fake-super from client as --super. */
am_root = 2;
--- old/flist.c
+++ new/flist.c
-@@ -25,6 +25,7 @@
+@@ -24,6 +24,7 @@
#include "io.h"
extern int verbose;
extern int list_only;
extern int am_root;
extern int am_server;
-@@ -57,6 +58,7 @@ extern int implied_dirs;
+@@ -56,6 +57,7 @@ extern int implied_dirs;
extern int file_extra_cnt;
extern int ignore_perishable;
extern int non_perishable_cnt;
extern int prune_empty_dirs;
extern int copy_links;
extern int copy_unsafe_links;
-@@ -79,6 +81,9 @@ extern iconv_t ic_send, ic_recv;
+@@ -78,6 +80,9 @@ extern iconv_t ic_send, ic_recv;
#define PTR_SIZE (sizeof (struct file_struct *))
int io_error;
int checksum_len;
dev_t filesystem_dev; /* used to implement -x */
-@@ -101,6 +106,10 @@ static char tmp_sum[MAX_DIGEST_LEN];
+@@ -100,6 +105,10 @@ static char tmp_sum[MAX_DIGEST_LEN];
static char empty_sum[MAX_DIGEST_LEN];
static int flist_count_offset; /* for --delete --progress */
static int dir_count = 0;
static void clean_flist(struct file_list *flist, int strip_root);
static void output_flist(struct file_list *flist);
-@@ -317,6 +326,304 @@ static void flist_done_allocating(struct
+@@ -316,6 +325,304 @@ static void flist_done_allocating(struct
flist->pool_boundary = ptr;
}
int push_pathname(const char *dir, int len)
{
if (dir == pathname)
-@@ -973,34 +1280,24 @@ static struct file_struct *recv_file_ent
+@@ -972,34 +1279,24 @@ static struct file_struct *recv_file_ent
return file;
}
+ STRUCT_STAT st;
char *bp;
- if (strlcpy(thisname, fname, sizeof thisname)
-@@ -1077,6 +1374,8 @@ struct file_struct *make_file(const char
+ if (strlcpy(thisname, fname, sizeof thisname) >= sizeof thisname) {
+@@ -1075,6 +1372,8 @@ struct file_struct *make_file(const char
if (is_excluded(thisname, S_ISDIR(st.st_mode) != 0, filter_level)) {
if (ignore_perishable)
non_perishable_cnt++;
return NULL;
}
-@@ -1115,9 +1414,16 @@ struct file_struct *make_file(const char
+@@ -1113,9 +1412,16 @@ struct file_struct *make_file(const char
memcpy(lastdir, thisname, len);
lastdir[len] = '\0';
lastdir_len = len;
basename_len = strlen(basename) + 1; /* count the '\0' */
#ifdef SUPPORT_LINKS
-@@ -1193,11 +1499,44 @@ struct file_struct *make_file(const char
+@@ -1191,11 +1497,44 @@ struct file_struct *make_file(const char
}
#endif
/* This code is only used by the receiver when it is building
* a list of files for a delete pass. */
if (keep_dirlinks && linkname_len && flist) {
-@@ -1241,14 +1580,14 @@ void unmake_file(struct file_struct *fil
-
- static struct file_struct *send_file_name(int f, struct file_list *flist,
- char *fname, STRUCT_STAT *stp,
-- int flags, int filter_flags)
-+ int flags, int filter_level)
- {
- struct file_struct *file;
- #if defined SUPPORT_ACLS || defined SUPPORT_XATTRS
- statx sx;
- #endif
-
-- file = make_file(fname, flist, stp, flags, filter_flags);
-+ file = make_file(fname, flist, stp, flags, filter_level);
- if (!file)
- return NULL;
-
-@@ -1442,7 +1781,7 @@ static void send_directory(int f, struct
- DIR *d;
- int divert_dirs = (flags & FLAG_DIVERT_DIRS) != 0;
- int start = flist->count;
-- int filter_flags = f == -2 ? SERVER_FILTERS : ALL_FILTERS;
-+ int filter_level = f == -2 ? SERVER_FILTERS : ALL_FILTERS;
-
- assert(flist != NULL);
-
-@@ -1471,7 +1810,7 @@ static void send_directory(int f, struct
- continue;
- }
-
-- send_file_name(f, flist, fbuf, NULL, flags, filter_flags);
-+ send_file_name(f, flist, fbuf, NULL, flags, filter_level);
- }
-
- fbuf[len] = '\0';
-@@ -1483,6 +1822,9 @@ static void send_directory(int f, struct
+@@ -1481,6 +1820,9 @@ static void send_directory(int f, struct
closedir(d);
+ write_checksums(NULL, 1);
+
if (f >= 0 && recurse && !divert_dirs) {
- int i, end = flist->count - 1;
- /* send_if_directory() bumps flist->count, so use "end". */
-@@ -1916,7 +2258,11 @@ struct file_list *send_file_list(int f,
+ int i, end = flist->used - 1;
+ /* send_if_directory() bumps flist->used, so use "end". */
+@@ -1924,7 +2266,11 @@ struct file_list *send_file_list(int f,
* file-list to check if this is a 1-file xfer. */
send_extra_file_list(f, 1);
}
return flist;
}
-@@ -2206,7 +2552,7 @@ void flist_free(struct file_list *flist)
+@@ -2217,7 +2563,7 @@ void flist_free(struct file_list *flist)
if (!flist->prev || !flist_cnt)
pool_destroy(flist->file_pool);
pool_free_old(flist->file_pool, flist->pool_boundary);
if (flist->sorted && flist->sorted != flist->files)
-@@ -2225,6 +2571,7 @@ static void clean_flist(struct file_list
- if (!flist)
- return;
- if (flist->count == 0) {
-+ flist->low = 0;
- flist->high = -1;
- return;
- }
--- old/loadparm.c
+++ new/loadparm.c
-@@ -149,6 +149,7 @@ typedef struct
+@@ -148,6 +148,7 @@ typedef struct
int syslog_facility;
int timeout;
BOOL fake_super;
BOOL ignore_errors;
BOOL ignore_nonreadable;
-@@ -197,6 +198,7 @@ static service sDefault =
+@@ -196,6 +197,7 @@ static service sDefault =
/* syslog_facility; */ LOG_DAEMON,
/* timeout; */ 0,
/* fake_super; */ False,
/* ignore_errors; */ False,
/* ignore_nonreadable; */ False,
-@@ -313,6 +315,7 @@ static struct parm_struct parm_table[] =
+@@ -312,6 +314,7 @@ static struct parm_struct parm_table[] =
{"lock file", P_STRING, P_LOCAL, &sDefault.lock_file, NULL,0},
{"log file", P_STRING, P_LOCAL, &sDefault.log_file, NULL,0},
{"log format", P_STRING, P_LOCAL, &sDefault.log_format, NULL,0},
{"max connections", P_INTEGER,P_LOCAL, &sDefault.max_connections, NULL,0},
{"max verbosity", P_INTEGER,P_LOCAL, &sDefault.max_verbosity, NULL,0},
{"name", P_STRING, P_LOCAL, &sDefault.name, NULL,0},
-@@ -418,6 +421,7 @@ FN_LOCAL_BOOL(lp_fake_super, fake_super)
+@@ -417,6 +420,7 @@ FN_LOCAL_BOOL(lp_fake_super, fake_super)
FN_LOCAL_BOOL(lp_ignore_errors, ignore_errors)
FN_LOCAL_BOOL(lp_ignore_nonreadable, ignore_nonreadable)
FN_LOCAL_BOOL(lp_list, list)
FN_LOCAL_BOOL(lp_transfer_logging, transfer_logging)
--- old/options.c
+++ new/options.c
-@@ -109,6 +109,7 @@ size_t bwlimit_writemax = 0;
+@@ -108,6 +108,7 @@ size_t bwlimit_writemax = 0;
int ignore_existing = 0;
int ignore_non_existing = 0;
int need_messages_from_generator = 0;
int max_delete = -1;
OFF_T max_size = 0;
OFF_T min_size = 0;
-@@ -302,6 +303,7 @@ void usage(enum logcode F)
+@@ -301,6 +302,7 @@ void usage(enum logcode F)
rprintf(F," -q, --quiet suppress non-error messages\n");
rprintf(F," --no-motd suppress daemon-mode MOTD (see manpage caveat)\n");
rprintf(F," -c, --checksum skip based on checksum, not mod-time & size\n");
rprintf(F," -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)\n");
rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n");
rprintf(F," -r, --recursive recurse into directories\n");
-@@ -542,6 +544,7 @@ static struct poptOption long_options[]
+@@ -541,6 +543,7 @@ static struct poptOption long_options[]
{"checksum", 'c', POPT_ARG_VAL, &always_checksum, 1, 0, 0 },
{"no-checksum", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
{"no-c", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
{"block-size", 'B', POPT_ARG_LONG, &block_size, 0, 0, 0 },
{"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
{"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
-@@ -1896,7 +1899,9 @@ void server_options(char **args,int *arg
+@@ -1898,7 +1901,9 @@ void server_options(char **args,int *arg
args[ac++] = basis_dir[i];
}
}
args[ac++] = "--append";
--- old/rsync.h
+++ new/rsync.h
-@@ -589,6 +589,7 @@ extern int preserve_xattrs;
+@@ -588,6 +588,7 @@ extern int xattrs_ndx;
#define EXTRA_LEN (sizeof (union file_extras))
#define PTR_EXTRA_LEN ((sizeof (char *) + EXTRA_LEN - 1) / EXTRA_LEN)
#define SUM_EXTRA_CNT ((MAX_DIGEST_LEN + EXTRA_LEN - 1) / EXTRA_LEN)
--- old/compat.c
+++ new/compat.c
-@@ -49,6 +49,7 @@ extern int preserve_hard_links;
+@@ -48,6 +48,7 @@ extern int preserve_hard_links;
extern int need_messages_from_generator;
extern int delete_mode, delete_before, delete_during, delete_after;
extern int delete_excluded;
extern int make_backups;
extern char *shell_cmd; /* contains VER.SUB string if client is a pre-release */
extern char *backup_dir, *backup_suffix;
-@@ -206,7 +207,7 @@ void setup_protocol(int f_out,int f_in)
+@@ -208,7 +209,7 @@ void setup_protocol(int f_out,int f_in)
} else if (protocol_version >= 30) {
if (recurse && allow_inc_recurse && !preserve_hard_links
&& !delete_before && !delete_after && !delay_updates
}
--- old/flist.c
+++ new/flist.c
-@@ -60,6 +60,7 @@ extern int non_perishable_cnt;
+@@ -59,6 +59,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;
-@@ -98,6 +99,8 @@ static int64 tmp_dev, tmp_ino;
+@@ -97,6 +98,8 @@ static int64 tmp_dev, tmp_ino;
#endif
static char tmp_sum[MAX_DIGEST_LEN];
static char empty_sum[MAX_DIGEST_LEN];
static int flist_count_offset; /* for --delete --progress */
static int dir_count = 0;
-@@ -265,6 +268,45 @@ static int is_excluded(char *fname, int
+@@ -264,6 +267,45 @@ static int is_excluded(char *fname, int
return 0;
}
static void send_directory(int f, struct file_list *flist,
char *fbuf, int len, int flags);
-@@ -1915,6 +1957,25 @@ struct file_list *send_file_list(int f,
+@@ -1911,6 +1953,25 @@ struct file_list *send_file_list(int f,
if (verbose > 2)
rprintf(FINFO, "send_file_list done\n");
+
if (inc_recurse) {
add_dirs_to_tree(-1, flist, dir_count);
- if (send_dir_ndx < 0) {
+ flist_done_allocating(flist);
--- old/generator.c
+++ new/generator.c
-@@ -80,6 +80,7 @@ extern char *basis_dir[];
+@@ -79,6 +79,7 @@ extern char *basis_dir[];
extern int compare_dest;
extern int copy_dest;
extern int link_dest;
extern int whole_file;
extern int list_only;
extern int new_root_dir;
-@@ -97,6 +98,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;
#ifdef ICONV_OPTION
extern int ic_ndx;
#endif
-@@ -107,6 +109,7 @@ int maybe_ATTRS_REPORT = 0;
+@@ -106,6 +108,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;
-@@ -115,7 +118,8 @@ static int dir_tweaking;
- static int need_retouch_dir_times;
+@@ -115,7 +118,8 @@ static int need_retouch_dir_times;
+ static int need_retouch_dir_perms;
static const char *solo_file = NULL;
-/* For calling delete_item() and delete_dir_contents(). */
+ file_extra_cnt -= SUM_EXTRA_CNT;
ret = non_perishable_cnt ? DR_NOT_EMPTY : DR_SUCCESS;
- if (!dirlist->count)
+ if (!dirlist->used)
@@ -265,6 +384,8 @@ static enum delret delete_dir_contents(c
if (S_ISDIR(fp->mode)
&& delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS)
+
/* If an item in dirlist is not found in flist, delete it
* from the filesystem. */
- for (i = dirlist->count; i--; ) {
+ for (i = dirlist->used; i--; ) {
@@ -469,16 +607,23 @@ static void delete_in_dir(char *fbuf, st
f_name(fp, NULL));
continue;
static int phase = 0;
static int dflt_perms;
-@@ -1272,8 +1418,12 @@ static void recv_generator(char *fname,
+@@ -1288,8 +1434,12 @@ static void recv_generator(char *fname,
}
}
else if (delete_during && f_out != -1 && !phase && dry_run < 2
goto cleanup;
}
-@@ -1545,8 +1695,14 @@ static void recv_generator(char *fname,
+@@ -1561,8 +1711,14 @@ static void recv_generator(char *fname,
if (preserve_hard_links && F_HLINK_NOT_LAST(file))
goto cleanup;
#endif
rsyserr(FERROR, stat_errno, "recv_generator: failed to stat %s",
full_fname(fname));
goto cleanup;
-@@ -1867,6 +2023,12 @@ void generate_files(int f_out, const cha
+@@ -1882,6 +2038,12 @@ void generate_files(int f_out, const cha
if (verbose > 2)
rprintf(FINFO, "generator starting pid=%ld\n", (long)getpid());
+ delete_during = -1;
+ }
+
- if (delete_before && !solo_file && cur_flist->count > 0)
+ if (delete_before && !solo_file && cur_flist->used > 0)
do_delete_pass();
if (delete_during == 2) {
-@@ -1877,7 +2039,7 @@ void generate_files(int f_out, const cha
+@@ -1892,7 +2054,7 @@ void generate_files(int f_out, const cha
}
do_progress = 0;
whole_file = 0;
if (verbose >= 2) {
rprintf(FINFO, "delta-transmission %s\n",
-@@ -1904,7 +2066,7 @@ void generate_files(int f_out, const cha
- dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
- } else
- dirdev = MAKEDEV(0, 0);
-- delete_in_dir(f_name(fp, fbuf), fp, &dirdev);
-+ delete_in_dir(f_name(fp, fbuf), fp, &dirdev, 0);
+@@ -1923,7 +2085,7 @@ void generate_files(int f_out, const cha
+ dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
+ } else
+ dirdev = MAKEDEV(0, 0);
+- delete_in_dir(f_name(fp, fbuf), fp, &dirdev);
++ delete_in_dir(f_name(fp, fbuf), fp, &dirdev, 0);
+ }
}
}
- for (i = cur_flist->low; i <= cur_flist->high; i++) {
-@@ -1966,7 +2128,21 @@ void generate_files(int f_out, const cha
+@@ -1976,7 +2138,21 @@ void generate_files(int f_out, const cha
} while ((cur_flist = cur_flist->next) != NULL);
if (delete_during)
rprintf(FINFO, "generate_files phase=%d\n", phase);
--- old/options.c
+++ new/options.c
-@@ -79,6 +79,7 @@ int am_generator = 0;
+@@ -78,6 +78,7 @@ int am_generator = 0;
int am_starting_up = 1;
int relative_paths = -1;
int implied_dirs = 1;
int numeric_ids = 0;
int allow_8bit_chars = 0;
int force_delete = 0;
-@@ -374,6 +375,7 @@ void usage(enum logcode F)
+@@ -373,6 +374,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");
-@@ -546,6 +548,7 @@ static struct poptOption long_options[]
+@@ -545,6 +547,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 },
{"no-compress", 0, POPT_ARG_VAL, &do_compression, 0, 0, 0 },
-@@ -1488,7 +1491,7 @@ int parse_arguments(int *argc, const cha
+@@ -1487,7 +1490,7 @@ int parse_arguments(int *argc, const cha
inplace = 1;
}
partial_dir = tmp_partialdir;
if (inplace) {
-@@ -1497,6 +1500,7 @@ int parse_arguments(int *argc, const cha
+@@ -1496,6 +1499,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;
}
-@@ -1836,6 +1840,8 @@ void server_options(char **args,int *arg
+@@ -1838,6 +1842,8 @@ void server_options(char **args,int *arg
args[ac++] = "--super";
if (size_only)
args[ac++] = "--size-only";
files against doing transfers (if the files are missing in the destination
--- old/util.c
+++ new/util.c
-@@ -1026,6 +1026,32 @@ int handle_partial_dir(const char *fname
+@@ -1028,6 +1028,32 @@ int handle_partial_dir(const char *fname
return 1;
}
--- old/flist.c
+++ new/flist.c
-@@ -34,6 +34,7 @@ extern int am_generator;
+@@ -33,6 +33,7 @@ extern int am_generator;
extern int inc_recurse;
extern int do_progress;
extern int always_checksum;
extern int module_id;
extern int ignore_errors;
extern int numeric_ids;
-@@ -948,6 +949,15 @@ static struct file_struct *recv_file_ent
+@@ -955,6 +956,15 @@ static struct file_struct *recv_file_ent
memcpy(bp, F_SUM(first), checksum_len);
} else
read_buf(f, bp, checksum_len);
#ifdef SUPPORT_ACLS
--- old/generator.c
+++ new/generator.c
-@@ -74,6 +74,7 @@ extern int protocol_version;
+@@ -73,6 +73,7 @@ extern int protocol_version;
extern int file_total;
extern int fuzzy_basis;
extern int always_checksum;
continue;
best_match = j;
match_level = 2;
-@@ -1559,7 +1563,7 @@ static void recv_generator(char *fname,
+@@ -1575,7 +1579,7 @@ static void recv_generator(char *fname,
;
else if (fnamecmp_type == FNAMECMP_FUZZY)
;
handle_partial_dir(partialptr, PDIR_DELETE);
--- old/hlink.c
+++ new/hlink.c
-@@ -393,7 +393,7 @@ int hard_link_check(struct file_struct *
+@@ -392,7 +392,7 @@ int hard_link_check(struct file_struct *
}
break;
}
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;
}
+ if (pre_checksum)
+ pop_dir(olddir);
+
- if (flist && flist->count > 0) {
+ if (flist && flist->used > 0) {
local_name = get_local_name(flist, argv[0]);
--- old/rsync.h
+++ new/rsync.h
-@@ -72,6 +72,7 @@
+@@ -71,6 +71,7 @@
#define FLAG_HLINK_DONE (1<<8) /* receiver/generator */
#define FLAG_LENGTH64 (1<<9) /* sender/receiver/generator */
#define FLAG_SKIP_GROUP (1<<10) /* receiver/generator */
--- old/flist.c
+++ new/flist.c
-@@ -62,6 +62,7 @@ extern int copy_links;
+@@ -61,6 +61,7 @@ extern int copy_links;
extern int copy_unsafe_links;
extern int protocol_version;
extern int sanitize_paths;
extern struct stats stats;
extern char curr_dir[MAXPATHLEN];
-@@ -1463,6 +1464,9 @@ static void send_directory(int f, struct
+@@ -1470,6 +1471,9 @@ static void send_directory(int f, struct
}
- send_file_name(f, flist, fbuf, NULL, flags, filter_flags);
+ send_file_name(f, flist, fbuf, NULL, flags, filter_level);
+ /* Sleep for a bit, to avoid hammering the disk. */
+ if (sleep_asec)
+ usleep(sleep_asec);
fbuf[len] = '\0';
--- old/options.c
+++ new/options.c
-@@ -105,6 +105,7 @@ int size_only = 0;
+@@ -104,6 +104,7 @@ int size_only = 0;
int daemon_bwlimit = 0;
int bwlimit = 0;
int fuzzy_basis = 0;
size_t bwlimit_writemax = 0;
int ignore_existing = 0;
int ignore_non_existing = 0;
-@@ -405,6 +406,7 @@ void usage(enum logcode F)
+@@ -404,6 +405,7 @@ void usage(enum logcode F)
rprintf(F," --password-file=FILE read daemon-access password from FILE\n");
rprintf(F," --list-only list the files instead of copying them\n");
rprintf(F," --bwlimit=KBPS limit I/O bandwidth; KBytes per second\n");
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");
-@@ -567,6 +569,7 @@ static struct poptOption long_options[]
+@@ -566,6 +568,7 @@ static struct poptOption long_options[]
{"itemize-changes", 'i', POPT_ARG_NONE, 0, 'i', 0, 0 },
{"no-itemize-changes",0, POPT_ARG_VAL, &itemize_changes, 0, 0, 0 },
{"no-i", 0, POPT_ARG_VAL, &itemize_changes, 0, 0, 0 },
--- old/generator.c
+++ new/generator.c
-@@ -62,6 +62,7 @@ extern int append_mode;
+@@ -61,6 +61,7 @@ extern int append_mode;
extern int make_backups;
extern int csum_length;
extern int ignore_times;
extern int size_only;
extern OFF_T max_size;
extern OFF_T min_size;
-@@ -618,7 +619,7 @@ void itemize(const char *fnamecmp, struc
+@@ -620,7 +621,7 @@ void itemize(const char *fnamecmp, struc
/* Perform our quick-check heuristic for determining if a file is unchanged. */
int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
{
char *rsync_path = RSYNC_PATH;
char *backup_dir = NULL;
char backup_dir_buf[MAXPATHLEN];
-@@ -356,6 +359,7 @@ void usage(enum logcode F)
+@@ -370,6 +373,7 @@ void usage(enum logcode F)
rprintf(F," --timeout=TIME set I/O timeout in seconds\n");
rprintf(F," -I, --ignore-times don't skip files that match in size and mod-time\n");
rprintf(F," --size-only skip files that match in size\n");
rprintf(F," --modify-window=NUM compare mod-times with reduced accuracy\n");
rprintf(F," -T, --temp-dir=DIR create temporary files in directory DIR\n");
rprintf(F," -y, --fuzzy find similar file for basis if no dest file\n");
-@@ -393,6 +397,8 @@ void usage(enum logcode F)
+@@ -407,6 +411,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," --source-filter=COMMAND filter file through COMMAND at source\n");
+ rprintf(F," --dest-filter=COMMAND filter file through COMMAND at destination\n");
rprintf(F," --protocol=NUM force an older protocol version to be used\n");
- #ifdef INET6
- rprintf(F," -4, --ipv4 prefer IPv4\n");
-@@ -486,6 +492,7 @@ static struct poptOption long_options[]
+ #ifdef ICONV_OPTION
+ rprintf(F," --iconv=CONVERT_SPEC request charset conversion of filesnames\n");
+@@ -506,6 +512,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 },
-@@ -565,6 +572,8 @@ static struct poptOption long_options[]
+@@ -601,6 +608,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 },
-@@ -1467,6 +1476,16 @@ int parse_arguments(int *argc, const cha
+@@ -1531,6 +1540,16 @@ int parse_arguments(int *argc, const cha
}
}
if (files_from) {
char *h, *p;
int q;
-@@ -1751,6 +1770,25 @@ void server_options(char **args,int *arg
+@@ -1840,6 +1859,25 @@ void server_options(char **args,int *arg
args[ac++] = "--size-only";
}
goto oom;
--- old/pipe.c
+++ new/pipe.c
-@@ -164,3 +164,77 @@ pid_t local_child(int argc, char **argv,
+@@ -163,3 +163,77 @@ pid_t local_child(int argc, char **argv,
return pid;
}
+}
--- old/receiver.c
+++ new/receiver.c
-@@ -54,6 +54,7 @@ extern struct stats stats;
+@@ -51,6 +51,7 @@ extern int delay_updates;
+ extern mode_t orig_umask;
+ extern struct stats stats;
extern char *tmpdir;
++extern char *dest_filter;
extern char *partial_dir;
extern char *basis_dir[];
-+extern char *dest_filter;
- extern struct file_list *cur_flist, *first_flist;
- extern struct filter_list_struct server_filter_list;
-
-@@ -355,6 +356,8 @@ int recv_files(int f_in, char *local_nam
+ extern struct file_list *cur_flist, *first_flist, *dir_flist;
+@@ -354,6 +355,8 @@ int recv_files(int f_in, char *local_nam
const char *parent_dirname = "";
#endif
int ndx, recv_ok;
+ char *filter_argv[MAX_FILTER_ARGS + 1];
if (verbose > 2)
- rprintf(FINFO, "recv_files(%d) starting\n", cur_flist->count);
-@@ -364,6 +367,23 @@ int recv_files(int f_in, char *local_nam
+ rprintf(FINFO, "recv_files(%d) starting\n", cur_flist->used);
+@@ -363,6 +366,23 @@ int recv_files(int f_in, char *local_nam
updating_basis = inplace;
while (1) {
cleanup_disable();
-@@ -644,6 +664,9 @@ int recv_files(int f_in, char *local_nam
+@@ -658,6 +678,9 @@ int recv_files(int f_in, char *local_nam
else if (!am_server && verbose && do_progress)
rprintf(FINFO, "%s\n", fname);
/* recv file data */
recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
fname, fd2, F_LENGTH(file));
-@@ -658,6 +681,16 @@ int recv_files(int f_in, char *local_nam
+@@ -672,6 +695,16 @@ int recv_files(int f_in, char *local_nam
exit_cleanup(RERR_FILEIO);
}
if (partialptr == fname)
--- old/rsync.h
+++ new/rsync.h
-@@ -120,6 +120,7 @@
+@@ -126,6 +126,7 @@
#define IOERR_DEL_LIMIT (1<<2)
#define MAX_ARGS 1000
--- old/rsync.yo
+++ new/rsync.yo
-@@ -363,6 +363,7 @@ to the detailed description below for a
+@@ -370,6 +370,7 @@ to the detailed description below for a
--timeout=TIME set I/O timeout in seconds
-I, --ignore-times don't skip files that match size and time
--size-only skip files that match in size
--modify-window=NUM compare mod-times with reduced accuracy
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
-@@ -400,6 +401,8 @@ to the detailed description below for a
+@@ -407,6 +408,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
+ --source-filter=COMMAND filter file through COMMAND at source
+ --dest-filter=COMMAND filter file through COMMAND at destination
--protocol=NUM force an older protocol version to be used
+ --iconv=CONVERT_SPEC request charset conversion of filesnames
--checksum-seed=NUM set block/file checksum seed (advanced)
- -4, --ipv4 prefer IPv4
-@@ -1823,6 +1826,33 @@ file previously generated by bf(--write-
+@@ -1865,6 +1868,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
-@@ -43,6 +43,7 @@ extern int do_progress;
+@@ -42,6 +42,7 @@ extern int do_progress;
extern int inplace;
extern int batch_fd;
extern int write_batch;
+extern char *source_filter;
extern struct stats stats;
- extern struct file_list *cur_flist, *first_flist;
+ extern struct file_list *cur_flist, *first_flist, *dir_flist;
-@@ -181,6 +182,26 @@ void send_files(int f_in, int f_out)
+@@ -180,6 +181,26 @@ void send_files(int f_in, int f_out)
enum logcode log_code = log_before_transfer ? FLOG : FINFO;
int f_xfer = write_batch < 0 ? batch_fd : f_out;
int ndx, j;
if (verbose > 2)
rprintf(FINFO, "send_files starting\n");
-@@ -281,6 +302,7 @@ void send_files(int f_in, int f_out)
+@@ -283,6 +304,7 @@ void send_files(int f_in, int f_out)
exit_cleanup(RERR_PROTOCOL);
}
fd = do_open(fname, O_RDONLY, 0);
if (fd == -1) {
if (errno == ENOENT) {
-@@ -311,6 +333,33 @@ void send_files(int f_in, int f_out)
+@@ -313,6 +335,33 @@ void send_files(int f_in, int f_out)
exit_cleanup(RERR_PROTOCOL);
}
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);
-@@ -352,6 +401,8 @@ void send_files(int f_in, int f_out)
+@@ -354,6 +403,8 @@ void send_files(int f_in, int f_out)
}
}
close(fd);
--- old/flist.c
+++ new/flist.c
-@@ -62,6 +62,8 @@ extern int copy_links;
+@@ -61,6 +61,8 @@ extern int copy_links;
extern int copy_unsafe_links;
extern int protocol_version;
extern int sanitize_paths;
extern struct stats stats;
extern char curr_dir[MAXPATHLEN];
-@@ -737,7 +739,7 @@ static struct file_struct *recv_file_ent
+@@ -745,7 +747,7 @@ static struct file_struct *recv_file_ent
uid = (uid_t)read_varint(f);
if (xflags & XMIT_USER_NAME_FOLLOWS)
uid = recv_user_name(f, uid);
uid = match_uid(uid);
}
}
-@@ -749,7 +751,7 @@ static struct file_struct *recv_file_ent
+@@ -757,7 +759,7 @@ static struct file_struct *recv_file_ent
gid_flags = 0;
if (xflags & XMIT_GROUP_NAME_FOLLOWS)
gid = recv_group_name(f, gid, &gid_flags);
gid = match_gid(gid, &gid_flags);
}
}
-@@ -1938,8 +1940,13 @@ struct file_list *recv_file_list(int f)
+@@ -1935,8 +1937,13 @@ struct file_list *recv_file_list(int f)
int dstart, flags;
int64 start_read;
else if (inc_recurse && verbose && !am_server && !first_flist)
--- old/options.c
+++ new/options.c
-@@ -157,6 +157,8 @@ char *rsync_path = RSYNC_PATH;
+@@ -156,6 +156,8 @@ char *rsync_path = RSYNC_PATH;
char *backup_dir = NULL;
char backup_dir_buf[MAXPATHLEN];
char *sockopts = NULL;
int rsync_port = 0;
int compare_dest = 0;
int copy_dest = 0;
-@@ -368,6 +370,8 @@ void usage(enum logcode F)
+@@ -367,6 +369,8 @@ void usage(enum logcode F)
rprintf(F," --delay-updates put all updated files into place at transfer's end\n");
rprintf(F," -m, --prune-empty-dirs prune empty directory chains from the file-list\n");
rprintf(F," --numeric-ids don't map uid/gid values by user/group name\n");
rprintf(F," --timeout=TIME set I/O timeout in seconds\n");
rprintf(F," -I, --ignore-times don't skip files that match in size and mod-time\n");
rprintf(F," --size-only skip files that match in size\n");
-@@ -582,6 +586,8 @@ static struct poptOption long_options[]
+@@ -581,6 +585,8 @@ static struct poptOption long_options[]
{"no-from0", 0, POPT_ARG_VAL, &eol_nulls, 0, 0, 0},
{"numeric-ids", 0, POPT_ARG_VAL, &numeric_ids, 1, 0, 0 },
{"no-numeric-ids", 0, POPT_ARG_VAL, &numeric_ids, 0, 0, 0 },
{"timeout", 0, POPT_ARG_INT, &io_timeout, 0, 0, 0 },
{"no-timeout", 0, POPT_ARG_VAL, &io_timeout, 0, 0, 0 },
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
-@@ -1873,6 +1879,18 @@ void server_options(char **args,int *arg
+@@ -1875,6 +1881,18 @@ void server_options(char **args,int *arg
args[ac++] = "--numeric-ids";
if (am_sender) {
then rsync will exit. The default is 0, which means no timeout.
--- old/uidlist.c
+++ new/uidlist.c
-@@ -32,6 +32,8 @@ extern int preserve_uid;
+@@ -31,6 +31,8 @@ extern int preserve_uid;
extern int preserve_gid;
extern int preserve_acls;
extern int numeric_ids;
#ifdef HAVE_GETGROUPS
# ifndef GETGROUPS_T
-@@ -41,6 +43,9 @@ extern int numeric_ids;
+@@ -40,6 +42,9 @@ extern int numeric_ids;
#define GID_NONE ((gid_t)-1)
struct idlist {
struct idlist *next;
char *name;
-@@ -48,8 +53,8 @@ struct idlist {
+@@ -47,8 +52,8 @@ struct idlist {
uint16 flags;
};
static struct idlist *add_to_list(struct idlist **root, id_t id, char *name,
id_t id2, uint16 flags)
-@@ -84,22 +89,6 @@ static char *gid_to_name(gid_t gid)
+@@ -83,22 +88,6 @@ static char *gid_to_name(gid_t gid)
return NULL;
}
static int is_in_group(gid_t gid)
{
#ifdef HAVE_GETGROUPS
-@@ -159,34 +148,49 @@ static int is_in_group(gid_t gid)
+@@ -158,34 +147,49 @@ static int is_in_group(gid_t gid)
#endif
}
}
return node;
-@@ -195,12 +199,9 @@ static struct idlist *recv_add_gid(gid_t
+@@ -194,12 +198,9 @@ static struct idlist *recv_add_gid(gid_t
/* this function is a definate candidate for a faster algorithm */
uid_t match_uid(uid_t uid)
{
if (uid == last_in)
return last_out;
-@@ -208,10 +209,13 @@ uid_t match_uid(uid_t uid)
+@@ -207,10 +208,13 @@ uid_t match_uid(uid_t uid)
for (list = uidlist; list; list = list->next) {
if (list->id == uid)
}
gid_t match_gid(gid_t gid, uint16 *flags_ptr)
-@@ -227,7 +231,7 @@ gid_t match_gid(gid_t gid, uint16 *flags
+@@ -226,7 +230,7 @@ gid_t match_gid(gid_t gid, uint16 *flags
break;
}
if (!list)
last = list;
}
-@@ -316,7 +320,7 @@ uid_t recv_user_name(int f, uid_t uid)
+@@ -315,7 +319,7 @@ uid_t recv_user_name(int f, uid_t uid)
if (!name)
out_of_memory("recv_user_name");
read_sbuf(f, name, len);
return node->id2;
}
-@@ -328,7 +332,7 @@ gid_t recv_group_name(int f, gid_t gid,
+@@ -327,7 +331,7 @@ gid_t recv_group_name(int f, gid_t gid,
if (!name)
out_of_memory("recv_group_name");
read_sbuf(f, name, len);
if (flags_ptr && node->flags & FLAG_SKIP_GROUP)
*flags_ptr |= FLAG_SKIP_GROUP;
return node->id2;
-@@ -355,17 +359,96 @@ void recv_id_list(int f, struct file_lis
+@@ -354,17 +358,96 @@ void recv_id_list(int f, struct file_lis
/* Now convert all the uids/gids from sender values to our values. */
#ifdef SUPPORT_ACLS
#endif
- if (am_root && preserve_uid && !numeric_ids) {
+ if (am_root && preserve_uid && (!numeric_ids || usermap)) {
- for (i = 0; i < flist->count; i++)
+ for (i = 0; i < flist->used; i++)
F_OWNER(flist->files[i]) = match_uid(F_OWNER(flist->files[i]));
}
- if (preserve_gid && (!am_root || !numeric_ids)) {
+ if (preserve_gid && (!am_root || !numeric_ids || groupmap)) {
- for (i = 0; i < flist->count; i++) {
+ for (i = 0; i < flist->used; i++) {
F_GROUP(flist->files[i]) = match_gid(F_GROUP(flist->files[i]),
&flist->files[i]->flags);
}