I have benchmarked this a little, and it appears to slow things down
for a local copy, so the old algorithm is used for local copies.
---- orig/flist.c 2006-01-17 02:15:59
+--- orig/flist.c 2006-01-21 21:02:30
+++ flist.c 2005-09-16 16:41:25
@@ -36,6 +36,7 @@ extern int am_daemon;
extern int am_sender;
extern int module_id;
extern int ignore_errors;
extern int numeric_ids;
-@@ -706,6 +707,16 @@ static struct file_struct *receive_file_
+@@ -708,6 +709,16 @@ static struct file_struct *receive_file_
sum = empty_sum;
}
read_buf(f, sum, checksum_len);
}
if (!preserve_perms) {
---- orig/generator.c 2006-01-14 20:27:09
+--- orig/generator.c 2006-01-21 21:02:30
+++ generator.c 2005-12-15 23:16:48
@@ -69,6 +69,7 @@ extern int ignore_timeout;
extern int protocol_version;
extern int checksum_len;
extern char *partial_dir;
extern char *basis_dir[];
-@@ -376,7 +377,8 @@ void itemize(struct file_struct *file, i
+@@ -377,7 +378,8 @@ void itemize(struct file_struct *file, i
/* Perform our quick-check heuristic for determining if a file is unchanged. */
{
if (st->st_size != file->length)
return 0;
-@@ -385,6 +387,8 @@ int unchanged_file(char *fn, struct file
+@@ -386,6 +388,8 @@ int unchanged_file(char *fn, struct file
of the file time to determine whether to sync */
if (always_checksum && S_ISREG(st->st_mode)) {
char sum[MD4_SUM_LENGTH];
file_checksum(fn, sum, st->st_size);
return memcmp(sum, file->u.sum, checksum_len) == 0;
}
-@@ -622,7 +626,7 @@ static int try_dests_reg(struct file_str
+@@ -623,7 +627,7 @@ static int try_dests_reg(struct file_str
match_level = 1;
/* FALL THROUGH */
case 1:
continue;
best_match = j;
match_level = 2;
-@@ -1142,7 +1146,7 @@ static void recv_generator(char *fname,
+@@ -1145,7 +1149,7 @@ static void recv_generator(char *fname,
;
else if (fnamecmp_type == FNAMECMP_FUZZY)
;
if (flist && flist->count > 0) {
local_name = get_local_name(flist, argv[0]);
---- orig/rsync.h 2006-01-14 20:27:10
-+++ rsync.h 2005-09-16 16:41:26
+--- orig/rsync.h 2006-01-21 21:02:30
++++ rsync.h 2006-01-21 21:08:49
@@ -64,6 +64,7 @@
#define FLAG_DEL_HERE (1<<3) /* receiver/generator */
- #define FLAG_SENT (1<<3) /* sender */
#define FLAG_HLINK_TOL (1<<4) /* receiver/generator */
-+#define FLAG_SUM_DIFFERS (1<<5) /* receiver/generator */
+ #define FLAG_NO_FUZZY (1<<5) /* generator */
++#define FLAG_SUM_DIFFERS (1<<6) /* receiver/generator */
/* update this if you make incompatible changes */
#define PROTOCOL_VERSION 29
+}
+
+#endif
---- orig/options.c 2006-01-21 07:55:00
-+++ options.c 2006-01-21 08:08:53
-@@ -139,6 +139,7 @@ char *backup_suffix = NULL;
+--- orig/options.c 2006-01-21 21:02:30
++++ options.c 2006-01-21 21:12:04
+@@ -141,6 +141,7 @@ char *backup_suffix = NULL;
char *tmpdir = NULL;
char *partial_dir = NULL;
char *basis_dir[MAX_BASIS_DIRS+1];
char *config_file = NULL;
char *shell_cmd = NULL;
char *log_format = NULL;
-@@ -327,6 +328,7 @@ void usage(enum logcode F)
+@@ -328,6 +329,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");
-@@ -372,7 +374,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -373,6 +375,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_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_REFUSED_BASE = 9000};
-+ OPT_LINK_BY_HASH, OPT_REFUSED_BASE = 9000};
++ OPT_LINK_BY_HASH,
+ OPT_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
- /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-@@ -460,6 +462,7 @@ static struct poptOption long_options[]
+@@ -461,6 +464,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 },
-@@ -1005,6 +1008,21 @@ int parse_arguments(int *argc, const cha
- basis_dir[basis_dir_cnt++] = (char *)arg;
- break;
+@@ -1027,6 +1031,21 @@ int parse_arguments(int *argc, const cha
+ usage(FINFO);
+ exit_cleanup(0);
+ case OPT_LINK_BY_HASH:
+#if HAVE_LINK
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1636,6 +1654,11 @@ void server_options(char **args,int *arg
+@@ -1660,6 +1679,11 @@ void server_options(char **args,int *arg
}
}
if (ret < 0) {
rsyserr(FERROR, errno, "%s %s -> \"%s\"",
ret == -2 ? "copy" : "rename",
---- orig/rsync.h 2006-01-14 20:27:10
+--- orig/rsync.h 2006-01-21 21:02:30
+++ rsync.h 2004-07-03 20:20:15
@@ -640,6 +640,14 @@ struct stats {
int current_file_index;
#include "byteorder.h"
#include "lib/mdfour.h"
---- orig/rsync.yo 2006-01-21 08:12:23
+--- orig/rsync.yo 2006-01-21 21:02:31
+++ rsync.yo 2005-02-13 06:58:47
@@ -356,6 +356,7 @@ to the detailed description below for a
--compare-dest=DIR also compare received files relative to DIR
can't say if I've left any cleanup/compatibility errors in the code.
---- orig/Makefile.in 2005-11-07 04:29:00
+--- orig/Makefile.in 2006-01-14 08:14:29
+++ Makefile.in 2004-10-08 20:17:06
@@ -38,7 +38,7 @@ OBJS3=progress.o pipe.o
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o
---- orig/cleanup.c 2005-11-10 16:58:36
+--- orig/cleanup.c 2006-01-14 08:14:29
+++ cleanup.c 2005-01-10 10:43:22
@@ -22,6 +22,9 @@
#include "rsync.h"
+
if (verbose > 3) {
rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): entered\n",
- code, safe_fname(file), line);
---- orig/clientserver.c 2005-10-24 21:04:44
+ code, file, line);
+--- orig/clientserver.c 2006-01-14 08:14:29
+++ clientserver.c 2005-04-09 17:39:57
@@ -44,6 +44,9 @@ extern int io_timeout;
extern int orig_umask;
extern char *bind_address;
extern struct filter_list_struct server_filter_list;
extern char *config_file;
-@@ -101,8 +104,18 @@ int start_socket_client(char *host, char
+@@ -99,8 +102,18 @@ int start_socket_client(char *host, char
exit_cleanup(RERR_SOCKETIO);
ret = start_inband_exchange(user, path, fd, fd, argc);
}
int start_inband_exchange(char *user, char *path, int f_in, int f_out,
-@@ -163,6 +176,33 @@ int start_inband_exchange(char *user, ch
+@@ -161,6 +174,33 @@ int start_inband_exchange(char *user, ch
if (verbose > 1)
print_child_argv(sargs);
p = strchr(path,'/');
if (p) *p = 0;
io_printf(f_out, "%s\n", path);
-@@ -191,6 +231,10 @@ int start_inband_exchange(char *user, ch
+@@ -189,6 +229,10 @@ int start_inband_exchange(char *user, ch
* server to terminate the listing of modules.
* We don't want to go on and transfer
* anything; just exit. */
exit(0);
}
-@@ -198,6 +242,10 @@ int start_inband_exchange(char *user, ch
+@@ -196,6 +240,10 @@ int start_inband_exchange(char *user, ch
rprintf(FERROR, "%s\n", line);
/* This is always fatal; the server will now
* close the socket. */
return -1;
}
-@@ -668,6 +716,7 @@ static void send_listing(int fd)
+@@ -700,6 +748,7 @@ static void send_listing(int fd)
io_printf(fd,"@RSYNCD: EXIT\n");
}
/* this is called when a connection is established to a client
and we want to start talking. The setup of the system is done from
here */
-@@ -717,6 +766,9 @@ int start_daemon(int f_in, int f_out)
+@@ -749,6 +798,9 @@ int start_daemon(int f_in, int f_out)
if (protocol_version > remote_protocol)
protocol_version = remote_protocol;
line[0] = 0;
if (!read_line(f_in, line, sizeof line - 1))
return -1;
-@@ -726,6 +778,20 @@ int start_daemon(int f_in, int f_out)
+@@ -758,6 +810,20 @@ int start_daemon(int f_in, int f_out)
return -1;
}
if (*line == '#') {
/* it's some sort of command that I don't understand */
io_printf(f_out, "@ERROR: Unknown command '%s'\n", line);
---- orig/configure.in 2005-09-24 17:40:30
+--- orig/configure.in 2006-01-15 14:52:33
+++ configure.in 2004-07-03 20:22:28
-@@ -293,6 +293,21 @@ yes
- AC_SEARCH_LIBS(getaddrinfo, inet6)
+@@ -282,6 +282,21 @@ if test x"$enable_locale" != x"no"; then
+ AC_DEFINE(CONFIG_LOCALE)
fi
+AC_ARG_ENABLE(openssl,
AC_MSG_CHECKING([whether to call shutdown on all sockets])
case $host_os in
*cygwin* ) AC_MSG_RESULT(yes)
---- orig/options.c 2005-11-15 07:01:03
-+++ options.c 2005-11-15 07:10:33
-@@ -162,6 +162,14 @@ int log_format_has_o_or_i = 0;
+--- orig/options.c 2006-01-21 21:02:30
++++ options.c 2006-01-21 21:13:11
+@@ -163,6 +163,14 @@ int log_format_has_o_or_i = 0;
int always_checksum = 0;
int list_only = 0;
#define MAX_BATCH_NAME_LEN 256 /* Must be less than MAXPATHLEN-13 */
char *batch_name = NULL;
-@@ -190,6 +198,7 @@ static void print_rsync_version(enum log
+@@ -191,6 +199,7 @@ static void print_rsync_version(enum log
char const *hardlinks = "no ";
char const *links = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
#ifdef HAVE_SOCKETPAIR
-@@ -212,6 +221,10 @@ static void print_rsync_version(enum log
+@@ -213,6 +222,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,
+ rprintf(f, "Copyright (C) 1996-2006 by Wayne Davison, Andrew Tridgell, and others\n");
@@ -225,10 +238,10 @@ static void print_rsync_version(enum log
/* Note that this field may not have type ino_t. It depends
* on the complicated interaction between largefile feature
#ifdef MAINTAINER_MODE
rprintf(f, " panic action: \"%s\"\n",
get_panic_action());
-@@ -363,6 +376,13 @@ void usage(enum logcode F)
+@@ -361,6 +374,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," --help show this help screen\n");
-@@ -375,6 +395,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -373,6 +393,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_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_USE_SSL,
- OPT_REFUSED_BASE = 9000};
+ OPT_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
-@@ -503,6 +524,13 @@ static struct poptOption long_options[]
+@@ -501,6 +522,13 @@ static struct poptOption long_options[]
{"checksum-seed", 0, POPT_ARG_INT, &checksum_seed, 0, 0, 0 },
- {"server", 0, POPT_ARG_NONE, &am_server, 0, 0, 0 },
+ {"server", 0, POPT_ARG_NONE, 0, OPT_SERVER, 0, 0 },
{"sender", 0, POPT_ARG_NONE, 0, OPT_SENDER, 0, 0 },
+#if HAVE_OPENSSL
+ {"ssl", 0, POPT_ARG_NONE, 0, OPT_USE_SSL, 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 },
-@@ -997,6 +1025,12 @@ int parse_arguments(int *argc, const cha
- basis_dir[basis_dir_cnt++] = (char *)arg;
- break;
+@@ -1027,6 +1055,12 @@ int parse_arguments(int *argc, const cha
+ usage(FINFO);
+ exit_cleanup(0);
+ case OPT_USE_SSL:
+#if HAVE_OPENSSL
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1274,6 +1308,17 @@ int parse_arguments(int *argc, const cha
+@@ -1305,6 +1339,17 @@ int parse_arguments(int *argc, const cha
if (delay_updates && !partial_dir)
partial_dir = partialdir_for_delayupdate;
if (inplace) {
#ifdef HAVE_FTRUNCATE
if (partial_dir) {
-@@ -1664,11 +1709,28 @@ char *check_for_hostspec(char *s, char *
+@@ -1700,11 +1745,28 @@ char *check_for_hostspec(char *s, char *
{
char *p;
int not_host;
if ((p = strchr(s, '/')) != NULL) {
hostlen = p - s;
path = p + 1;
---- orig/rsync.h 2005-11-12 20:31:04
+--- orig/rsync.h 2006-01-21 21:02:30
+++ rsync.h 2004-10-08 21:01:33
@@ -32,6 +32,7 @@
Do we need configure support for mktime()?
---- orig/io.c 2005-08-17 06:45:07
+--- orig/io.c 2005-12-08 21:19:31
+++ io.c 2005-05-19 09:01:27
@@ -57,6 +57,7 @@ extern int remove_sent_files;
extern int preserve_hard_links;
extern struct file_list *the_file_list;
const char phase_unknown[] = "unknown";
-@@ -165,16 +166,24 @@ static void check_timeout(void)
+@@ -168,16 +169,24 @@ static void check_timeout(void)
{
time_t t;
if (t - last_io_in >= io_timeout) {
if (!am_server && !am_daemon) {
rprintf(FERROR, "io timeout after %d seconds -- exiting\n",
---- orig/options.c 2005-11-15 07:01:03
-+++ options.c 2005-08-27 21:27:57
-@@ -110,6 +110,7 @@ int checksum_seed = 0;
+--- orig/options.c 2006-01-21 21:02:30
++++ options.c 2006-01-21 21:14:08
+@@ -112,6 +112,7 @@ int checksum_seed = 0;
int inplace = 0;
int delay_updates = 0;
long block_size = 0; /* "long" because popt can't set an int32. */
/** Network address family. **/
-@@ -355,6 +356,8 @@ void usage(enum logcode F)
+@@ -353,6 +354,8 @@ void usage(enum logcode F)
rprintf(F," --password-file=FILE read 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");
-@@ -375,6 +378,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -373,6 +376,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_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_STOP_AT, OPT_TIME_LIMIT,
- OPT_REFUSED_BASE = 9000};
+ OPT_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
-@@ -476,6 +480,8 @@ static struct poptOption long_options[]
+@@ -474,6 +478,8 @@ static struct poptOption long_options[]
{"log-format", 0, POPT_ARG_STRING, &log_format, 0, 0, 0 },
- {"itemize-changes", 'i', POPT_ARG_NONE, &itemize_changes, 0, 0, 0 },
+ {"itemize-changes", 'i', POPT_ARG_NONE, 0, 'i', 0, 0 },
{"bwlimit", 0, POPT_ARG_INT, &bwlimit, 0, 0, 0 },
+ {"stop-at", 0, POPT_ARG_STRING, 0, OPT_STOP_AT, 0, 0 },
+ {"time-limit", 0, POPT_ARG_STRING, 0, OPT_TIME_LIMIT, 0, 0 },
{"backup", 'b', POPT_ARG_NONE, &make_backups, 0, 0, 0 },
{"backup-dir", 0, POPT_ARG_STRING, &backup_dir, 0, 0, 0 },
{"suffix", 0, POPT_ARG_STRING, &backup_suffix, 0, 0, 0 },
-@@ -997,6 +1003,36 @@ int parse_arguments(int *argc, const cha
- basis_dir[basis_dir_cnt++] = (char *)arg;
- break;
+@@ -1027,6 +1033,36 @@ int parse_arguments(int *argc, const cha
+ usage(FINFO);
+ exit_cleanup(0);
+ case OPT_STOP_AT:
+ arg = poptGetOptArg(pc);
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1523,6 +1559,15 @@ void server_options(char **args,int *arg
+@@ -1564,6 +1600,15 @@ void server_options(char **args,int *arg
args[ac++] = arg;
}
if (backup_dir) {
args[ac++] = "--backup-dir";
args[ac++] = backup_dir;
---- orig/rsync.yo 2005-11-15 07:01:04
+--- orig/rsync.yo 2006-01-21 21:02:31
+++ rsync.yo 2005-02-01 10:46:35
@@ -381,6 +381,8 @@ to the detailed description below for a
--password-file=FILE read password from FILE
--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
-@@ -1371,6 +1373,19 @@ transfer was too fast, it will wait befo
+@@ -1406,6 +1408,19 @@ transfer was too fast, it will wait befo
result is an average transfer rate equaling the specified limit. A value
of zero specifies no limit.
dit(bf(--write-batch=FILE)) Record a file that can later be applied to
another identical destination with bf(--read-batch). See the "BATCH MODE"
section for details, and also the bf(--only-write-batch) option.
---- orig/util.c 2005-11-12 20:13:05
+--- orig/util.c 2006-01-20 00:12:48
+++ util.c 2004-07-03 20:23:22
@@ -128,6 +128,132 @@ void overflow_exit(char *str)
exit_cleanup(RERR_MALLOC);