The patches for 3.0.0pre6.
authorWayne Davison <wayned@samba.org>
Wed, 28 Nov 2007 09:24:43 +0000 (09:24 +0000)
committerWayne Davison <wayned@samba.org>
Wed, 28 Nov 2007 09:24:43 +0000 (09:24 +0000)
45 files changed:
.cvsignore [deleted file]
ODBC-dblog.diff [deleted file]
acls.diff
adaptec_acl_mods.diff
atimes.diff
backup-dir-dels.diff
catch_crash_signals.diff
checksum-reading.diff [moved from checksum4mirrors.diff with 93% similarity]
checksum-updating.diff
checksum-xattr.diff
contimeout.diff [deleted file]
copy-devices.diff
cvs-entries.diff
date-only.diff
detect-renamed-lax.diff
detect-renamed.diff
downdate.diff
drop-cache.diff
dynamic_hash.diff [deleted file]
early-checksum.diff [deleted file]
flags.diff
fsync.diff
gzip-rsyncable-checksum.diff [deleted file]
gzip-rsyncable.diff [deleted file]
ignore-case.diff
link-by-hash.diff
links-depth.diff [deleted file]
log-checksum.diff
netgroup-auth.diff
omit-dir-changes.diff
openssl-support.diff
osx-create-time.diff
preallocate.diff
segment_large_hash.diff [deleted file]
slow-down.diff
slp.diff
soften-links.diff
source-backup.diff
source-filter_dest-filter.diff
time-limit.diff
transliterate.diff
tru64.diff
usermap.diff
verify-patches [deleted file]
xattrs.diff

diff --git a/.cvsignore b/.cvsignore
deleted file mode 100644 (file)
index c52166a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-tmp
-.rsync-filter
diff --git a/ODBC-dblog.diff b/ODBC-dblog.diff
deleted file mode 100644 (file)
index 2673bc8..0000000
+++ /dev/null
@@ -1,1232 +0,0 @@
-Add support for logging daemon messages to an SQL database.
-
-To use this patch, run these commands for a successful build:
-
-    patch -p1 <patches/ODBC-dblog.diff
-    ./prepare-source
-    ./configure --enable-ODBC
-    make
-
-See the newly-created file "instructions" for more info.
-
---- old/Makefile.in
-+++ new/Makefile.in
-@@ -32,7 +32,7 @@ LIBOBJ=lib/wildmatch.o lib/compat.o lib/
- 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
- OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
--      util.o main.o checksum.o match.o syscall.o log.o backup.o
-+      util.o main.o checksum.o match.o syscall.o log.o backup.o @EXTRA_OBJECT@
- OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
-       fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
- OBJS3=progress.o pipe.o
---- old/cleanup.c
-+++ new/cleanup.c
-@@ -26,6 +26,7 @@ extern int am_server;
- extern int am_daemon;
- extern int io_error;
- extern int keep_partial;
-+extern int am_generator;
- extern int log_got_error;
- extern char *partial_dir;
- extern char *logfile_name;
-@@ -178,8 +179,13 @@ NORETURN void _exit_cleanup(int code, co
-                               code = exit_code = RERR_PARTIAL;
-               }
--              if (code || am_daemon || (logfile_name && (am_server || !verbose)))
-+              if (code || am_daemon || (logfile_name && (am_server || !verbose))) {
-                       log_exit(code, file, line);
-+#ifdef HAVE_LIBODBC
-+                      db_log_exit(code, file, line);
-+                      db_log_close();
-+#endif
-+              }
-               /* FALLTHROUGH */
- #include "case_N.h"
---- old/clientserver.c
-+++ new/clientserver.c
-@@ -499,6 +499,9 @@ static int rsync_module(int f_in, int f_
-                  XFLG_ABS_IF_SLASH | XFLG_OLD_PREFIXES);
-       log_init(1);
-+#ifdef HAVE_LIBODBC
-+      db_log_open();
-+#endif
- #ifdef HAVE_PUTENV
-       if (*lp_prexfer_exec(i) || *lp_postxfer_exec(i)) {
-@@ -695,6 +698,9 @@ static int rsync_module(int f_in, int f_
-                       rprintf(FLOG, "rsync %s %s from %s@%s (%s)\n",
-                               am_sender ? "on" : "to",
-                               request, auth_user, host, addr);
-+#ifdef HAVE_LIBODBC
-+                      db_log_session();
-+#endif
-               } else {
-                       rprintf(FLOG, "rsync %s %s from %s (%s)\n",
-                               am_sender ? "on" : "to",
---- old/configure.in
-+++ new/configure.in
-@@ -656,6 +656,12 @@ if test x"$with_included_popt" != x"yes"
-     AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
- fi
-+AC_ARG_ENABLE(ODBC, AC_HELP_STRING([--enable-ODBC], [compile in support for ODBC database logging]),
-+    [ AC_CHECK_HEADERS(sql.h sqlext.h sqltypes.h)
-+    AC_CHECK_LIB(odbc,SQLExecDirect)
-+    EXTRA_OBJECT="$EXTRA_OBJECT dblog.o"
-+    AC_SUBST(EXTRA_OBJECT) ])
-+
- AC_MSG_CHECKING([whether to use included libpopt])
- if test x"$with_included_popt" = x"yes"; then
-     AC_MSG_RESULT($srcdir/popt)
---- old/db_log_error-list.txt
-+++ new/db_log_error-list.txt
-@@ -0,0 +1,35 @@
-+error type            description
-+0                     not an error.
-+1                     authentication
-+2                     file/dir deletion failed
-+3                     connection closed
-+4                     read error
-+5                     multiplexing overflow
-+6                     unexpected tag
-+7                     over long v-string received
-+8                     invalid block length
-+9                     invalid checksum length
-+10                    invalid remainder length
-+11                    failed to write error
-+12                    attempting to send over-long vstring
-+13                    temporary filename too long
-+14                    lseek failed
-+15                    write failed
-+16                    rename failed
-+17                    rsync hack failed
-+18                    "invalid basis_dir index
-+19                    fstat failed
-+20                    is a directory
-+21                    open file failed
-+22                    mkstemp failed
-+23                    close failed
-+24                    failed verification
-+25                    IO error, skipping deletion.
-+26                    directory creation failed
-+27                    ignoring unsafe symbolic link
-+28                    symbolic link failed
-+29                    mknod failed
-+30                    failed to stat
-+31                    unlink
-+32                    failed to open file/directory
-+33                    open?
---- old/dblog-tables-mysql.sql
-+++ new/dblog-tables-mysql.sql
-@@ -0,0 +1,64 @@
-+drop table transfer;
-+drop table exit;
-+drop table session;
-+
-+CREATE TABLE session (
-+      id                      int auto_increment NOT NULL,
-+      date                    timestamp NOT NULL,
-+      ip_address              varchar(15) NOT NULL,
-+      username                varchar(20) NOT NULL,
-+      module_name             varchar(20) NOT NULL,
-+      module_path             varchar(255) NOT NULL,
-+      process_id              int NOT NULL,
-+      Primary Key (id)
-+);
-+
-+CREATE TABLE transfer (
-+      id                      int auto_increment NOT NULL,
-+      session_id              int NOT NULL,
-+      date                    timestamp NOT NULL,
-+      file_name               varchar(255) NOT NULL,
-+      file_size               bigint NOT NULL,
-+      bytes_transferred       bigint NOT NULL,
-+      checksum_bytes_transferred bigint NOT NULL,
-+      operation               varchar(20),
-+      Primary Key (id),
-+      foreign key (session_id) references session (id)
-+);
-+
-+CREATE TABLE exit (
-+      id                      int auto_increment NOT NULL,
-+      session_id              int NOT NULL,
-+      date                    timestamp NOT NULL,
-+      total_bytes_written     bigint NOT NULL,
-+      total_bytes_read        bigint NOT NULL,
-+      total_size              bigint NOT NULL,
-+      error_text              varchar(128) NOT NULL,
-+      error_code              int NOT NULL,
-+      error_file              varchar(64) NOT NULL,
-+      error_line              int NOT NULL,
-+      process_id              int NOT NULL,
-+      Primary Key (id),
-+      foreign key (session_id) references session (id)
-+);
-+
-+CREATE TABLE error (
-+      id                      int auto_increment NOT NULL,
-+      session_id              int NOT NULL,
-+      date                    timestamp NOT NULL,
-+      logcode                 bigint NOT NULL,
-+      error_number            bigint NOT NULL,
-+      error_text              varchar(512),
-+      PrimaryKey (id),
-+      foreign key (session_id) references session (id)
-+);
-+
-+CREATE TABLE delete (
-+      id                      serial NOT NULL,
-+      session_id              int NOT NULL,
-+      date                    timestamp NOT NULL,
-+      path                    varchar(512) NOT NULL,
-+      mode                    int NOT NULL,
-+      PrimaryKey (id),
-+      foreign key (session_id) references session (id)
-+);
---- old/dblog-tables-postgresql.sql
-+++ new/dblog-tables-postgresql.sql
-@@ -0,0 +1,67 @@
-+drop table transfer;
-+drop table exit;
-+drop table session;
-+drop sequence session_id_seq;
-+create sequence session_id_seq;
-+
-+CREATE TABLE "session" (
-+      "id"                    int NOT NULL,
-+      "date"                  timestamp NOT NULL default now(),
-+      "ip_address"            varchar(15) NOT NULL,
-+      "username"              varchar(20) NOT NULL,
-+      "module_name"           varchar(20) NOT NULL,
-+      "module_path"           varchar(255) NOT NULL,
-+      "process_id"            int NOT NULL,
-+      Primary Key (id)
-+);
-+
-+CREATE TABLE "transfer" (
-+      "id"                    serial NOT NULL,
-+      "session_id"            int NOT NULL,
-+      "date"                  timestamp NOT NULL default now(),
-+      "file_name"             varchar(512) NOT NULL,
-+      "file_size"             bigint NOT NULL,
-+      "bytes_transferred"     bigint NOT NULL,
-+      "checksum_bytes_transferred" bigint NOT NULL,
-+      "operation"             varchar(20),
-+      Primary Key (id),
-+      foreign key (session_id) references session (id)
-+);
-+
-+CREATE TABLE "exit" (
-+      "id"                    serial NOT NULL,
-+      "session_id"            int NOT NULL,
-+      "date"                  timestamp NOT NULL default now(),
-+      "total_bytes_written"   bigint NOT NULL,
-+      "total_bytes_read"      bigint NOT NULL,
-+      "total_size"            bigint NOT NULL,
-+      "error_text"            varchar(128) NOT NULL,
-+      "error_code"            int NOT NULL,
-+      "error_file"            varchar(64) NOT NULL,
-+      "error_line"            int NOT NULL,
-+      "process_id"            int NOT NULL,
-+      Primary Key (id),
-+      foreign key (session_id) references session (id)
-+);
-+
-+CREATE TABLE "error" (
-+      "id"                    serial NOT NULL,
-+      "session_id"            int NOT NULL,
-+      "date"                  timestamp NOT NULL default now(),
-+      "logcode"               int NOT NULL,
-+      "error_number"          int NOT NULL,
-+      "error_text"            varchar(512),
-+      Primary Key (id),
-+      foreign key (session_id) references session (id)
-+
-+);
-+
-+CREATE TABLE "delete" (
-+      "id"                    serial NOT NULL,
-+      "session_id"            int NOT NULL,
-+      "date"                  timestamp NOT NULL default now(),
-+      "path"                  varchar(512) NOT NULL,
-+      "mode"                  int NOT NULL,
-+      Primary Key (id),
-+      foreign key (session_id) references session (id)
-+);
---- old/dblog.c
-+++ new/dblog.c
-@@ -0,0 +1,549 @@
-+/*
-+ *  ODBC Database logging functions
-+ *
-+ *  Written by Steve Sether, April 2004
-+ *  steve@vellmont.com
-+ */
-+
-+#include "rsync.h"
-+
-+#ifdef HAVE_SQL_H
-+#include <sql.h>
-+#else
-+#ifdef HAVE_ODBC_SQL_H
-+#include <odbc/sql.h>
-+#endif
-+#endif
-+
-+#ifdef HAVE_SQLEXT_H
-+#include <sqlext.h>
-+#else
-+#ifdef HAVE_ODBC_SQLEXT_H
-+#include <odbc/sqlext.h>
-+#endif
-+#endif
-+
-+#ifdef HAVE_SQLTYPES_H
-+#include <sqltypes.h>
-+#else
-+#ifdef HAVE_ODBC_SQLTYPES_H
-+#include <odbc/sqltypes.h>
-+#endif
-+#endif
-+
-+SQLHENV db_environ_handle;                    /* Handle ODBC environment */
-+long result;                                  /* result of functions */
-+SQLHDBC db_handle_g = NULL;                   /* database connection handle for generator*/
-+SQLHDBC db_handle_r = NULL;                   /* database connection handle for sender */
-+SQLHSTMT sql_statement_handle_g;              /* SQL statement handle for generator*/
-+SQLHSTMT sql_statement_handle_r;              /* SQL statement handle for receiver*/
-+extern int am_daemon;
-+extern int am_sender;
-+extern int am_generator;
-+extern char *auth_user;
-+extern int module_id;
-+extern int dry_run;
-+
-+
-+char sql_status[10];                          /* Status SQL */
-+SQLINTEGER V_OD_err, V_OD_rowanz, V_OD_id;
-+SQLSMALLINT V_OD_mlen, V_OD_colanz;
-+char V_OD_msg[200], V_OD_buffer[200];
-+SQLINTEGER session_id;
-+
-+
-+/* This function simply removes invalid characters from the SQL statement
-+ * to prevent SQL injection attacks. */
-+char *sanitizeSql(const char *input)
-+{
-+      char *out, *ptr;
-+      const char *c;
-+
-+      if (strlen(input) > ((~(unsigned int)0)>>1)-3)
-+              return 0;
-+      if (!(out = ptr = new_array(char, strlen(input) * 2 + 1)))
-+              return 0;
-+
-+      for (c = input;  *c;  c++) {
-+              switch (*c) {
-+              case '\'':
-+                      *ptr++ = '\'';
-+                      *ptr++ = '\'';
-+                      break;
-+              case '\b':
-+                      *ptr++ = '\\';
-+                      *ptr++ = 'b';
-+                      break;
-+              case '\n':
-+                      *ptr++ = '\\';
-+                      *ptr++ = 'n';
-+                      break;
-+              case '\r':
-+                      *ptr++ = '\\';
-+                      *ptr++ = 'r';
-+                      break;
-+              case '\t':
-+                      *ptr++ = '\\';
-+                      *ptr++ = 't';
-+                      break;
-+              default:
-+                      *ptr++ = *c;
-+                      break;
-+              }
-+      }
-+      *ptr = '\0';
-+      return out;
-+}
-+
-+void db_log_open(void)
-+{
-+      if (!lp_database_logging(module_id))
-+              return;
-+
-+      /* get ODBC environment handle */
-+      result = SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&db_environ_handle);
-+      if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+              rprintf(FERROR, "Error: couldn't get database environment handle\n");
-+              return;
-+      }
-+
-+      /* Setting database enviroment */
-+      result = SQLSetEnvAttr(db_environ_handle, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
-+      if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+              rprintf(FERROR, "Error: couldn't set database environment.\n");
-+              SQLFreeHandle(SQL_HANDLE_ENV, db_environ_handle);
-+              db_environ_handle = NULL;
-+              return;
-+      }
-+      if (db_handle_g == NULL) {
-+              /* Get a database handle for the generator*/
-+              result = SQLAllocHandle(SQL_HANDLE_DBC, db_environ_handle, &db_handle_g);
-+              if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                      rprintf(FERROR, "Error: couldn't allocate database handle for generator\n");
-+                      SQLFreeHandle(SQL_HANDLE_ENV, db_environ_handle);
-+                      db_environ_handle = NULL;
-+                      return;
-+              }
-+
-+              /* Set connection attributes for the generator db connection */
-+              SQLSetConnectAttr(db_handle_g, SQL_LOGIN_TIMEOUT, (SQLPOINTER *)5, 0);
-+
-+              /* get the database connection for the generator. */
-+              result = SQLConnect(db_handle_g, (SQLCHAR*) lp_database_datasource(module_id), SQL_NTS,
-+                  (SQLCHAR*) lp_database_username(module_id), SQL_NTS,
-+                  (SQLCHAR*) lp_database_password(module_id), SQL_NTS);
-+
-+              if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                      SQLGetDiagRec(SQL_HANDLE_DBC, db_handle_g, 1,
-+                          sql_status, &V_OD_err, V_OD_msg, 100, &V_OD_mlen);
-+                      rprintf(FERROR,"Error Connecting to Database (generator) %s\n",V_OD_msg);
-+                      SQLFreeHandle(SQL_HANDLE_DBC,db_handle_g);
-+                      db_handle_g = NULL;
-+                      SQLFreeHandle(SQL_HANDLE_ENV, db_environ_handle);
-+                      db_environ_handle = NULL;
-+                      return;
-+              }
-+              rprintf(FLOG,"Connected to database for generator!\n");
-+      } else {
-+              rprintf(FERROR,"Already connected to database for generator\n");
-+      }
-+      if (db_handle_r == NULL) {
-+              /* Get a database handle for the receiver */
-+              result = SQLAllocHandle(SQL_HANDLE_DBC, db_environ_handle, &db_handle_r);
-+              if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                      rprintf(FERROR, "Error: couldn't allocate database handle for receiver\n");
-+                      SQLFreeHandle(SQL_HANDLE_ENV, db_environ_handle);
-+                      db_environ_handle = NULL;
-+                      return;
-+              }
-+
-+              /* Set connection attributes for the receiver db connection */
-+              SQLSetConnectAttr(db_handle_r, SQL_LOGIN_TIMEOUT, (SQLPOINTER *)5, 0);
-+
-+              /* get the generator connection for the receiver. */
-+              result = SQLConnect(db_handle_r, (SQLCHAR*) lp_database_datasource(module_id), SQL_NTS,
-+                  (SQLCHAR*) lp_database_username(module_id), SQL_NTS,
-+                  (SQLCHAR*) lp_database_password(module_id), SQL_NTS);
-+
-+              if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                      SQLGetDiagRec(SQL_HANDLE_DBC, db_handle_r,1,
-+                          sql_status, &V_OD_err,V_OD_msg,100,&V_OD_mlen);
-+                      rprintf(FERROR,"Error Connecting to Database (receiver) %s\n",V_OD_msg);
-+                      SQLFreeHandle(SQL_HANDLE_DBC,db_handle_r);
-+                      db_handle_r = NULL;
-+                      SQLFreeHandle(SQL_HANDLE_ENV, db_environ_handle);
-+                      db_environ_handle = NULL;
-+                      return;
-+              }
-+              rprintf(FLOG,"Connected to database for receiver!\n");
-+      } else {
-+              rprintf(FERROR,"Already connected to database for receiver\n");
-+      }
-+
-+      /* get SQL statement handle for generator */
-+      result = SQLAllocHandle(SQL_HANDLE_STMT, db_handle_g, &sql_statement_handle_g);
-+      if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+              SQLGetDiagRec(SQL_HANDLE_DBC, db_handle_g,1, sql_status,&V_OD_err,V_OD_msg,100,&V_OD_mlen);
-+              rprintf(FERROR,"Error in allocating SQL statement handle %s\n",V_OD_msg);
-+              SQLDisconnect(db_handle_g);
-+              SQLFreeHandle(SQL_HANDLE_DBC,db_handle_g);
-+              db_handle_g = NULL;
-+              SQLFreeHandle(SQL_HANDLE_ENV, db_environ_handle);
-+              db_environ_handle = NULL;
-+              return;
-+      }
-+
-+      /* get SQL statement handle for receiver */
-+      result = SQLAllocHandle(SQL_HANDLE_STMT, db_handle_r, &sql_statement_handle_r);
-+      if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+              SQLGetDiagRec(SQL_HANDLE_DBC, db_handle_r,1, sql_status,&V_OD_err,V_OD_msg,100,&V_OD_mlen);
-+              rprintf(FERROR,"Error in allocating SQL statement handle %s\n",V_OD_msg);
-+              SQLDisconnect(db_handle_r);
-+              SQLFreeHandle(SQL_HANDLE_DBC,db_handle_r);
-+              db_handle_r = NULL;
-+              SQLFreeHandle(SQL_HANDLE_ENV, db_environ_handle);
-+              db_environ_handle = NULL;
-+              return;
-+      }
-+}
-+
-+void db_log_close()
-+{
-+      if (!lp_database_logging(module_id))
-+              return;
-+
-+      if (am_generator) {
-+              if (sql_statement_handle_g != NULL) {
-+                      /* free the statement handle first */
-+                      SQLFreeHandle(SQL_HANDLE_STMT,sql_statement_handle_g);
-+                      sql_statement_handle_g = NULL;
-+              } else {
-+                      rprintf(FERROR,"No generator sql statement handle to close\n");
-+              }
-+
-+              if (db_handle_g != NULL) {
-+                      /* disconnect, and free the database handle. */
-+                      SQLDisconnect(db_handle_g);
-+                      SQLFreeHandle(SQL_HANDLE_DBC,db_handle_g);
-+                      db_handle_g = NULL;
-+              } else {
-+                      rprintf(FERROR,"Generator database connection already closed\n");
-+              }
-+      } else { /* must be receiver */
-+              if (sql_statement_handle_r != NULL) {
-+                      /* free the statement handle first */
-+                      SQLFreeHandle(SQL_HANDLE_STMT,sql_statement_handle_r);
-+                      sql_statement_handle_r = NULL;
-+              } else {
-+                      rprintf(FERROR,"No receiver sql statement handle to close\n");
-+              }
-+
-+              if (db_handle_r != NULL) {
-+                      /* disconnect, and free the database handle. */
-+                      SQLDisconnect(db_handle_r);
-+                      SQLFreeHandle(SQL_HANDLE_DBC,db_handle_r);
-+                      db_handle_r = NULL;
-+              } else {
-+                      rprintf(FERROR,"Receiver database connection already closed\n");
-+              }
-+      }
-+
-+      if (db_environ_handle != NULL) {
-+              /* free the environment handle */
-+              SQLFreeHandle(SQL_HANDLE_ENV, db_environ_handle);
-+              db_environ_handle = NULL;
-+      } else {
-+              rprintf(FERROR,"No environment handle to close\n");
-+      }
-+}
-+
-+static long get_unique_session_id()
-+{
-+      long unique;
-+      char strSqlStatement[1024];
-+      SQLHDBC db_handle = (am_generator) ? db_handle_g : db_handle_r;
-+      SQLHSTMT sql_statement_handle = (am_generator) ? sql_statement_handle_g : sql_statement_handle_r;
-+
-+      if (db_handle != NULL) {
-+              /* choose the appropriate select statement based upon which DBMS we're using.
-+               * different datbases use different methods to get a unique ID.  Some use a counter
-+               * object (sequence), others use an auto increment datatype and have a method
-+               * to get the last ID inserted using this connection. */
-+              if (strcmp(lp_unique_id_method(module_id),"nextval-postgresql") == 0) {
-+                      snprintf(strSqlStatement, sizeof strSqlStatement,
-+                          "SELECT NEXTVAL('%s');", lp_sequence_name(module_id));
-+              } else if (strcmp(lp_unique_id_method(module_id),"nextval-oracle") == 0) {
-+                      snprintf(strSqlStatement, sizeof strSqlStatement,
-+                          "SELECT %s.NEXTVAL FROM dual;", lp_sequence_name(module_id));
-+              } else if (strcmp(lp_unique_id_method(module_id),"nextval-db2") == 0) {
-+                      snprintf(strSqlStatement, sizeof strSqlStatement,
-+                          "VALUES NEXTVAL FOR %s;",lp_sequence_name(module_id));
-+              } else if (strcmp(lp_unique_id_method(module_id),"last_insert_id") == 0) { /* MySql */
-+                      snprintf(strSqlStatement, sizeof strSqlStatement,
-+                          "SELECT LAST_INSERT_ID()");
-+              } else if (strcmp(lp_unique_id_method(module_id),"@@IDENTITY") == 0) { /* Sybase */
-+                      snprintf(strSqlStatement, sizeof strSqlStatement,
-+                          "SELECT @@IDENTITY");
-+              } else if (strcmp(lp_unique_id_method(module_id),"custom") == 0){ /* Users custom statement */
-+                      snprintf(strSqlStatement, sizeof strSqlStatement,
-+                          lp_custom_unique_id_select(module_id));
-+              }
-+
-+              /* bind the 1st column to unique */
-+              SQLBindCol(sql_statement_handle,1,SQL_C_LONG,&unique,150,&V_OD_err);
-+              /* execute the SQL statement */
-+              result = SQLExecDirect(sql_statement_handle,strSqlStatement,SQL_NTS);
-+              if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                      SQLGetDiagRec(SQL_HANDLE_DBC, db_handle,1, sql_status,&V_OD_err,V_OD_msg,100,&V_OD_mlen);
-+                      rprintf(FERROR,"Error at get_sequence:  Error in Select! %s %s\n",strSqlStatement,V_OD_msg);
-+              } else {
-+                      result = SQLFetch(sql_statement_handle);
-+                      if (result != SQL_NO_DATA && unique != 0) {
-+                              rprintf(FINFO,"Got unique sequence! %ld\n",unique);
-+                      } else {
-+                              rprintf(FERROR,"Error at get_sequence:  Didn't get unique session ID\n");
-+                      }
-+                      /* Close the cursor so the statement can be re-used */
-+                      result = SQLFreeStmt(sql_statement_handle,SQL_CLOSE);
-+                      if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                              SQLGetDiagRec(SQL_HANDLE_DBC, db_handle,1, sql_status,&V_OD_err,V_OD_msg,100,&V_OD_mlen);
-+                              rprintf(FERROR,"Error at get_sequence: Error in closing SQL statement handle %s\n",V_OD_msg);
-+                              return unique;
-+                      }
-+                      return unique;
-+              }
-+      }
-+      rprintf(FERROR,"Error at get_sequence: Not connected to database\n");
-+      return -1;
-+}
-+
-+void db_log_session()
-+{
-+      char strSqlStatement[1024];
-+      int gotSessionID = 0;
-+      SQLHDBC db_handle = (am_generator) ? db_handle_g : db_handle_r;
-+      SQLHSTMT sql_statement_handle = (am_generator) ? sql_statement_handle_g : sql_statement_handle_r;
-+
-+      if (!lp_database_logging(module_id))
-+              return;
-+
-+      if (db_handle != NULL) {
-+              /* if we're using a sequence via the nextval command to
-+               * get a unique ID, we need to get it before we do the
-+               * insert. We also get the unique ID  now if custom,
-+               * and get_custom_id_before_insert is set. */
-+              if (strcmp(lp_unique_id_method(module_id),"nextval-postgresql") == 0
-+               || strcmp(lp_unique_id_method(module_id),"nextval-oracle") == 0
-+               || strcmp(lp_unique_id_method(module_id),"nextval-db2") == 0
-+               || (strcmp(lp_unique_id_method(module_id),"custom") == 0
-+                && lp_get_custom_id_before_insert(module_id))) {
-+                      session_id = get_unique_session_id();
-+                      gotSessionID = 1;
-+                      snprintf(strSqlStatement, sizeof strSqlStatement,
-+                          "INSERT INTO %s (id, date, ip_address, username, module_name, module_path, process_id) VALUES ('%ld', '%s', '%s', '%s','%s','%s','%d');",
-+                          lp_session_table_name(module_id), session_id, timestring(time(NULL)), client_addr(0),
-+                          auth_user, lp_name(module_id), lp_path(module_id), getpid());
-+              } else {
-+                      /* Otherwise the ID gets created automatically, and we get the ID it used after the insert. */
-+                      snprintf(strSqlStatement, sizeof strSqlStatement,
-+                          "INSERT INTO %s (date, ip_address, username, module_name, module_path, process_id) VALUES ('%s', '%s', '%s', '%s','%s','%d');",
-+                          lp_session_table_name(module_id), timestring(time(NULL)), client_addr(0), auth_user,
-+                          lp_name(module_id), lp_path(module_id), getpid());
-+              }
-+
-+              /* Insert the new session into the database */
-+              result = SQLExecDirect(sql_statement_handle,strSqlStatement,SQL_NTS);
-+              if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                      SQLGetDiagRec(SQL_HANDLE_DBC, db_handle,1, sql_status,&V_OD_err,V_OD_msg,100,&V_OD_mlen);
-+                      rprintf(FERROR,"Error at db_log_session: Error in Insert %s %s\n",strSqlStatement,V_OD_msg);
-+              }
-+
-+              /* close the cursor so the statement handle can be re-used. */
-+              result = SQLFreeStmt(sql_statement_handle,SQL_CLOSE);
-+              if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                      SQLGetDiagRec(SQL_HANDLE_DBC, db_handle,1, sql_status,&V_OD_err,V_OD_msg,100,&V_OD_mlen);
-+                      rprintf(FERROR,"Error in resetting SQL statement handle %s\n",V_OD_msg);
-+              }
-+              /* get the session ID for databases that give the unique ID after an insert */
-+              if (gotSessionID == 0) {
-+                      session_id = get_unique_session_id();
-+              }
-+      } else {
-+              rprintf(FERROR,"Error at db_log_session:  Not connected to database!\n");
-+      }
-+}
-+
-+void db_log_transfer(struct file_struct *file,struct stats *initial_stats,char *operation)
-+{
-+      extern struct stats stats;
-+      char strSqlStatement[2048];
-+      char strFileName[MAXPATHLEN];
-+      char *strFileNamePtr;
-+      char strFileSize[255];
-+      int64 intBytesTransferred;
-+      int64 intCheckSumBytes;
-+      SQLHDBC db_handle = (am_generator) ? db_handle_g : db_handle_r;
-+      SQLHSTMT sql_statement_handle = (am_generator) ? sql_statement_handle_g : sql_statement_handle_r;
-+
-+      if (!lp_database_logging(module_id))
-+              return;
-+
-+      if (db_handle != NULL) {
-+              strFileNamePtr = f_name(file, NULL);
-+              if (am_sender && file->dir.root) {
-+                      pathjoin(strFileName, sizeof strFileName,
-+                               file->dir.root, strFileNamePtr);
-+                      strFileNamePtr = strFileName;
-+              }
-+              clean_fname(strFileNamePtr, 0);
-+              if (*strFileNamePtr == '/')
-+                      strFileNamePtr++;
-+
-+              snprintf(strFileSize, sizeof strFileSize, "%.0f", (double)F_LENGTH(file));
-+              if (am_sender) {
-+                      intBytesTransferred = stats.total_written - initial_stats->total_written;
-+              } else {
-+                      intBytesTransferred = stats.total_read - initial_stats->total_read;
-+              }
-+
-+              if (!am_sender) {
-+                      intCheckSumBytes = stats.total_written - initial_stats->total_written;
-+              } else {
-+                      intCheckSumBytes = stats.total_read - initial_stats->total_read;
-+              }
-+
-+              snprintf(strSqlStatement, sizeof strSqlStatement,
-+                  "INSERT INTO %s (session_id,date, file_name, file_size, bytes_transferred, checksum_bytes_transferred, operation) VALUES ('%ld','%s','%s','%s','%Ld','%Ld','%s');",
-+                  lp_transfer_table_name(module_id), session_id, timestring(time(NULL)),
-+                  sanitizeSql(strFileNamePtr), strFileSize, intBytesTransferred,
-+                  intCheckSumBytes, operation);
-+              result = SQLExecDirect(sql_statement_handle,strSqlStatement,SQL_NTS);
-+              if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                      SQLGetDiagRec(SQL_HANDLE_DBC, db_handle,1, sql_status,&V_OD_err,V_OD_msg,100,&V_OD_mlen);
-+                      rprintf(FERROR,"Error at db_log_transfer:  Error in Insert %s %s\n",strSqlStatement,V_OD_msg);
-+                      if (result == SQL_INVALID_HANDLE)
-+                              rprintf(FERROR,"INVALID HANDLE\n");
-+              }
-+      } else {
-+              rprintf(FERROR,"Error at db_log_transfer: Not connected to database!\n");
-+      }
-+}
-+
-+void db_log_exit(int code, const char *file, int line)
-+{
-+      char strSqlStatement[2048];
-+      const char *error_text;
-+      extern struct stats stats;
-+      SQLHDBC db_handle = (am_generator) ? db_handle_g : db_handle_r;
-+      SQLHSTMT sql_statement_handle = (am_generator) ? sql_statement_handle_g : sql_statement_handle_r;
-+
-+      if (!lp_database_logging(module_id))
-+              return;
-+
-+      if (db_handle != NULL) {
-+              if (code != 0) {
-+                      error_text = rerr_name(code);
-+                      if (!error_text) {
-+                              error_text = "unexplained error";
-+                      }
-+              } else {
-+                      error_text = "";
-+              }
-+              snprintf(strSqlStatement, sizeof strSqlStatement,
-+                  "INSERT INTO %s (session_id, date, total_bytes_written,total_bytes_read,total_size,error_text,error_code,error_file,error_line,process_id) VALUES ('%ld','%s','%Ld','%Ld','%Ld','%s','%d','%s','%d','%d');",
-+                  lp_exit_table_name(module_id), session_id, timestring(time(NULL)), stats.total_written,
-+                  stats.total_read, stats.total_size, error_text, code, file, line, getpid());
-+
-+              result = SQLExecDirect(sql_statement_handle,strSqlStatement,SQL_NTS);
-+
-+              if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                      SQLGetDiagRec(SQL_HANDLE_DBC, db_handle,1, sql_status,&V_OD_err,V_OD_msg,100,&V_OD_mlen);
-+                      rprintf(FERROR,"Error at db_log_exit: Error in Insert %s %s\n",strSqlStatement,V_OD_msg);
-+              }
-+      } else {
-+              rprintf(FERROR,"Error at db_log_exit: Not connected to database!\n");
-+      }
-+}
-+
-+void db_log_delete(char *fname, int mode)
-+{
-+      char strSqlStatement[2048];
-+      SQLHDBC db_handle = (am_generator) ? db_handle_g : db_handle_r;
-+      SQLHSTMT sql_statement_handle = (am_generator) ? sql_statement_handle_g : sql_statement_handle_r;
-+
-+      if (!am_daemon || dry_run || !lp_database_logging(module_id))
-+              return;
-+
-+      if (db_handle != NULL) {
-+              snprintf(strSqlStatement, sizeof strSqlStatement,
-+                  "INSERT INTO %s (session_id, date, path, mode) VALUES ('%ld','%s','%s','%d');",
-+                  lp_delete_table_name(module_id), session_id, timestring(time(NULL)), sanitizeSql(fname), mode);
-+
-+              result = SQLExecDirect(sql_statement_handle,strSqlStatement,SQL_NTS);
-+
-+              if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                      SQLGetDiagRec(SQL_HANDLE_DBC, db_handle,1, sql_status,&V_OD_err,V_OD_msg,100,&V_OD_mlen);
-+                      rprintf(FERROR,"Error at db_log_delete: Error in Insert %s %s\n",strSqlStatement,V_OD_msg);
-+              }
-+      } else {
-+              rprintf(FERROR,"Error at db_log_delete: Not connected to database!\n");
-+      }
-+}
-+
-+void db_log_error(enum logcode code, int errcode, const char *format,...)
-+{
-+      char strSqlStatement[MAXPATHLEN+1024];
-+      va_list ap;
-+      char buf[MAXPATHLEN+512];
-+      size_t len;
-+      SQLHDBC db_handle = (am_generator) ? db_handle_g : db_handle_r;
-+      SQLHSTMT sql_statement_handle = (am_generator) ? sql_statement_handle_g : sql_statement_handle_r;
-+
-+      if (!lp_database_logging(module_id))
-+              return;
-+
-+      va_start(ap, format);
-+      len = vsnprintf(buf, sizeof buf, format, ap);
-+      va_end(ap);
-+
-+      /* Deal with buffer overruns.  Instead of panicking, just
-+       * truncate the resulting string.  (Note that configure ensures
-+       * that we have a vsnprintf() that doesn't ever return -1.) */
-+      if (len > sizeof buf - 1) {
-+              const char ellipsis[] = "[...]";
-+
-+              /* Reset length, and zero-terminate the end of our buffer */
-+              len = sizeof buf - 1;
-+              buf[len] = '\0';
-+
-+              /* Copy the ellipsis to the end of the string, but give
-+               * us one extra character:
-+               *
-+               *                  v--- null byte at buf[sizeof buf - 1]
-+               *        abcdefghij0
-+               *     -> abcd[...]00  <-- now two null bytes at end
-+               *
-+               * If the input format string has a trailing newline,
-+               * we copy it into that extra null; if it doesn't, well,
-+               * all we lose is one byte.  */
-+              strncpy(buf+len-sizeof ellipsis, ellipsis, sizeof ellipsis);
-+              if (format[strlen(format)-1] == '\n') {
-+                      buf[len-1] = '\n';
-+              }
-+      }
-+
-+      if (db_handle != NULL) {
-+              snprintf(strSqlStatement, sizeof strSqlStatement,
-+                  "INSERT INTO %s (session_id, date, logcode, error_number, error_text) VALUES ('%ld','%s','%d','%d','%s');",
-+                  lp_error_table_name(module_id), session_id, timestring(time(NULL)), code, errcode, sanitizeSql(buf));
-+
-+              result = SQLExecDirect(sql_statement_handle,strSqlStatement,SQL_NTS);
-+
-+              if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
-+                      SQLGetDiagRec(SQL_HANDLE_DBC, db_handle,1, sql_status,&V_OD_err,V_OD_msg,100,&V_OD_mlen);
-+                      rprintf(FERROR,"Error at db_log_error: Error in Insert %s %s\n",strSqlStatement,V_OD_msg);
-+              }
-+      } else {
-+              rprintf(FERROR,"Error at db_log_error: Not connected to database!\n");
-+      }
-+}
---- old/instructions
-+++ new/instructions
-@@ -0,0 +1,84 @@
-+This patch adds the following options:
-+
-+"database logging"
-+    If set to True, rsync will attempt to connect to
-+    the specified datasource and write to the named tables.
-+    Defaults to False.
-+
-+"database datasource"
-+    Specifies the name of the ODBC data source to use.
-+
-+"database username"
-+    The username to use when connecting to the database.
-+
-+"database password"
-+    The password to use when connecting to the database.
-+
-+"transfer table name"
-+    The name of the transfer table to log to.  This table contains individual
-+    filenames, file sizes, bytes transferred, checksum bytes transferred,
-+    operation (send or receive), and a timestamp.
-+
-+"session table name"
-+    The name of the session table to log to.  This table contains the username,
-+    module name, module path, ip address, process ID, and a timestamp.
-+
-+"exit table name"
-+
-+    The name of the exit table to log to.  This table contains the total bytes
-+    read, total bytes written, total size of all files, error code, line the
-+    error occured at, file the error occured at and the text of the error.
-+    (most of which will be blank if the program exited normally).
-+
-+"delete table name"
-+
-+    The name of the table to log deleted files/directories to.
-+
-+"error table name"
-+
-+   The name of the table errors will be logged to.
-+
-+"unique id method"
-+    Different databases use different methods to get a unique identifier.
-+    Some databases support sequence objects, and use various forms of the
-+    nextval command to retrieve a unique identifier from it.  Other databases
-+    support an autonumber field, and support different methds of retrieving
-+    the ID used in the last insert.  Valid values for this option are:
-+
-+      nextval-postgres
-+          uses the syntax of nextval for PostgreSQL databases
-+
-+      nextval-oracle
-+          uses the syntax of nextval for Oracle databases
-+
-+      nextval-db2
-+          uses the syntax of nextval for DB2 databases
-+
-+      last_insert_id
-+          uses the last_insert_id() command for the MySQL databases
-+
-+      @@IDENTITY
-+          uses the @@IDENTITY command for Sybase databases
-+
-+      custom
-+          Define your own method to get a unique identifier.  See the
-+          "custom unique id select", and the "get custom id before select"
-+          parameters.
-+
-+"sequence name"
-+    If your database supports sequences, list the name of the sequence to use
-+    for the session unique identifier.
-+
-+"custom unique id select"
-+    Only used if you specify the custom method in "unique id method".  This is
-+    a SQL statement to be executed to get a unique ID.  This SQL statement must
-+    return one column with the unique ID to use for the session ID.  Should be
-+    used in concert with the "get custom id before select" parameter.
-+
-+"get custom id before insert"
-+    This parameter is ignored unless the "unique id method" is set to custom.
-+    If set to true, the "custom unique id select" statement will be executed
-+    BEFORE the session row is inserted into the database.  (as is done when a
-+    sequence is used for unique IDs).  If False the statement will be executed
-+    after the session row is inserted (as is done when the session ID is
-+    automatically generates unique IDs).  Defaults to True.
---- old/loadparm.c
-+++ new/loadparm.c
-@@ -125,9 +125,16 @@ typedef struct
- {
-       char *auth_users;
-       char *comment;
-+      char *custom_unique_id_select;
-+      char *database_datasource;
-+      char *database_password;
-+      char *database_username;
-+      char *delete_table_name;
-       char *dont_compress;
-+      char *error_table_name;
-       char *exclude;
-       char *exclude_from;
-+      char *exit_table_name;
-       char *filter;
-       char *gid;
-       char *hosts_allow;
-@@ -145,15 +152,21 @@ typedef struct
-       char *prexfer_exec;
-       char *refuse_options;
-       char *secrets_file;
-+      char *sequence_name;
-+      char *session_table_name;
-       char *temp_dir;
-+      char *transfer_table_name;
-       char *uid;
-+      char *unique_id_method;
-       int max_connections;
-       int max_verbosity;
-       int syslog_facility;
-       int timeout;
-+      BOOL database_logging;
-       BOOL fake_super;
-+      BOOL get_custom_id_before_insert;
-       BOOL ignore_errors;
-       BOOL ignore_nonreadable;
-       BOOL list;
-@@ -173,9 +186,16 @@ static service sDefault =
- {
-  /* auth_users; */            NULL,
-  /* comment; */                       NULL,
-+ /* custom_unique_id_select; */       NULL,
-+ /* database_datasource; */   NULL,
-+ /* database_password; */     NULL,
-+ /* database_username; */     NULL,
-+ /* delete_table_name; */     NULL,
-  /* dont_compress; */         DEFAULT_DONT_COMPRESS,
-+ /* error_table_name; */      NULL,
-  /* exclude; */                       NULL,
-  /* exclude_from; */          NULL,
-+ /* exit_table_name; */               NULL,
-  /* filter; */                        NULL,
-  /* gid; */                   NOBODY_GROUP,
-  /* hosts_allow; */           NULL,
-@@ -193,15 +213,21 @@ static service sDefault =
-  /* prexfer_exec; */          NULL,
-  /* refuse_options; */                NULL,
-  /* secrets_file; */          NULL,
-+ /* sequence_name; */         NULL,
-+ /* session_table_name; */    NULL,
-  /* temp_dir; */              NULL,
-+ /* transfer_table_name; */   NULL,
-  /* uid; */                   NOBODY_USER,
-+ /* unique_id_method; */      NULL,
-  /* max_connections; */               0,
-  /* max_verbosity; */         1,
-  /* syslog_facility; */               LOG_DAEMON,
-  /* timeout; */                       0,
-+ /* database_logging; */      False,
-  /* fake_super; */            False,
-+ /* get_custom_id_before_insert; */ True,
-  /* ignore_errors; */         False,
-  /* ignore_nonreadable; */    False,
-  /* list; */                  True,
-@@ -300,11 +326,20 @@ static struct parm_struct parm_table[] =
-  {"auth users",        P_STRING, P_LOCAL, &sDefault.auth_users,        NULL,0},
-  {"comment",           P_STRING, P_LOCAL, &sDefault.comment,           NULL,0},
-+ {"custom unique id select",P_STRING,P_LOCAL,&sDefault.custom_unique_id_select,NULL,0},
-+ {"database datasource",P_STRING,P_LOCAL, &sDefault.database_datasource,NULL,0},
-+ {"database logging",  P_BOOL,   P_LOCAL, &sDefault.database_logging,  NULL,0},
-+ {"database password", P_STRING, P_LOCAL, &sDefault.database_password, NULL,0},
-+ {"database username", P_STRING, P_LOCAL, &sDefault.database_username, NULL,0},
-+ {"delete table name", P_STRING, P_LOCAL, &sDefault.delete_table_name, NULL,0},
-  {"dont compress",     P_STRING, P_LOCAL, &sDefault.dont_compress,     NULL,0},
-+ {"error table name",  P_STRING, P_LOCAL, &sDefault.error_table_name,  NULL,0},
-  {"exclude from",      P_STRING, P_LOCAL, &sDefault.exclude_from,      NULL,0},
-  {"exclude",           P_STRING, P_LOCAL, &sDefault.exclude,           NULL,0},
-+ {"exit table name",   P_STRING, P_LOCAL, &sDefault.exit_table_name,   NULL,0},
-  {"fake super",        P_BOOL,   P_LOCAL, &sDefault.fake_super,        NULL,0},
-  {"filter",            P_STRING, P_LOCAL, &sDefault.filter,            NULL,0},
-+ {"get custom id before insert",P_BOOL,P_LOCAL,&sDefault.get_custom_id_before_insert,NULL,0},
-  {"gid",               P_STRING, P_LOCAL, &sDefault.gid,               NULL,0},
-  {"hosts allow",       P_STRING, P_LOCAL, &sDefault.hosts_allow,       NULL,0},
-  {"hosts deny",        P_STRING, P_LOCAL, &sDefault.hosts_deny,        NULL,0},
-@@ -329,12 +364,16 @@ static struct parm_struct parm_table[] =
-  {"read only",         P_BOOL,   P_LOCAL, &sDefault.read_only,         NULL,0},
-  {"refuse options",    P_STRING, P_LOCAL, &sDefault.refuse_options,    NULL,0},
-  {"secrets file",      P_STRING, P_LOCAL, &sDefault.secrets_file,      NULL,0},
-+ {"sequence name",     P_STRING, P_LOCAL, &sDefault.sequence_name,     NULL,0},
-+ {"session table name",P_STRING, P_LOCAL, &sDefault.session_table_name,NULL,0},
-  {"strict modes",      P_BOOL,   P_LOCAL, &sDefault.strict_modes,      NULL,0},
-  {"syslog facility",   P_ENUM,   P_LOCAL, &sDefault.syslog_facility,enum_facilities,0},
-  {"temp dir",          P_PATH,   P_LOCAL, &sDefault.temp_dir,          NULL,0},
-  {"timeout",           P_INTEGER,P_LOCAL, &sDefault.timeout,           NULL,0},
-  {"transfer logging",  P_BOOL,   P_LOCAL, &sDefault.transfer_logging,  NULL,0},
-+ {"transfer table name",P_STRING,P_LOCAL, &sDefault.transfer_table_name,NULL,0},
-  {"uid",               P_STRING, P_LOCAL, &sDefault.uid,               NULL,0},
-+ {"unique id method",  P_STRING, P_LOCAL, &sDefault.unique_id_method,  NULL,0},
-  {"use chroot",        P_BOOL,   P_LOCAL, &sDefault.use_chroot,        NULL,0},
-  {"write only",        P_BOOL,   P_LOCAL, &sDefault.write_only,        NULL,0},
-  {NULL,                P_BOOL,   P_NONE,  NULL,                        NULL,0}
-@@ -390,9 +429,16 @@ FN_GLOBAL_INTEGER(lp_rsync_port, &Global
- FN_LOCAL_STRING(lp_auth_users, auth_users)
- FN_LOCAL_STRING(lp_comment, comment)
-+FN_LOCAL_STRING(lp_custom_unique_id_select,custom_unique_id_select)
-+FN_LOCAL_STRING(lp_database_datasource, database_datasource)
-+FN_LOCAL_STRING(lp_database_password, database_password)
-+FN_LOCAL_STRING(lp_database_username, database_username)
-+FN_LOCAL_STRING(lp_delete_table_name,delete_table_name)
- FN_LOCAL_STRING(lp_dont_compress, dont_compress)
-+FN_LOCAL_STRING(lp_error_table_name,error_table_name)
- FN_LOCAL_STRING(lp_exclude, exclude)
- FN_LOCAL_STRING(lp_exclude_from, exclude_from)
-+FN_LOCAL_STRING(lp_exit_table_name, exit_table_name)
- FN_LOCAL_STRING(lp_filter, filter)
- FN_LOCAL_STRING(lp_gid, gid)
- FN_LOCAL_STRING(lp_hosts_allow, hosts_allow)
-@@ -410,15 +456,21 @@ FN_LOCAL_STRING(lp_postxfer_exec, postxf
- FN_LOCAL_STRING(lp_prexfer_exec, prexfer_exec)
- FN_LOCAL_STRING(lp_refuse_options, refuse_options)
- FN_LOCAL_STRING(lp_secrets_file, secrets_file)
-+FN_LOCAL_STRING(lp_sequence_name,sequence_name)
-+FN_LOCAL_STRING(lp_session_table_name,session_table_name)
- FN_LOCAL_INTEGER(lp_syslog_facility, syslog_facility)
- FN_LOCAL_STRING(lp_temp_dir, temp_dir)
-+FN_LOCAL_STRING(lp_transfer_table_name, transfer_table_name)
- FN_LOCAL_STRING(lp_uid, uid)
-+FN_LOCAL_STRING(lp_unique_id_method,unique_id_method)
- FN_LOCAL_INTEGER(lp_max_connections, max_connections)
- FN_LOCAL_INTEGER(lp_max_verbosity, max_verbosity)
- FN_LOCAL_INTEGER(lp_timeout, timeout)
-+FN_LOCAL_BOOL(lp_database_logging, database_logging)
- FN_LOCAL_BOOL(lp_fake_super, fake_super)
-+FN_LOCAL_BOOL(lp_get_custom_id_before_insert,get_custom_id_before_insert)
- FN_LOCAL_BOOL(lp_ignore_errors, ignore_errors)
- FN_LOCAL_BOOL(lp_ignore_nonreadable, ignore_nonreadable)
- FN_LOCAL_BOOL(lp_list, list)
---- old/log.c
-+++ new/log.c
-@@ -97,7 +97,7 @@ struct {
- /*
-  * Map from rsync error code to name, or return NULL.
-  */
--static char const *rerr_name(int code)
-+char const *rerr_name(int code)
- {
-       int i;
-       for (i = 0; rerr_names[i].name; i++) {
---- old/receiver.c
-+++ new/receiver.c
-@@ -111,6 +111,10 @@ int get_tmpname(char *fnametmp, const ch
-       if (maxname < 1) {
-               rprintf(FERROR, "temporary filename too long: %s\n", fname);
-+#ifdef HAVE_LIBODBC
-+              db_log_error(FERROR,13, "temporary filename too long: %s\n",
-+                      fname);
-+#endif
-               fnametmp[0] = '\0';
-               return 0;
-       }
-@@ -155,6 +159,9 @@ int open_tmpfile(char *fnametmp, const c
-       if (fd == -1) {
-               rsyserr(FERROR, errno, "mkstemp %s failed",
-                       full_fname(fnametmp));
-+#ifdef HAVE_LIBODBC
-+              db_log_error(FERROR, 22, "mkstemp %s failed", full_fname(fnametmp));
-+#endif
-               return -1;
-       }
-@@ -213,6 +220,10 @@ static int receive_data(int f_in, char *
-               if (fd != -1 && (j = do_lseek(fd, offset, SEEK_SET)) != offset) {
-                       rsyserr(FERROR, errno, "lseek of %s returned %.0f, not %.0f",
-                               full_fname(fname), (double)j, (double)offset);
-+#ifdef HAVE_LIBODBC
-+                      db_log_error(FERROR, 14, "lseek failed on %s",
-+                              full_fname(fname));
-+#endif
-                       exit_cleanup(RERR_FILEIO);
-               }
-       }
-@@ -270,6 +281,11 @@ static int receive_data(int f_in, char *
-                                               "lseek of %s returned %.0f, not %.0f",
-                                               full_fname(fname),
-                                               (double)pos, (double)offset);
-+#ifdef HAVE_LIBODBC
-+                                      db_log_error(FERROR, 14,
-+                                              "lseek failed on %s",
-+                                              full_fname(fname));
-+#endif
-                                       exit_cleanup(RERR_FILEIO);
-                               }
-                               continue;
-@@ -295,6 +311,9 @@ static int receive_data(int f_in, char *
-           report_write_error:
-               rsyserr(FERROR, errno, "write failed on %s",
-                       full_fname(fname));
-+#ifdef HAVE_LIBODBC
-+              db_log_error(FERROR, 15, "write failed on %s",full_fname(fname));
-+#endif
-               exit_cleanup(RERR_FILEIO);
-       }
-@@ -338,6 +357,12 @@ static void handle_delayed_updates(char 
-                               rsyserr(FERROR, errno,
-                                       "rename failed for %s (from %s)",
-                                       full_fname(fname), partialptr);
-+#ifdef HAVE_LIBODBC
-+                              db_log_error(FERROR, 16,
-+                                      "rename failed for %s (from %s)",
-+                                      full_fname(fname),
-+                                      partialptr);
-+#endif
-                       } else {
-                               if (remove_source_files
-                                || (preserve_hard_links && F_IS_HLINKED(file)))
-@@ -489,6 +514,9 @@ int recv_files(int f_in, char *local_nam
-               if (server_filter_list.head
-                   && check_filter(&server_filter_list, fname, 0) < 0) {
-                       rprintf(FERROR, "attempt to hack rsync failed.\n");
-+#ifdef HAVE_LIBODBC
-+                      db_log_error(FERROR,17,"attempt to hack rsync failed.");
-+#endif
-                       exit_cleanup(RERR_PROTOCOL);
-               }
-@@ -545,6 +573,11 @@ int recv_files(int f_in, char *local_nam
-                                       rprintf(FERROR,
-                                               "invalid basis_dir index: %d.\n",
-                                               fnamecmp_type);
-+#ifdef HAVE_LIBODBC
-+                                      db_log_error(FERROR, 18,
-+                                              "invalid basis_dir index: %d.\n",
-+                                              fnamecmp_type);
-+#endif
-                                       exit_cleanup(RERR_PROTOCOL);
-                               }
-                               pathjoin(fnamecmpbuf, sizeof fnamecmpbuf,
-@@ -594,6 +627,9 @@ int recv_files(int f_in, char *local_nam
-               } else if (do_fstat(fd1,&st) != 0) {
-                       rsyserr(FERROR, errno, "fstat %s failed",
-                               full_fname(fnamecmp));
-+#ifdef HAVE_LIBODBC
-+                      db_log_error(FERROR, 19,"fstat %s failed",full_fname(fnamecmp));
-+#endif
-                       discard_receive_data(f_in, F_LENGTH(file));
-                       close(fd1);
-                       if (inc_recurse)
-@@ -609,6 +645,9 @@ int recv_files(int f_in, char *local_nam
-                        */
-                       rprintf(FERROR,"recv_files: %s is a directory\n",
-                               full_fname(fnamecmp));
-+#ifdef HAVE_LIBODBC
-+                      db_log_error(FERROR,20,"recv_files: %s is a directory",full_fname(fnamecmp));
-+#endif
-                       discard_receive_data(f_in, F_LENGTH(file));
-                       close(fd1);
-                       if (inc_recurse)
-@@ -643,6 +682,9 @@ int recv_files(int f_in, char *local_nam
-                       if (fd2 == -1) {
-                               rsyserr(FERROR, errno, "open %s failed",
-                                       full_fname(fname));
-+#ifdef HAVE_LIBODBC
-+                              db_log_error(FERROR,22, "open %s failed", full_fname(fname));
-+#endif
-                       }
-               } else {
-                       fd2 = open_tmpfile(fnametmp, fname, file);
-@@ -670,12 +712,19 @@ int recv_files(int f_in, char *local_nam
-                                      fname, fd2, F_LENGTH(file));
-               log_item(log_code, file, &initial_stats, iflags, NULL);
-+#ifdef HAVE_LIBODBC
-+              db_log_transfer(file, &initial_stats, "receive");
-+#endif
-               if (fd1 != -1)
-                       close(fd1);
-               if (close(fd2) < 0) {
-                       rsyserr(FERROR, errno, "close failed on %s",
-                               full_fname(fnametmp));
-+#ifdef HAVE_LIBODBC
-+                      db_log_error(FERROR, 23, "close failed on %s",
-+                              full_fname(fnametmp));
-+#endif
-                       exit_cleanup(RERR_FILEIO);
-               }
-@@ -732,6 +781,12 @@ int recv_files(int f_in, char *local_nam
-                               rprintf(msgtype,
-                                       "%s: %s failed verification -- update %s%s.\n",
-                                       errstr, fname, keptstr, redostr);
-+#ifdef HAVE_LIBODBC
-+                              db_log_error(msgtype,24,
-+                                      "%s: %s failed verification -- update %s%s.\n",
-+                                      errstr, fname,
-+                                      keptstr, redostr);
-+#endif
-                       }
-                       if (!redoing) {
-                               send_msg_int(MSG_REDO, ndx);
---- old/sender.c
-+++ new/sender.c
-@@ -344,6 +344,9 @@ void send_files(int f_in, int f_out)
-                       end_progress(st.st_size);
-               log_item(log_code, file, &initial_stats, iflags, NULL);
-+#ifdef HAVE_LIBODBC
-+              db_log_transfer(file, &initial_stats,"send");
-+#endif
-               if (mbuf) {
-                       j = unmap_file(mbuf);
index 41ecca2..d1f8cd3 100644 (file)
--- a/acls.diff
+++ b/acls.diff
@@ -9,8 +9,9 @@ To use this patch, run these commands for a successful build:
     ./configure                         (optional if already run)
     make
 
---- old/acls.c
-+++ new/acls.c
+diff --git a/acls.c b/acls.c
+--- a/acls.c
++++ b/acls.c
 @@ -31,6 +31,7 @@ extern int list_only;
  extern int orig_umask;
  extern int numeric_ids;
@@ -19,7 +20,7 @@ To use this patch, run these commands for a successful build:
  
  /* Flags used to indicate what items are being transmitted for an entry. */
  #define XMIT_USER_OBJ (1<<0)
-@@ -97,6 +98,18 @@ static const char *str_acl_type(SMB_ACL_
+@@ -97,6 +98,18 @@ static const char *str_acl_type(SMB_ACL_TYPE_T type)
             : "unknown SMB_ACL_TYPE_T";
  }
  
@@ -38,7 +39,7 @@ To use this patch, run these commands for a successful build:
  static int calc_sacl_entries(const rsync_acl *racl)
  {
        /* A System ACL always gets user/group/other permission entries. */
-@@ -545,6 +558,96 @@ int get_acl(const char *fname, stat_x *s
+@@ -544,6 +557,96 @@ int get_acl(const char *fname, stat_x *sxp)
        return 0;
  }
  
@@ -135,7 +136,7 @@ To use this patch, run these commands for a successful build:
  /* === Send functions === */
  
  /* Send the ida list over the file descriptor. */
-@@ -620,6 +723,11 @@ static void send_rsync_acl(rsync_acl *ra
+@@ -619,6 +722,11 @@ static void send_rsync_acl(rsync_acl *racl, SMB_ACL_TYPE_T type,
   * This also frees the ACL data. */
  void send_acl(stat_x *sxp, int f)
  {
@@ -147,7 +148,7 @@ To use this patch, run these commands for a successful build:
        if (!sxp->acc_acl) {
                sxp->acc_acl = create_racl();
                rsync_acl_fake_perms(sxp->acc_acl, sxp->st.st_mode);
-@@ -637,6 +745,160 @@ void send_acl(stat_x *sxp, int f)
+@@ -636,6 +744,160 @@ void send_acl(stat_x *sxp, int f)
        }
  }
  
@@ -308,7 +309,7 @@ To use this patch, run these commands for a successful build:
  /* === Receive functions === */
  
  static uint32 recv_acl_access(uchar *name_follows_ptr, int f)
-@@ -759,6 +1021,11 @@ static int recv_rsync_acl(item_list *rac
+@@ -758,6 +1020,11 @@ static int recv_rsync_acl(item_list *racl_list, SMB_ACL_TYPE_T type, int f)
  /* Receive the ACL info the sender has included for this file-list entry. */
  void receive_acl(struct file_struct *file, int f)
  {
@@ -320,9 +321,10 @@ To use this patch, run these commands for a successful build:
        F_ACL(file) = recv_rsync_acl(&access_acl_list, SMB_ACL_TYPE_ACCESS, f);
  
        if (S_ISDIR(file->mode))
---- old/compat.c
-+++ new/compat.c
-@@ -160,13 +160,6 @@ void setup_protocol(int f_out,int f_in)
+diff --git a/compat.c b/compat.c
+--- a/compat.c
++++ b/compat.c
+@@ -175,13 +175,6 @@ void setup_protocol(int f_out,int f_in)
        if (protocol_version < 30) {
                if (append_mode == 1)
                        append_mode = 2;
index 9e29f35..c79da0a 100644 (file)
@@ -24,8 +24,9 @@ Todo:
 Fix a bug that could lose some bits when stripping some (supposedly)
 superfluous ACL info.
 
---- old/lib/sysacls.c
-+++ new/lib/sysacls.c
+diff --git a/lib/sysacls.c b/lib/sysacls.c
+--- a/lib/sysacls.c
++++ b/lib/sysacls.c
 @@ -30,6 +30,18 @@
  #endif
  #define DEBUG(x,y)
@@ -45,7 +46,7 @@ superfluous ACL info.
  void SAFE_FREE(void *mem)
  {
        if (mem)
-@@ -99,6 +111,9 @@ int sys_acl_get_info(SMB_ACL_ENTRY_T ent
+@@ -99,6 +111,9 @@ int sys_acl_get_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T *tag_type_p, uint32 *b
                return -1;
  
        *bits_p = (acl_get_perm(permset, ACL_READ) ? 4 : 0)
@@ -55,7 +56,7 @@ superfluous ACL info.
                | (acl_get_perm(permset, ACL_WRITE) ? 2 : 0)
                | (acl_get_perm(permset, ACL_EXECUTE) ? 1 : 0);
  
-@@ -143,6 +158,12 @@ int sys_acl_set_access_bits(SMB_ACL_ENTR
+@@ -143,6 +158,12 @@ int sys_acl_set_access_bits(SMB_ACL_ENTRY_T entry, uint32 bits)
        if ((rc = acl_get_permset(entry, &permset)) != 0)
                return rc;
        acl_clear_perms(permset);
@@ -68,8 +69,9 @@ superfluous ACL info.
        if (bits & 4)
                acl_add_perm(permset, ACL_READ);
        if (bits & 2)
---- old/lib/sysacls.h
-+++ new/lib/sysacls.h
+diff --git a/lib/sysacls.h b/lib/sysacls.h
+--- a/lib/sysacls.h
++++ b/lib/sysacls.h
 @@ -58,8 +58,8 @@
  #define SMB_ACL_TYPE_ACCESS   ACL_TYPE_ACCESS
  #define SMB_ACL_TYPE_DEFAULT  ACL_TYPE_DEFAULT
index 9e811d9..353a9e3 100644 (file)
@@ -7,8 +7,9 @@ To use this patch, run these commands for a successful build:
 
 TODO:  need to fix this to handle 64-bit time_t values!
 
---- old/compat.c
-+++ new/compat.c
+diff --git a/compat.c b/compat.c
+--- a/compat.c
++++ b/compat.c
 @@ -44,6 +44,7 @@ extern int protocol_version;
  extern int protect_args;
  extern int preserve_uid;
@@ -35,8 +36,9 @@ TODO:  need to fix this to handle 64-bit time_t values!
        if (preserve_acls && !am_sender)
                acls_ndx = ++file_extra_cnt;
        if (preserve_xattrs)
---- old/flist.c
-+++ new/flist.c
+diff --git a/flist.c b/flist.c
+--- a/flist.c
++++ b/flist.c
 @@ -53,6 +53,7 @@ extern int preserve_specials;
  extern int uid_ndx;
  extern int gid_ndx;
@@ -45,7 +47,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  extern int relative_paths;
  extern int implied_dirs;
  extern int file_extra_cnt;
-@@ -338,6 +339,7 @@ int push_pathname(const char *dir, int l
+@@ -344,6 +345,7 @@ int push_pathname(const char *dir, int len)
  static void send_file_entry(int f, struct file_struct *file, int ndx, int first_ndx)
  {
        static time_t modtime;
@@ -53,7 +55,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
        static mode_t mode;
  #ifdef SUPPORT_HARD_LINKS
        static int64 dev;
-@@ -444,6 +446,13 @@ static void send_file_entry(int f, struc
+@@ -450,6 +452,13 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_
                xflags |= XMIT_SAME_TIME;
        else
                modtime = file->modtime;
@@ -67,7 +69,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  
  #ifdef SUPPORT_HARD_LINKS
        if (tmp_dev != 0) {
-@@ -517,6 +526,8 @@ static void send_file_entry(int f, struc
+@@ -523,6 +532,8 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_
        }
        if (!(xflags & XMIT_SAME_MODE))
                write_int(f, to_wire_mode(mode));
@@ -76,7 +78,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
        if (uid_ndx && !(xflags & XMIT_SAME_UID)) {
                if (protocol_version < 30)
                        write_int(f, uid);
-@@ -603,7 +614,7 @@ static void send_file_entry(int f, struc
+@@ -609,7 +620,7 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_
  static struct file_struct *recv_file_entry(struct file_list *flist,
                                           int xflags, int f)
  {
@@ -85,7 +87,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
        static mode_t mode;
  #ifdef SUPPORT_HARD_LINKS
        static int64 dev;
-@@ -736,6 +747,16 @@ static struct file_struct *recv_file_ent
+@@ -742,6 +753,16 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
        }
        if (!(xflags & XMIT_SAME_MODE))
                mode = from_wire_mode(read_int(f));
@@ -93,7 +95,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
 +              atime = read_varlong(f, 4);
 +#if SIZEOF_TIME_T < SIZEOF_INT64
 +              if ((atime > INT_MAX || atime < INT_MIN) && !am_generator) {
-+                      rprintf(FERROR,
++                      rprintf(FERROR_XFER,
 +                              "Access time value of %s truncated on receiver.\n",
 +                              lastname);
 +              }
@@ -102,7 +104,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  
        if (chmod_modes && !S_ISLNK(mode))
                mode = tweak_mode(mode, chmod_modes);
-@@ -864,6 +885,8 @@ static struct file_struct *recv_file_ent
+@@ -872,6 +893,8 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
                F_GROUP(file) = gid;
                file->flags |= gid_flags;
        }
@@ -111,7 +113,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
        if (unsort_ndx)
                F_NDX(file) = flist->used + flist->ndx_start;
  
-@@ -1186,6 +1209,8 @@ struct file_struct *make_file(const char
+@@ -1200,6 +1223,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
                F_OWNER(file) = st.st_uid;
        if (gid_ndx)
                F_GROUP(file) = st.st_gid;
@@ -120,8 +122,9 @@ TODO:  need to fix this to handle 64-bit time_t values!
  
        if (basename != thisname)
                file->dirname = lastdir;
---- old/generator.c
-+++ new/generator.c
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
 @@ -43,6 +43,7 @@ extern int preserve_specials;
  extern int preserve_hard_links;
  extern int preserve_perms;
@@ -130,7 +133,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  extern int uid_ndx;
  extern int gid_ndx;
  extern int delete_mode;
-@@ -568,6 +569,9 @@ void itemize(const char *fnamecmp, struc
+@@ -568,6 +569,9 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
                  && (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
                 || (keep_time && cmp_time(file->modtime, sxp->st.st_mtime) != 0))
                        iflags |= ITEM_REPORT_TIME;
@@ -140,7 +143,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  #if !defined HAVE_LCHMOD && !defined HAVE_SETATTRLIST
                if (S_ISLNK(file->mode)) {
                        ;
-@@ -923,6 +927,8 @@ static int try_dests_reg(struct file_str
+@@ -923,6 +927,8 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
                if (link_dest) {
                        if (!hard_link_one(file, fname, cmpbuf, 1))
                                goto try_a_copy;
@@ -149,7 +152,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
                        if (preserve_hard_links && F_IS_HLINKED(file))
                                finish_hard_link(file, fname, ndx, &sxp->st, itemizing, code, j);
                        if (itemizing && (verbose > 1 || stdout_format_has_i > 1)) {
-@@ -1113,6 +1119,7 @@ static int try_dests_non(struct file_str
+@@ -1113,6 +1119,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
  static void list_file_entry(struct file_struct *f)
  {
        char permbuf[PERMSTRING_SIZE];
@@ -157,7 +160,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
        double len;
  
        if (!F_IS_ACTIVE(f)) {
-@@ -1127,14 +1134,16 @@ static void list_file_entry(struct file_
+@@ -1127,14 +1134,16 @@ static void list_file_entry(struct file_struct *f)
  
  #ifdef SUPPORT_LINKS
        if (preserve_links && S_ISLNK(f->mode)) {
@@ -176,7 +179,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
                        f_name(f, NULL));
        }
  }
-@@ -1884,7 +1893,7 @@ static void touch_up_dirs(struct file_li
+@@ -1884,7 +1893,7 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
                if (!(file->mode & S_IWUSR))
                        do_chmod(fname, file->mode);
                if (need_retouch_dir_times)
@@ -185,9 +188,10 @@ TODO:  need to fix this to handle 64-bit time_t values!
                if (allowed_lull && !(counter % lull_mod))
                        maybe_send_keepalive();
                else if (!(counter & 0xFF))
---- old/log.c
-+++ new/log.c
-@@ -631,7 +631,8 @@ static void log_formatted(enum logcode c
+diff --git a/log.c b/log.c
+--- a/log.c
++++ b/log.c
+@@ -642,7 +642,8 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
                        c[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
                        c[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
                        c[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
@@ -197,8 +201,9 @@ TODO:  need to fix this to handle 64-bit time_t values!
                        c[9] = !(iflags & ITEM_REPORT_ACL) ? '.' : 'a';
                        c[10] = !(iflags & ITEM_REPORT_XATTR) ? '.' : 'x';
                        c[11] = '\0';
---- old/options.c
-+++ new/options.c
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
 @@ -57,6 +57,7 @@ int preserve_specials = 0;
  int preserve_uid = 0;
  int preserve_gid = 0;
@@ -207,7 +212,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  int update_only = 0;
  int cvs_exclude = 0;
  int dry_run = 0;
-@@ -346,6 +347,7 @@ void usage(enum logcode F)
+@@ -347,6 +348,7 @@ void usage(enum logcode F)
    rprintf(F," -D                          same as --devices --specials\n");
    rprintf(F," -t, --times                 preserve modification times\n");
    rprintf(F," -O, --omit-dir-times        omit directories from --times\n");
@@ -215,7 +220,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
    rprintf(F,"     --super                 receiver attempts super-user activities\n");
  #ifdef SUPPORT_XATTRS
    rprintf(F,"     --fake-super            store/recover privileged attrs using xattrs\n");
-@@ -480,6 +482,9 @@ static struct poptOption long_options[] 
+@@ -482,6 +484,9 @@ static struct poptOption long_options[] = {
    {"times",           't', POPT_ARG_VAL,    &preserve_times, 2, 0, 0 },
    {"no-times",         0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
    {"no-t",             0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
@@ -225,7 +230,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
    {"omit-dir-times",  'O', POPT_ARG_VAL,    &omit_dir_times, 1, 0, 0 },
    {"no-omit-dir-times",0,  POPT_ARG_VAL,    &omit_dir_times, 0, 0, 0 },
    {"no-O",             0,  POPT_ARG_VAL,    &omit_dir_times, 0, 0, 0 },
-@@ -1713,6 +1718,8 @@ void server_options(char **args, int *ar
+@@ -1716,6 +1721,8 @@ void server_options(char **args, int *argc_p)
                argstr[x++] = 'D';
        if (preserve_times)
                argstr[x++] = 't';
@@ -234,8 +239,9 @@ TODO:  need to fix this to handle 64-bit time_t values!
        if (preserve_perms)
                argstr[x++] = 'p';
        else if (preserve_executability && am_sender)
---- old/rsync.c
-+++ new/rsync.c
+diff --git a/rsync.c b/rsync.c
+--- a/rsync.c
++++ b/rsync.c
 @@ -33,6 +33,7 @@ extern int preserve_acls;
  extern int preserve_xattrs;
  extern int preserve_perms;
@@ -244,7 +250,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  extern int preserve_times;
  extern int am_root;
  extern int am_server;
-@@ -343,6 +344,7 @@ int set_file_attrs(const char *fname, st
+@@ -343,6 +344,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
        int updated = 0;
        stat_x sx2;
        int change_uid, change_gid;
@@ -252,8 +258,8 @@ TODO:  need to fix this to handle 64-bit time_t values!
        mode_t new_mode = file->mode;
        int inherit;
  
-@@ -383,18 +385,36 @@ int set_file_attrs(const char *fname, st
-               set_stat_xattr(fname, file);
+@@ -386,18 +388,36 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+               set_xattr(fname, file, fnamecmp, sxp);
  #endif
  
 +      /* This code must be the first update in the function due to
@@ -281,7 +287,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
 +      if (updated) {
 +              int ret = set_times(fname, mtime, atime, sxp->st.st_mode);
                if (ret < 0) {
-                       rsyserr(FERROR, errno, "failed to set times on %s",
+                       rsyserr(FERROR_XFER, errno, "failed to set times on %s",
                                full_fname(fname));
                        goto cleanup;
                }
@@ -292,9 +298,10 @@ TODO:  need to fix this to handle 64-bit time_t values!
        }
  
        change_uid = am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file);
---- old/rsync.h
-+++ new/rsync.h
-@@ -57,6 +57,7 @@
+diff --git a/rsync.h b/rsync.h
+--- a/rsync.h
++++ b/rsync.h
+@@ -60,6 +60,7 @@
  #define XMIT_RDEV_MINOR_8_pre30 (1<<11)       /* protocols 28 - 29  */
  #define XMIT_GROUP_NAME_FOLLOWS (1<<11) /* protocols 30 - now */
  #define XMIT_HLINK_FIRST (1<<12)      /* protocols 30 - now (HLINKED files only) */
@@ -302,7 +309,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  
  /* These flags are used in the live flist data. */
  
-@@ -145,6 +146,7 @@
+@@ -148,6 +149,7 @@
  
  #define ATTRS_REPORT          (1<<0)
  #define ATTRS_SKIP_MTIME      (1<<1)
@@ -310,7 +317,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  
  #define FULL_FLUSH    1
  #define NORMAL_FLUSH  0
-@@ -608,6 +610,7 @@ extern int file_extra_cnt;
+@@ -618,6 +620,7 @@ extern int file_extra_cnt;
  extern int inc_recurse;
  extern int uid_ndx;
  extern int gid_ndx;
@@ -318,7 +325,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  extern int acls_ndx;
  extern int xattrs_ndx;
  
-@@ -645,6 +648,7 @@ extern int xattrs_ndx;
+@@ -655,6 +658,7 @@ extern int xattrs_ndx;
  /* When the associated option is on, all entries will have these present: */
  #define F_OWNER(f) REQ_EXTRA(f, uid_ndx)->unum
  #define F_GROUP(f) REQ_EXTRA(f, gid_ndx)->unum
@@ -326,9 +333,10 @@ TODO:  need to fix this to handle 64-bit time_t values!
  #define F_ACL(f) REQ_EXTRA(f, acls_ndx)->num
  #define F_XATTR(f) REQ_EXTRA(f, xattrs_ndx)->num
  #define F_NDX(f) REQ_EXTRA(f, unsort_ndx)->num
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -349,6 +349,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -349,6 +349,7 @@ to the detailed description below for a complete description.  verb(
   -D                          same as --devices --specials
   -t, --times                 preserve modification times
   -O, --omit-dir-times        omit directories from --times
@@ -336,7 +344,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
       --super                 receiver attempts super-user activities
       --fake-super            store/recover privileged attrs using xattrs
   -S, --sparse                handle sparse files efficiently
-@@ -973,6 +974,12 @@ it is preserving modification times (see
+@@ -974,6 +975,12 @@ it is preserving modification times (see bf(--times)).  If NFS is sharing
  the directories on the receiving side, it is a good idea to use bf(-O).
  This option is inferred if you use bf(--backup) without bf(--backup-dir).
  
@@ -349,7 +357,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  dit(bf(--super)) This tells the receiving side to attempt super-user
  activities even if the receiving rsync wasn't run by the super-user.  These
  activities include: preserving users via the bf(--owner) option, preserving
-@@ -1654,8 +1661,10 @@ quote(itemization(
+@@ -1671,8 +1678,10 @@ quote(itemization(
    sender's value (requires bf(--owner) and super-user privileges).
    it() A bf(g) means the group is different and is being updated to the
    sender's value (requires bf(--group) and the authority to set the group).
@@ -362,8 +370,9 @@ TODO:  need to fix this to handle 64-bit time_t values!
    it() The bf(a) means that the ACL information changed.
    it() The bf(x) slot is reserved for reporting extended attribute changes
    (a feature that is not yet released).
---- old/sender.c
-+++ new/sender.c
+diff --git a/sender.c b/sender.c
+--- a/sender.c
++++ b/sender.c
 @@ -43,6 +43,7 @@ extern int do_progress;
  extern int inplace;
  extern int batch_fd;
@@ -372,8 +381,10 @@ TODO:  need to fix this to handle 64-bit time_t values!
  extern struct stats stats;
  extern struct file_list *cur_flist, *first_flist, *dir_flist;
  
---- old/testsuite/atimes.test
-+++ new/testsuite/atimes.test
+diff --git a/testsuite/atimes.test b/testsuite/atimes.test
+new file mode 100644
+--- /dev/null
++++ b/testsuite/atimes.test
 @@ -0,0 +1,19 @@
 +#! /bin/sh
 +
@@ -394,8 +405,9 @@ TODO:  need to fix this to handle 64-bit time_t values!
 +
 +# The script would have aborted on error, so getting here means we've won.
 +exit 0
---- old/testsuite/rsync.fns
-+++ new/testsuite/rsync.fns
+diff --git a/testsuite/rsync.fns b/testsuite/rsync.fns
+--- a/testsuite/rsync.fns
++++ b/testsuite/rsync.fns
 @@ -187,6 +187,10 @@ checkit() {
      # We can just write everything to stdout/stderr, because the
      # wrapper hides it unless there is a problem.
@@ -422,9 +434,10 @@ TODO:  need to fix this to handle 64-bit time_t values!
      ( cd "$3" && rsync_ls_lR . ) > "$tmpdir/ls-to"
      diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed=YES
  
---- old/tls.c
-+++ new/tls.c
-@@ -104,6 +104,8 @@ static int stat_xattr(const char *fname,
+diff --git a/tls.c b/tls.c
+--- a/tls.c
++++ b/tls.c
+@@ -104,6 +104,8 @@ static int stat_xattr(const char *fname, STRUCT_STAT *fst)
  
  #endif
  
@@ -433,7 +446,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  static void failed(char const *what, char const *where)
  {
        fprintf(stderr, PROGRAM ": %s %s: %s\n",
-@@ -111,12 +113,29 @@ static void failed(char const *what, cha
+@@ -111,12 +113,29 @@ static void failed(char const *what, char const *where)
        exit(1);
  }
  
@@ -513,9 +526,10 @@ TODO:  need to fix this to handle 64-bit time_t values!
  #ifdef SUPPORT_XATTRS
    fprintf(F," -f, --fake-super            display attributes including fake-super xattrs\n");
  #endif
---- old/util.c
-+++ new/util.c
-@@ -122,7 +122,7 @@ NORETURN void overflow_exit(const char *
+diff --git a/util.c b/util.c
+--- a/util.c
++++ b/util.c
+@@ -122,7 +122,7 @@ NORETURN void overflow_exit(const char *str)
        exit_cleanup(RERR_MALLOC);
  }
  
@@ -524,7 +538,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
  {
  #if !defined HAVE_LUTIMES || !defined HAVE_UTIMES
        if (S_ISLNK(mode))
-@@ -130,9 +130,13 @@ int set_modtime(const char *fname, time_
+@@ -130,9 +130,13 @@ int set_modtime(const char *fname, time_t modtime, mode_t mode)
  #endif
  
        if (verbose > 2) {
@@ -540,7 +554,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
        }
  
        if (dry_run)
-@@ -141,7 +145,7 @@ int set_modtime(const char *fname, time_
+@@ -141,7 +145,7 @@ int set_modtime(const char *fname, time_t modtime, mode_t mode)
        {
  #ifdef HAVE_UTIMES
                struct timeval t[2];
@@ -549,7 +563,7 @@ TODO:  need to fix this to handle 64-bit time_t values!
                t[0].tv_usec = 0;
                t[1].tv_sec = modtime;
                t[1].tv_usec = 0;
-@@ -154,12 +158,12 @@ int set_modtime(const char *fname, time_
+@@ -154,12 +158,12 @@ int set_modtime(const char *fname, time_t modtime, mode_t mode)
                return utimes(fname, t);
  #elif defined HAVE_STRUCT_UTIMBUF
                struct utimbuf tbuf;
index a724472..64c2f5e 100644 (file)
@@ -19,8 +19,9 @@ To use this patch, run these commands for a successful build:
     ./configure                                 (optional if already run)
     make
 
---- old/backup.c
-+++ new/backup.c
+diff --git a/backup.c b/backup.c
+--- a/backup.c
++++ b/backup.c
 @@ -29,10 +29,17 @@ extern int preserve_specials;
  extern int preserve_links;
  extern int safe_symlinks;
@@ -78,7 +79,7 @@ To use this patch, run these commands for a successful build:
        stat_x sx;
  
        while (*fullpath == '.' && fullpath[1] == '/') {
-@@ -211,7 +235,8 @@ static int keep_backup(const char *fname
+@@ -211,7 +235,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 */
  
@@ -102,9 +103,10 @@ To use this patch, run these commands for a successful build:
 +      deleting = 0;
 +      return ret;
 +}
---- old/generator.c
-+++ new/generator.c
-@@ -93,6 +93,9 @@ extern mode_t orig_umask;
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
+@@ -94,6 +94,9 @@ extern mode_t orig_umask;
  extern char *backup_dir;
  extern char *backup_suffix;
  extern int backup_suffix_len;
@@ -113,8 +115,8 @@ To use this patch, run these commands for a successful build:
 +extern int backup_suffix_dels_len;
  extern struct file_list *cur_flist, *first_flist, *dir_flist;
  extern struct filter_list_struct server_filter_list;
- #ifdef ICONV_OPTION
-@@ -130,10 +133,14 @@ enum delret {
+@@ -128,10 +131,14 @@ enum delret {
  static enum delret delete_dir_contents(char *fname, int flags);
  
  
@@ -130,7 +132,7 @@ To use this patch, run these commands for a successful build:
  }
  
  /* Delete a file or directory.  If DEL_RECURSE is set in the flags, this will
-@@ -169,9 +176,9 @@ static enum delret delete_item(char *fbu
+@@ -167,9 +174,9 @@ static enum delret delete_item(char *fbuf, int mode, char *replace, int flags)
        if (S_ISDIR(mode)) {
                what = "rmdir";
                ok = do_rmdir(fbuf) == 0;
@@ -142,9 +144,10 @@ To use this patch, run these commands for a successful build:
        } else {
                what = "unlink";
                ok = robust_unlink(fbuf) == 0;
---- old/options.c
-+++ new/options.c
-@@ -147,10 +147,14 @@ int no_detach
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -148,10 +148,14 @@ int no_detach
  int write_batch = 0;
  int read_batch = 0;
  int backup_dir_len = 0;
@@ -159,7 +162,7 @@ To use this patch, run these commands for a successful build:
  char *tmpdir = NULL;
  char *partial_dir = NULL;
  char *basis_dir[MAX_BASIS_DIRS+1];
-@@ -162,7 +166,9 @@ char *stdout_format = NULL;
+@@ -163,7 +167,9 @@ char *stdout_format = NULL;
  char *password_file = NULL;
  char *rsync_path = RSYNC_PATH;
  char *backup_dir = NULL;
@@ -169,7 +172,7 @@ To use this patch, run these commands for a successful build:
  char *sockopts = NULL;
  int rsync_port = 0;
  int compare_dest = 0;
-@@ -318,6 +324,8 @@ void usage(enum logcode F)
+@@ -319,6 +325,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);
@@ -178,7 +181,7 @@ To use this patch, run these commands for a successful build:
    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");
-@@ -588,7 +596,9 @@ static struct poptOption long_options[] 
+@@ -590,7 +598,9 @@ static struct poptOption long_options[] = {
    {"backup",          'b', POPT_ARG_VAL,    &make_backups, 1, 0, 0 },
    {"no-backup",        0,  POPT_ARG_VAL,    &make_backups, 0, 0, 0 },
    {"backup-dir",       0,  POPT_ARG_STRING, &backup_dir, 0, 0, 0 },
@@ -188,16 +191,16 @@ To use this patch, run these commands for a successful build:
    {"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 },
-@@ -1400,6 +1410,8 @@ int parse_arguments(int *argc_p, const c
-                       tmpdir = sanitize_path(NULL, tmpdir, NULL, 0, NULL);
+@@ -1402,6 +1412,8 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
+                       tmpdir = sanitize_path(NULL, tmpdir, NULL, 0);
                if (backup_dir)
-                       backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, NULL);
+                       backup_dir = sanitize_path(NULL, backup_dir, NULL, 0);
 +              if (backup_dir_dels)
-+                      backup_dir_dels = sanitize_path(NULL, backup_dir_dels, NULL, 0, NULL);
++                      backup_dir_dels = sanitize_path(NULL, backup_dir_dels, NULL, 0);
        }
        if (server_filter_list.head && !am_sender) {
                struct filter_list_struct *elp = &server_filter_list;
-@@ -1417,6 +1429,14 @@ int parse_arguments(int *argc_p, const c
+@@ -1419,6 +1431,14 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                        if (check_filter(elp, backup_dir, 1) < 0)
                                goto options_rejected;
                }
@@ -212,7 +215,7 @@ To use this patch, run these commands for a successful build:
        }
  
        if (!backup_suffix)
-@@ -1428,6 +1448,16 @@ int parse_arguments(int *argc_p, const c
+@@ -1430,6 +1450,16 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                        backup_suffix);
                return 0;
        }
@@ -229,7 +232,7 @@ To use this patch, run these commands for a successful build:
        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;
-@@ -1451,6 +1481,31 @@ int parse_arguments(int *argc_p, const c
+@@ -1453,6 +1483,31 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                        "P *%s", backup_suffix);
                parse_rule(&filter_list, backup_dir_buf, 0, 0);
        }
@@ -261,7 +264,7 @@ To use this patch, run these commands for a successful build:
  
        if (make_backups && !backup_dir) {
                omit_dir_times = 0; /* Implied, so avoid -O to sender. */
-@@ -1845,6 +1900,10 @@ void server_options(char **args, int *ar
+@@ -1844,6 +1899,10 @@ void server_options(char **args, int *argc_p)
                args[ac++] = "--backup-dir";
                args[ac++] = backup_dir;
        }
@@ -272,7 +275,7 @@ To use this patch, run these commands for a successful build:
  
        /* Only send --suffix if it specifies a non-default value. */
        if (strcmp(backup_suffix, backup_dir ? "" : BACKUP_SUFFIX) != 0) {
-@@ -1853,7 +1912,13 @@ void server_options(char **args, int *ar
+@@ -1852,7 +1911,13 @@ void server_options(char **args, int *argc_p)
                        goto oom;
                args[ac++] = arg;
        }
index cf6f4a5..544781e 100644 (file)
@@ -25,20 +25,22 @@ To use this patch, run these commands for a successful build:
     ./configure                                  (optional if already run)
     make
 
---- old/errcode.h
-+++ new/errcode.h
+diff --git a/errcode.h b/errcode.h
+--- a/errcode.h
++++ b/errcode.h
 @@ -47,6 +47,8 @@
  #define RERR_TIMEOUT    30      /* timeout in data send/receive */
+ #define RERR_CONTIMEOUT 35      /* timeout waiting for daemon connection */
  
 +#define RERR_WECRASHED         50      /* We have crashed. */
 +
  /* Although it doesn't seem to be specified anywhere,
   * ssh and the shell seem to return these values:
   *
---- old/log.c
-+++ new/log.c
-@@ -79,6 +79,7 @@ struct {
+diff --git a/log.c b/log.c
+--- a/log.c
++++ b/log.c
+@@ -81,6 +81,7 @@ struct {
        { RERR_TERMINATED , "sibling process terminated abnormally" },
        { RERR_SIGNAL1    , "received SIGUSR1" },
        { RERR_SIGNAL     , "received SIGINT, SIGTERM, or SIGHUP" },
@@ -46,9 +48,10 @@ To use this patch, run these commands for a successful build:
        { RERR_WAITCHILD  , "waitpid() failed" },
        { RERR_MALLOC     , "error allocating core memory buffers" },
        { RERR_PARTIAL    , "some files could not be transferred" },
---- old/main.c
-+++ new/main.c
-@@ -155,8 +155,11 @@ static void wait_process_with_flush(pid_
+diff --git a/main.c b/main.c
+--- a/main.c
++++ b/main.c
+@@ -162,8 +162,11 @@ static void wait_process_with_flush(pid_t pid, int *exit_code_ptr)
                        *exit_code_ptr = RERR_TERMINATED;
                else
                        *exit_code_ptr = RERR_WAITCHILD;
@@ -61,7 +64,7 @@ To use this patch, run these commands for a successful build:
  }
  
  /* This function gets called from all 3 processes.  We want the client side
-@@ -1234,6 +1237,14 @@ RETSIGTYPE remember_children(UNUSED(int 
+@@ -1341,6 +1344,14 @@ RETSIGTYPE remember_children(UNUSED(int val))
                                break;
                        }
                }
@@ -76,7 +79,7 @@ To use this patch, run these commands for a successful build:
        }
  #endif
  #ifndef HAVE_SIGACTION
-@@ -1292,6 +1303,12 @@ static RETSIGTYPE rsync_panic_handler(UN
+@@ -1399,6 +1410,12 @@ static RETSIGTYPE rsync_panic_handler(UNUSED(int whatsig))
  }
  #endif
  
@@ -89,7 +92,7 @@ To use this patch, run these commands for a successful build:
  
  int main(int argc,char *argv[])
  {
-@@ -1314,6 +1331,11 @@ int main(int argc,char *argv[])
+@@ -1421,6 +1438,11 @@ int main(int argc,char *argv[])
        SIGACTMASK(SIGFPE, rsync_panic_handler);
        SIGACTMASK(SIGABRT, rsync_panic_handler);
        SIGACTMASK(SIGBUS, rsync_panic_handler);
@@ -101,9 +104,10 @@ To use this patch, run these commands for a successful build:
  #endif
  
        starttime = time(NULL);
---- old/socket.c
-+++ new/socket.c
-@@ -454,7 +454,17 @@ int is_a_socket(int fd)
+diff --git a/socket.c b/socket.c
+--- a/socket.c
++++ b/socket.c
+@@ -512,7 +512,17 @@ int is_a_socket(int fd)
  static RETSIGTYPE sigchld_handler(UNUSED(int val))
  {
  #ifdef WNOHANG
similarity index 93%
rename from checksum4mirrors.diff
rename to checksum-reading.diff
index dd39026..ef5ace4 100644 (file)
@@ -12,13 +12,14 @@ mirror network.
 
 To use this patch, run these commands for a successful build:
 
-    patch -p1 <patches/checksum4mirrors.diff
+    patch -p1 <patches/checksum-reading.diff
     ./configure                               (optional if already run)
     make
 
---- old/flist.c
-+++ new/flist.c
-@@ -117,6 +117,7 @@ static char empty_sum[MAX_DIGEST_LEN];
+diff --git a/flist.c b/flist.c
+--- a/flist.c
++++ b/flist.c
+@@ -122,6 +122,7 @@ static char empty_sum[MAX_DIGEST_LEN];
  static int flist_count_offset; /* for --delete --progress */
  static int dir_count = 0;
  static int high_hlink_ndx;
@@ -26,7 +27,7 @@ To use this patch, run these commands for a successful build:
  
  static void clean_flist(struct file_list *flist, int strip_root);
  static void output_flist(struct file_list *flist);
-@@ -304,6 +305,186 @@ static void flist_done_allocating(struct
+@@ -314,6 +315,186 @@ static void flist_done_allocating(struct file_list *flist)
                flist->pool_boundary = ptr;
  }
  
@@ -213,7 +214,7 @@ To use this patch, run these commands for a successful build:
  int push_pathname(const char *dir, int len)
  {
        if (dir == pathname)
-@@ -989,7 +1170,7 @@ struct file_struct *make_file(const char
+@@ -1005,7 +1186,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
                              STRUCT_STAT *stp, int flags, int filter_level)
  {
        static char *lastdir;
@@ -222,7 +223,7 @@ To use this patch, run these commands for a successful build:
        struct file_struct *file;
        char thisname[MAXPATHLEN];
        char linkname[MAXPATHLEN];
-@@ -1119,9 +1300,16 @@ struct file_struct *make_file(const char
+@@ -1133,9 +1314,16 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
                        memcpy(lastdir, thisname, len);
                        lastdir[len] = '\0';
                        lastdir_len = len;
@@ -240,7 +241,7 @@ To use this patch, run these commands for a successful build:
        basename_len = strlen(basename) + 1; /* count the '\0' */
  
  #ifdef SUPPORT_LINKS
-@@ -1197,11 +1385,21 @@ struct file_struct *make_file(const char
+@@ -1211,11 +1399,21 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
        }
  #endif
  
@@ -265,7 +266,7 @@ To use this patch, run these commands for a successful build:
        /* 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) {
-@@ -2051,7 +2249,11 @@ struct file_list *send_file_list(int f, 
+@@ -2079,7 +2277,11 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
                         * file-list to check if this is a 1-file xfer. */
                        send_extra_file_list(f, 1);
                }
@@ -278,8 +279,9 @@ To use this patch, run these commands for a successful build:
  
        return flist;
  }
---- old/ifuncs.h
-+++ new/ifuncs.h
+diff --git a/ifuncs.h b/ifuncs.h
+--- a/ifuncs.h
++++ b/ifuncs.h
 @@ -64,6 +64,12 @@ isDigit(const char *ptr)
  }
  
@@ -293,8 +295,10 @@ To use this patch, run these commands for a successful build:
  isPrint(const char *ptr)
  {
        return isprint(*(unsigned char *)ptr);
---- old/support/rsyncsums
-+++ new/support/rsyncsums
+diff --git a/support/rsyncsums b/support/rsyncsums
+new file mode 100644
+--- /dev/null
++++ b/support/rsyncsums
 @@ -0,0 +1,203 @@
 +#!/usr/bin/perl -w
 +use strict;
index c638dd6..e916af7 100644 (file)
@@ -1,25 +1,26 @@
-This builds on the sender optimization feature of the checksum4mirrors
+This builds on the sender optimization feature of the checksum-reading
 patch and adds the ability to create and/or updates the .rsyncsums files
 when --checksum-updating (or "checksum updating = true") is specified.
 
 To use this patch, run these commands for a successful build:
 
-    patch -p1 <patches/checksum4mirrors.diff
+    patch -p1 <patches/checksum-reading.diff
     patch -p1 <patches/checksum-updating.diff
     ./configure                               (optional if already run)
     make
 
---- old/clientserver.c
-+++ new/clientserver.c
-@@ -37,6 +37,7 @@ extern int sanitize_paths;
+diff --git a/clientserver.c b/clientserver.c
+--- a/clientserver.c
++++ b/clientserver.c
+@@ -38,6 +38,7 @@ extern int sanitize_paths;
  extern int filesfrom_fd;
  extern int remote_protocol;
  extern int protocol_version;
 +extern int checksum_updating;
  extern int io_timeout;
  extern int no_detach;
- extern int default_af_hint;
-@@ -687,6 +688,8 @@ static int rsync_module(int f_in, int f_
+ extern int write_batch;
+@@ -704,6 +705,8 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
        else if (am_root < 0) /* Treat --fake-super from client as --super. */
                am_root = 2;
  
@@ -28,8 +29,9 @@ To use this patch, run these commands for a successful build:
        if (filesfrom_fd == 0)
                filesfrom_fd = f_in;
  
---- old/flist.c
-+++ new/flist.c
+diff --git a/flist.c b/flist.c
+--- a/flist.c
++++ b/flist.c
 @@ -26,6 +26,7 @@
  #include "io.h"
  
@@ -46,7 +48,7 @@ To use this patch, run these commands for a successful build:
  extern int prune_empty_dirs;
  extern int copy_links;
  extern int copy_unsafe_links;
-@@ -82,6 +84,9 @@ extern iconv_t ic_send, ic_recv;
+@@ -83,6 +85,9 @@ extern iconv_t ic_send, ic_recv;
  
  #define PTR_SIZE (sizeof (struct file_struct *))
  
@@ -56,7 +58,7 @@ To use this patch, run these commands for a successful build:
  int io_error;
  int checksum_len;
  dev_t filesystem_dev; /* used to implement -x */
-@@ -117,6 +122,9 @@ static char empty_sum[MAX_DIGEST_LEN];
+@@ -122,6 +127,9 @@ static char empty_sum[MAX_DIGEST_LEN];
  static int flist_count_offset; /* for --delete --progress */
  static int dir_count = 0;
  static int high_hlink_ndx;
@@ -66,7 +68,7 @@ To use this patch, run these commands for a successful build:
  static struct file_list *checksum_flist = NULL;
  
  static void clean_flist(struct file_list *flist, int strip_root);
-@@ -307,7 +315,8 @@ static void flist_done_allocating(struct
+@@ -317,7 +325,8 @@ static void flist_done_allocating(struct file_list *flist)
  
  /* The len count is the length of the basename + 1 for the null. */
  static int add_checksum(const char *dirname, const char *basename, int len,
@@ -76,7 +78,7 @@ To use this patch, run these commands for a successful build:
  {
        struct file_struct *file;
        int alloc_len, extra_len;
-@@ -318,13 +327,14 @@ static int add_checksum(const char *dirn
+@@ -328,13 +337,14 @@ static int add_checksum(const char *dirname, const char *basename, int len,
        if (file_length == 0)
                return 0;
  
@@ -93,7 +95,7 @@ To use this patch, run these commands for a successful build:
        bp = pool_alloc(checksum_flist->file_pool, alloc_len, "add_checksum");
  
        memset(bp, 0, extra_len + FILE_STRUCT_LEN);
-@@ -333,7 +343,14 @@ static int add_checksum(const char *dirn
+@@ -343,7 +353,14 @@ static int add_checksum(const char *dirname, const char *basename, int len,
        bp += FILE_STRUCT_LEN;
  
        memcpy(bp, basename, len);
@@ -108,7 +110,7 @@ To use this patch, run these commands for a successful build:
        file->mode = S_IFREG;
        file->modtime = mtime;
        file->len32 = (uint32)file_length;
-@@ -344,6 +361,8 @@ static int add_checksum(const char *dirn
+@@ -354,6 +371,8 @@ static int add_checksum(const char *dirname, const char *basename, int len,
        file->dirname = dirname;
        bp = F_SUM(file);
        memcpy(bp, sum, checksum_len);
@@ -117,7 +119,7 @@ To use this patch, run these commands for a successful build:
  
        flist_expand(checksum_flist, 1);
        checksum_flist->files[checksum_flist->used++] = file;
-@@ -353,17 +372,104 @@ static int add_checksum(const char *dirn
+@@ -363,17 +382,104 @@ static int add_checksum(const char *dirname, const char *basename, int len,
        return 1;
  }
  
@@ -223,7 +225,7 @@ To use this patch, run these commands for a successful build:
        if (checksum_flist) {
                /* Reset the pool memory and empty the file-list array. */
                pool_free_old(checksum_flist->file_pool,
-@@ -374,6 +480,9 @@ static void read_checksums(const char *d
+@@ -384,6 +490,9 @@ static void read_checksums(const char *dirname)
  
        checksum_flist->low = 0;
        checksum_flist->high = -1;
@@ -233,7 +235,7 @@ To use this patch, run these commands for a successful build:
  
        if (!dirname)
                return;
-@@ -392,7 +501,7 @@ static void read_checksums(const char *d
+@@ -402,7 +511,7 @@ static void read_checksums(const char *dirname)
        while (fgets(line, sizeof line, fp)) {
                cp = line;
                if (protocol_version >= 30) {
@@ -242,7 +244,7 @@ To use this patch, run these commands for a successful build:
                        if (*cp == '=')
                                while (*++cp == '=') {}
                        else
-@@ -403,7 +512,14 @@ static void read_checksums(const char *d
+@@ -413,7 +522,14 @@ static void read_checksums(const char *dirname)
                }
  
                if (*cp == '=') {
@@ -258,7 +260,7 @@ To use this patch, run these commands for a successful build:
                } else {
                        for (i = 0; i < checksum_len*2; i++, cp++) {
                                int x;
-@@ -421,13 +537,14 @@ static void read_checksums(const char *d
+@@ -431,13 +547,14 @@ static void read_checksums(const char *dirname)
                                else
                                        sum[i/2] = x << 4;
                        }
@@ -274,7 +276,7 @@ To use this patch, run these commands for a successful build:
                        if (*cp == '=')
                                while (*++cp == '=') {}
                        else
-@@ -451,16 +568,16 @@ static void read_checksums(const char *d
+@@ -461,16 +578,16 @@ static void read_checksums(const char *dirname)
                        break;
                while (*++cp == ' ') {}
  
@@ -295,7 +297,7 @@ To use this patch, run these commands for a successful build:
                if (*cp != ' ')
                        break;
                while (*++cp == ' ') {}
-@@ -477,8 +594,13 @@ static void read_checksums(const char *d
+@@ -487,8 +604,13 @@ static void read_checksums(const char *dirname)
                        continue;
  
                strlcpy(fbuf+dlen, cp, sizeof fbuf - dlen);
@@ -310,7 +312,7 @@ To use this patch, run these commands for a successful build:
        }
        fclose(fp);
  
-@@ -1260,6 +1382,8 @@ struct file_struct *make_file(const char
+@@ -1274,6 +1396,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
        if (is_excluded(thisname, S_ISDIR(st.st_mode) != 0, filter_level)) {
                if (ignore_perishable)
                        non_perishable_cnt++;
@@ -319,7 +321,7 @@ To use this patch, run these commands for a successful build:
                return NULL;
        }
  
-@@ -1391,13 +1515,36 @@ struct file_struct *make_file(const char
+@@ -1405,13 +1529,36 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
                int j;
                if (flist && (j = flist_find(checksum_flist, file)) >= 0) {
                        struct file_struct *fp = checksum_flist->sorted[j];
@@ -361,7 +363,7 @@ To use this patch, run these commands for a successful build:
        }
  
        /* This code is only used by the receiver when it is building
-@@ -1688,6 +1835,9 @@ static void send_directory(int f, struct
+@@ -1703,6 +1850,9 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
  
        closedir(d);
  
@@ -371,7 +373,7 @@ To use this patch, run these commands for a successful build:
        if (f >= 0 && recurse && !divert_dirs) {
                int i, end = flist->used - 1;
                /* send_if_directory() bumps flist->used, so use "end". */
-@@ -2253,7 +2403,7 @@ struct file_list *send_file_list(int f, 
+@@ -2281,7 +2431,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
                flist_eof = 1;
        
        if (checksum_updating && always_checksum && flist_eof)
@@ -380,8 +382,9 @@ To use this patch, run these commands for a successful build:
  
        return flist;
  }
---- old/loadparm.c
-+++ new/loadparm.c
+diff --git a/loadparm.c b/loadparm.c
+--- a/loadparm.c
++++ b/loadparm.c
 @@ -153,6 +153,7 @@ typedef struct
        int syslog_facility;
        int timeout;
@@ -390,7 +393,7 @@ To use this patch, run these commands for a successful build:
        BOOL fake_super;
        BOOL ignore_errors;
        BOOL ignore_nonreadable;
-@@ -201,6 +202,7 @@ static service sDefault =
+@@ -202,6 +203,7 @@ static service sDefault =
   /* syslog_facility; */               LOG_DAEMON,
   /* timeout; */                       0,
  
@@ -398,25 +401,26 @@ To use this patch, run these commands for a successful build:
   /* fake_super; */            False,
   /* ignore_errors; */         False,
   /* ignore_nonreadable; */    False,
-@@ -317,6 +319,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},
+@@ -301,6 +303,7 @@ static struct parm_struct parm_table[] =
+  {"socket options",    P_STRING, P_GLOBAL,&Globals.socket_options,     NULL,0},
+  {"auth users",        P_STRING, P_LOCAL, &sDefault.auth_users,        NULL,0},
 + {"checksum updating", P_BOOL,   P_LOCAL, &sDefault.checksum_updating, 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},
-@@ -422,6 +425,7 @@ FN_LOCAL_BOOL(lp_fake_super, fake_super)
+  {"comment",           P_STRING, P_LOCAL, &sDefault.comment,           NULL,0},
+  {"dont compress",     P_STRING, P_LOCAL, &sDefault.dont_compress,     NULL,0},
+  {"exclude from",      P_STRING, P_LOCAL, &sDefault.exclude_from,      NULL,0},
+@@ -421,6 +424,7 @@ FN_LOCAL_INTEGER(lp_max_connections, max_connections)
+ FN_LOCAL_INTEGER(lp_max_verbosity, max_verbosity)
+ FN_LOCAL_INTEGER(lp_timeout, timeout)
++FN_LOCAL_BOOL(lp_checksum_updating, checksum_updating)
+ 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_checksum_updating, checksum_updating)
- FN_LOCAL_BOOL(lp_read_only, read_only)
- FN_LOCAL_BOOL(lp_strict_modes, strict_modes)
- FN_LOCAL_BOOL(lp_transfer_logging, transfer_logging)
---- old/options.c
-+++ new/options.c
-@@ -110,6 +110,7 @@ size_t bwlimit_writemax = 0;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -111,6 +111,7 @@ size_t bwlimit_writemax = 0;
  int ignore_existing = 0;
  int ignore_non_existing = 0;
  int need_messages_from_generator = 0;
@@ -424,7 +428,7 @@ To use this patch, run these commands for a successful build:
  int max_delete = INT_MIN;
  OFF_T max_size = 0;
  OFF_T min_size = 0;
-@@ -310,6 +311,7 @@ void usage(enum logcode F)
+@@ -311,6 +312,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");
@@ -432,7 +436,7 @@ To use this patch, run these commands for a successful build:
    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");
-@@ -557,6 +559,7 @@ static struct poptOption long_options[] 
+@@ -559,6 +561,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 },
@@ -440,7 +444,7 @@ To use this patch, run these commands for a successful build:
    {"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 },
-@@ -1954,7 +1957,9 @@ void server_options(char **args, int *ar
+@@ -1957,7 +1960,9 @@ void server_options(char **args, int *argc_p)
                                args[ac++] = basis_dir[i];
                        }
                }
@@ -451,9 +455,10 @@ To use this patch, run these commands for a successful build:
  
        if (append_mode) {
                if (append_mode > 1)
---- old/rsync.h
-+++ new/rsync.h
-@@ -662,6 +662,10 @@ extern int xattrs_ndx;
+diff --git a/rsync.h b/rsync.h
+--- a/rsync.h
++++ b/rsync.h
+@@ -678,6 +678,10 @@ extern int xattrs_ndx;
  #define F_SUM(f) ((char*)OPT_EXTRA(f, LEN64_BUMP(f) + HLINK_BUMP(f) \
                                    + SUM_EXTRA_CNT - 1))
  
@@ -464,9 +469,10 @@ To use this patch, run these commands for a successful build:
  /* Some utility defines: */
  #define F_IS_ACTIVE(f) (f)->basename[0]
  #define F_IS_HLINKED(f) ((f)->flags & FLAG_HLINKED)
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -317,6 +317,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -317,6 +317,7 @@ to the detailed description below for a complete description.  verb(
   -q, --quiet                 suppress non-error messages
       --no-motd               suppress daemon-mode MOTD (see caveat)
   -c, --checksum              skip based on checksum, not mod-time & size
@@ -474,7 +480,7 @@ To use this patch, run these commands for a successful build:
   -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
       --no-OPTION             turn off an implied OPTION (e.g. --no-D)
   -r, --recursive             recurse into directories
-@@ -515,9 +516,9 @@ uses a "quick check" that (by default) c
+@@ -516,9 +517,9 @@ uses a "quick check" that (by default) checks if each file's size and time
  of last modification match between the sender and receiver.  This option
  changes this to compare a 128-bit MD4 checksum for each file that has a
  matching size.  Generating the checksums means that both sides will expend
@@ -487,7 +493,7 @@ To use this patch, run these commands for a successful build:
  
  The sending side generates its checksums while it is doing the file-system
  scan that builds the list of the available files.  The receiver generates
-@@ -525,12 +526,42 @@ its checksums when it is scanning for ch
+@@ -526,12 +527,42 @@ its checksums when it is scanning for changed files, and will checksum any
  file that has the same size as the corresponding sender's file:  files with
  either a changed size or a changed checksum are selected for transfer.
  
@@ -530,9 +536,10 @@ To use this patch, run these commands for a successful build:
  dit(bf(-a, --archive)) This is equivalent to bf(-rlptgoD). It is a quick
  way of saying you want recursion and want to preserve almost
  everything (with -H being a notable omission).
---- old/rsyncd.conf.yo
-+++ new/rsyncd.conf.yo
-@@ -200,6 +200,20 @@ locking on this file to ensure that the 
+diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
+--- a/rsyncd.conf.yo
++++ b/rsyncd.conf.yo
+@@ -237,6 +237,20 @@ locking on this file to ensure that the max connections limit is not
  exceeded for the modules sharing the lock file.
  The default is tt(/var/run/rsyncd.lock).
  
index f4e8d30..2cac1f5 100644 (file)
@@ -8,9 +8,10 @@ To use this patch, run these commands for a successful build:
     ./configure                               (optional if already run)
     make
 
---- old/flist.c
-+++ new/flist.c
-@@ -1183,7 +1183,8 @@ struct file_struct *make_file(const char
+diff --git a/flist.c b/flist.c
+--- a/flist.c
++++ b/flist.c
+@@ -1211,7 +1211,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
        }
  #endif
  
@@ -20,9 +21,10 @@ To use this patch, run these commands for a successful build:
                file_checksum(thisname, tmp_sum, st.st_size);
  
        F_PATHNAME(file) = pathname;
---- old/generator.c
-+++ new/generator.c
-@@ -626,7 +626,8 @@ int unchanged_file(char *fn, struct file
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
+@@ -637,7 +637,8 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
           of the file time to determine whether to sync */
        if (always_checksum > 0 && S_ISREG(st->st_mode)) {
                char sum[MAX_DIGEST_LEN];
@@ -32,8 +34,10 @@ To use this patch, run these commands for a successful build:
                return memcmp(sum, F_SUM(file), checksum_len) == 0;
        }
  
---- old/support/xsums
-+++ new/support/xsums
+diff --git a/support/xsums b/support/xsums
+new file mode 100644
+--- /dev/null
++++ b/support/xsums
 @@ -0,0 +1,118 @@
 +#!/usr/bin/perl -w
 +use strict;
@@ -153,8 +157,9 @@ To use this patch, run these commands for a successful build:
 + -h, --help        Display this help message.
 +EOT
 +}
---- old/xattrs.c
-+++ new/xattrs.c
+diff --git a/xattrs.c b/xattrs.c
+--- a/xattrs.c
++++ b/xattrs.c
 @@ -33,6 +33,8 @@ extern int read_only;
  extern int list_only;
  extern int preserve_xattrs;
@@ -173,7 +178,7 @@ To use this patch, run these commands for a successful build:
  
  typedef struct {
        char *datum, *name;
-@@ -825,6 +829,39 @@ int del_def_xattr_acl(const char *fname)
+@@ -841,6 +845,39 @@ int del_def_xattr_acl(const char *fname)
  }
  #endif
  
@@ -189,7 +194,7 @@ To use this patch, run these commands for a successful build:
 +      if (len < 0) {
 +              if (errno == ENOTSUP || errno == ENOATTR)
 +                      return 0;
-+              rsyserr(FERROR, errno, "failed to read xattr %s for %s",
++              rsyserr(FERROR_XFER, errno, "failed to read xattr %s for %s",
 +                      mdattr, full_fname(fname));
 +              return 0;
 +      }
diff --git a/contimeout.diff b/contimeout.diff
deleted file mode 100644 (file)
index f8cc519..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-This patch adds a connection timeout option, --contimeout.
-
-To use this patch, run these commands for a successful build:
-
-    patch -p1 <patches/contimeout.diff
-    ./configure                                 (optional if already run)
-    make
-
---- old/errcode.h
-+++ new/errcode.h
-@@ -45,6 +45,7 @@
- #define RERR_DEL_LIMIT  25      /* skipped some deletes due to --max-delete */
- #define RERR_TIMEOUT    30      /* timeout in data send/receive */
-+#define RERR_CONTIMEOUT 35      /* timeout waiting for daemon connection */
- /* Although it doesn't seem to be specified anywhere,
-  * ssh and the shell seem to return these values:
---- old/log.c
-+++ new/log.c
-@@ -86,6 +86,7 @@ struct {
-       { RERR_PARTIAL    , "some files could not be transferred" },
-       { RERR_VANISHED   , "some files vanished before they could be transferred" },
-       { RERR_TIMEOUT    , "timeout in data send/receive" },
-+      { RERR_CONTIMEOUT , "timeout waiting for daemon connection" },
-       { RERR_CMD_FAILED , "remote shell failed" },
-       { RERR_CMD_KILLED , "remote shell killed" },
-       { RERR_CMD_RUN    , "remote command could not be run" },
---- old/options.c
-+++ new/options.c
-@@ -99,6 +99,7 @@ int xfer_dirs = -1;
- int am_daemon = 0;
- int do_stats = 0;
- int do_progress = 0;
-+int connect_timeout = 0;
- int keep_partial = 0;
- int safe_symlinks = 0;
- int copy_unsafe_links = 0;
-@@ -603,6 +604,7 @@ static struct poptOption long_options[] 
-   {"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 },
-+  {"contimeout",       0,  POPT_ARG_INT,    &connect_timeout, 0, 0, 0 },
-   {"rsh",             'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
-   {"rsync-path",       0,  POPT_ARG_STRING, &rsync_path, 0, 0, 0 },
-   {"temp-dir",        'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -2775,6 +2775,7 @@ dit(bf(23)) Partial transfer due to erro
- dit(bf(24)) Partial transfer due to vanished source files
- dit(bf(25)) The --max-delete limit stopped deletions
- dit(bf(30)) Timeout in data send/receive
-+dit(bf(35)) Timeout waiting for daemon connection
- enddit()
- manpagesection(ENVIRONMENT VARIABLES)
---- old/socket.c
-+++ new/socket.c
-@@ -32,6 +32,7 @@
- extern char *bind_address;
- extern int default_af_hint;
-+extern int connect_timeout;
- #ifdef HAVE_SIGACTION
- static struct sigaction sigact;
-@@ -157,6 +158,11 @@ int try_bind_local(int s, int ai_family,
-       return -1;
- }
-+/* connect() timeout handler based on alarm() */
-+static RETSIGTYPE contimeout_handler(UNUSED(int val))
-+{
-+      connect_timeout = -1;
-+}
- /**
-  * Open a socket to a tcp remote host with the specified port .
-@@ -261,11 +267,27 @@ int open_socket_out(char *host, int port
-                       s = -1;
-                       continue;
-               }
--              if (connect(s, res->ai_addr, res->ai_addrlen) < 0) {
-+              if (connect_timeout > 0) {
-+                      SIGACTION(SIGALRM, contimeout_handler);
-+                      alarm(connect_timeout);
-+              }
-+
-+              while (connect(s, res->ai_addr, res->ai_addrlen) < 0) {
-+                      if (connect_timeout < 0)
-+                              exit_cleanup(RERR_CONTIMEOUT);
-+                      if (errno == EINTR)
-+                              continue;
-                       close(s);
-                       s = -1;
--                      continue;
-+                      break;
-               }
-+
-+              if (connect_timeout > 0)
-+                      alarm(0);
-+
-+              if (s < 0)
-+                      continue;
-+
-               if (proxied
-                && establish_proxy_connection(s, host, port,
-                                              proxy_user, proxy_pass) != 0) {
index 3f74a04..c237aab 100644 (file)
@@ -8,8 +8,9 @@ To use this patch, run these commands for a successful build:
     ./configure                      (optional if already run)
     make
 
---- old/generator.c
-+++ new/generator.c
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
 @@ -39,6 +39,7 @@ extern int preserve_acls;
  extern int preserve_xattrs;
  extern int preserve_links;
@@ -18,7 +19,7 @@ To use this patch, run these commands for a successful build:
  extern int preserve_specials;
  extern int preserve_hard_links;
  extern int preserve_perms;
-@@ -1480,7 +1481,7 @@ static void recv_generator(char *fname, 
+@@ -1566,7 +1567,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                goto cleanup;
        }
  
@@ -27,9 +28,10 @@ To use this patch, run these commands for a successful build:
                if (solo_file)
                        fname = f_name(file, NULL);
                rprintf(FINFO, "skipping non-regular file \"%s\"\n", fname);
---- old/options.c
-+++ new/options.c
-@@ -45,6 +45,7 @@ int append_mode = 0;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -46,6 +46,7 @@ int append_mode = 0;
  int keep_dirlinks = 0;
  int copy_dirlinks = 0;
  int copy_links = 0;
@@ -37,7 +39,7 @@ To use this patch, run these commands for a successful build:
  int preserve_links = 0;
  int preserve_hard_links = 0;
  int preserve_acls = 0;
-@@ -341,6 +342,7 @@ void usage(enum logcode F)
+@@ -343,6 +344,7 @@ void usage(enum logcode F)
    rprintf(F," -o, --owner                 preserve owner (super-user only)\n");
    rprintf(F," -g, --group                 preserve group\n");
    rprintf(F,"     --devices               preserve device files (super-user only)\n");
@@ -45,7 +47,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F,"     --specials              preserve special files\n");
    rprintf(F," -D                          same as --devices --specials\n");
    rprintf(F," -t, --times                 preserve modification times\n");
-@@ -496,6 +498,7 @@ static struct poptOption long_options[] 
+@@ -499,6 +501,7 @@ static struct poptOption long_options[] = {
    {"no-D",             0,  POPT_ARG_NONE,   0, OPT_NO_D, 0, 0 },
    {"devices",          0,  POPT_ARG_VAL,    &preserve_devices, 1, 0, 0 },
    {"no-devices",       0,  POPT_ARG_VAL,    &preserve_devices, 0, 0, 0 },
@@ -53,7 +55,7 @@ To use this patch, run these commands for a successful build:
    {"specials",         0,  POPT_ARG_VAL,    &preserve_specials, 1, 0, 0 },
    {"no-specials",      0,  POPT_ARG_VAL,    &preserve_specials, 0, 0, 0 },
    {"links",           'l', POPT_ARG_VAL,    &preserve_links, 1, 0, 0 },
-@@ -1978,6 +1981,9 @@ void server_options(char **args, int *ar
+@@ -1991,6 +1994,9 @@ void server_options(char **args, int *argc_p)
        else if (remove_source_files)
                args[ac++] = "--remove-sent-files";
  
@@ -63,9 +65,10 @@ To use this patch, run these commands for a successful build:
        *argc_p = ac;
        return;
  
---- old/rsync.c
-+++ new/rsync.c
-@@ -33,6 +33,7 @@ extern int preserve_xattrs;
+diff --git a/rsync.c b/rsync.c
+--- a/rsync.c
++++ b/rsync.c
+@@ -34,6 +34,7 @@ extern int preserve_xattrs;
  extern int preserve_perms;
  extern int preserve_executability;
  extern int preserve_times;
@@ -73,7 +76,7 @@ To use this patch, run these commands for a successful build:
  extern int am_root;
  extern int am_server;
  extern int am_sender;
-@@ -219,7 +220,8 @@ int read_ndx_and_attrs(int f_in, int *if
+@@ -289,7 +290,8 @@ int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr,
  
        if (iflags & ITEM_TRANSFER) {
                int i = ndx - cur_flist->ndx_start;
@@ -83,8 +86,9 @@ To use this patch, run these commands for a successful build:
                        rprintf(FERROR,
                                "received request to transfer non-regular file: %d [%s]\n",
                                ndx, who_am_i());
---- old/sender.c
-+++ new/sender.c
+diff --git a/sender.c b/sender.c
+--- a/sender.c
++++ b/sender.c
 @@ -314,6 +314,20 @@ void send_files(int f_in, int f_out)
                        exit_cleanup(RERR_PROTOCOL);
                }
index e61a34e..db45406 100644 (file)
@@ -8,9 +8,10 @@ To use this patch, run these commands for a successful build:
     ./configure                                 (optional if already run)
     make
 
---- old/exclude.c
-+++ new/exclude.c
-@@ -217,6 +217,8 @@ static void add_rule(struct filter_list_
+diff --git a/exclude.c b/exclude.c
+--- a/exclude.c
++++ b/exclude.c
+@@ -213,6 +213,8 @@ static void add_rule(struct filter_list_struct *listp, const char *pat,
                if (!(lp = new_array(struct filter_list_struct, 1)))
                        out_of_memory("add_rule");
                lp->head = lp->tail = NULL;
@@ -19,7 +20,7 @@ To use this patch, run these commands for a successful build:
                if (asprintf(&lp->debug_type, " [per-dir %s]", cp) < 0)
                        out_of_memory("add_rule");
                ret->u.mergelist = lp;
-@@ -449,6 +451,14 @@ void *push_local_filters(const char *dir
+@@ -445,6 +447,14 @@ void *push_local_filters(const char *dir, unsigned int dirlen)
                                set_filter_dir(dir, dirlen);
                }
  
@@ -34,7 +35,7 @@ To use this patch, run these commands for a successful build:
                if (strlcpy(dirbuf + dirbuf_len, ex->pattern,
                    MAXPATHLEN - dirbuf_len) < MAXPATHLEN - dirbuf_len) {
                        parse_filter_file(lp, dirbuf, ex->match_flags,
-@@ -1005,6 +1015,7 @@ void parse_filter_file(struct filter_lis
+@@ -1004,6 +1014,7 @@ void parse_filter_file(struct filter_list_struct *listp, const char *fname,
        char line[BIGPATHBUFLEN];
        char *eob = line + sizeof line - 1;
        int word_split = mflags & MATCHFLG_WORD_SPLIT;
@@ -42,7 +43,7 @@ To use this patch, run these commands for a successful build:
  
        if (!fname || !*fname)
                return;
-@@ -1051,6 +1062,24 @@ void parse_filter_file(struct filter_lis
+@@ -1050,6 +1061,24 @@ void parse_filter_file(struct filter_list_struct *listp, const char *fname,
                                }
                                break;
                        }
@@ -67,7 +68,7 @@ To use this patch, run these commands for a successful build:
                        if (word_split && isspace(ch))
                                break;
                        if (eol_nulls? !ch : (ch == '\n' || ch == '\r'))
-@@ -1060,13 +1089,15 @@ void parse_filter_file(struct filter_lis
+@@ -1059,13 +1088,15 @@ void parse_filter_file(struct filter_list_struct *listp, const char *fname,
                        else
                                overflow = 1;
                }
@@ -84,9 +85,10 @@ To use this patch, run these commands for a successful build:
                        parse_rule(listp, line, mflags, xflags);
                if (ch == EOF)
                        break;
---- old/rsync.h
-+++ new/rsync.h
-@@ -132,6 +132,7 @@
+diff --git a/rsync.h b/rsync.h
+--- a/rsync.h
++++ b/rsync.h
+@@ -145,6 +145,7 @@
  #define XFLG_OLD_PREFIXES     (1<<1)
  #define XFLG_ANCHORED2ABS     (1<<2)
  #define XFLG_ABS_IF_SLASH     (1<<3)
@@ -94,8 +96,9 @@ To use this patch, run these commands for a successful build:
  
  #define ATTRS_REPORT          (1<<0)
  #define ATTRS_SKIP_MTIME      (1<<1)
---- old/testsuite/exclude.test
-+++ new/testsuite/exclude.test
+diff --git a/testsuite/exclude.test b/testsuite/exclude.test
+--- a/testsuite/exclude.test
++++ b/testsuite/exclude.test
 @@ -19,6 +19,7 @@ export CVSIGNORE
  
  makepath "$fromdir/foo/down/to/you"
@@ -104,7 +107,7 @@ To use this patch, run these commands for a successful build:
  makepath "$fromdir/bar/down/to/foo/too"
  makepath "$fromdir/bar/down/to/bar/baz"
  makepath "$fromdir/mid/for/foo/and/that/is/who"
-@@ -57,6 +58,9 @@ echo cvsout >"$fromdir/bar/down/to/foo/f
+@@ -57,6 +58,9 @@ echo cvsout >"$fromdir/bar/down/to/foo/file1.bak"
  echo gone >"$fromdir/bar/down/to/foo/file3"
  echo lost >"$fromdir/bar/down/to/foo/file4"
  echo weird >"$fromdir/bar/down/to/foo/+ file3"
@@ -114,7 +117,7 @@ To use this patch, run these commands for a successful build:
  echo cvsout-but-filtin >"$fromdir/bar/down/to/foo/file4.junk"
  echo smashed >"$fromdir/bar/down/to/foo/to"
  cat >"$fromdir/bar/down/to/bar/.filt2" <<EOF
-@@ -103,7 +107,18 @@ cat >"$excl" <<EOF
+@@ -102,7 +106,18 @@ cat >"$excl" <<EOF
  EOF
  
  cat >"$scratchdir/.cvsignore" <<EOF
@@ -133,8 +136,8 @@ To use this patch, run these commands for a successful build:
 +not.good
  EOF
  
- # Create the chk dir with what we expect to be excluded
-@@ -132,6 +147,10 @@ checkit "$RSYNC -avv --exclude-from=\"$e
+ # Start with a check of --prune-empty-dirs:
+@@ -136,6 +151,10 @@ checkit "$RSYNC -avv --exclude-from='$excl' \
  # Modify the chk dir by removing cvs-ignored files and then tweaking the dir times.
  
  rm "$chkdir"/foo/*.old
@@ -145,7 +148,7 @@ To use this patch, run these commands for a successful build:
  rm "$chkdir"/bar/down/to/foo/*.bak
  rm "$chkdir"/bar/down/to/foo/*.junk
  rm "$chkdir"/bar/down/to/home-cvs-exclude
-@@ -147,8 +166,12 @@ checkit "$RSYNC -avvC --filter=\"merge $
+@@ -151,8 +170,12 @@ checkit "$RSYNC -avvC --filter='merge $excl' --delete-excluded \
  
  # Modify the chk dir for our merge-exclude test and then tweak the dir times.
  
index f2dd735..54b41aa 100644 (file)
@@ -14,8 +14,9 @@ To use this patch, run these commands for a successful build:
     ./configure                                 (optional if already run)
     make
 
---- old/generator.c
-+++ new/generator.c
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
 @@ -61,6 +61,7 @@ extern int append_mode;
  extern int make_backups;
  extern int csum_length;
@@ -24,7 +25,7 @@ To use this patch, run these commands for a successful build:
  extern int size_only;
  extern OFF_T max_size;
  extern OFF_T min_size;
-@@ -619,6 +620,9 @@ void itemize(const char *fnamecmp, struc
+@@ -630,6 +631,9 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
  /* Perform our quick-check heuristic for determining if a file is unchanged. */
  int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
  {
@@ -34,9 +35,10 @@ To use this patch, run these commands for a successful build:
        if (st->st_size != F_LENGTH(file))
                return 0;
  
---- old/options.c
-+++ new/options.c
-@@ -103,6 +103,7 @@ int keep_partial = 0;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -104,6 +104,7 @@ int keep_partial = 0;
  int safe_symlinks = 0;
  int copy_unsafe_links = 0;
  int size_only = 0;
@@ -44,15 +46,15 @@ To use this patch, run these commands for a successful build:
  int daemon_bwlimit = 0;
  int bwlimit = 0;
  int fuzzy_basis = 0;
-@@ -380,6 +381,7 @@ void usage(enum logcode F)
-   rprintf(F,"     --timeout=TIME          set I/O timeout in seconds\n");
+@@ -382,6 +383,7 @@ void usage(enum logcode F)
+   rprintf(F,"     --contimeout=SECONDS    set daemon connection 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,"     --date-only             skip files that match in mod-time\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");
-@@ -520,6 +522,7 @@ static struct poptOption long_options[] 
+@@ -522,6 +524,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 },
@@ -60,7 +62,7 @@ To use this patch, run these commands for a successful build:
    {"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 },
-@@ -1897,6 +1900,9 @@ void server_options(char **args, int *ar
+@@ -1896,6 +1899,9 @@ void server_options(char **args, int *argc_p)
                }
        }
  
@@ -70,17 +72,18 @@ To use this patch, run these commands for a successful build:
        if (modify_window_set) {
                if (asprintf(&arg, "--modify-window=%d", modify_window) < 0)
                        goto oom;
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -382,6 +382,7 @@ to the detailed description below for a 
-      --timeout=TIME          set I/O timeout in seconds
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -382,6 +382,7 @@ to the detailed description below for a complete description.  verb(
+      --contimeout=SECONDS    set daemon connection timeout in seconds
   -I, --ignore-times          don't skip files that match size and time
       --size-only             skip files that match in size
 +     --date-only             skip files that match in mod-time
       --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
-@@ -502,6 +503,12 @@ time to just looking for files that have
+@@ -502,6 +503,12 @@ time to just looking for files that have changed in size.  This is useful
  when starting to use rsync after using another mirroring system which may
  not preserve timestamps exactly.
  
index 98a732a..c2296e8 100644 (file)
@@ -20,9 +20,10 @@ switches to --detect-moved blindly accepts the staged file.
 
 -- Matt McCutchen <hashproduct+rsync@gmail.com>
 
---- old/generator.c
-+++ new/generator.c
-@@ -188,7 +188,9 @@ static int fattr_find(struct file_struct
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
+@@ -186,7 +186,9 @@ static int fattr_find(struct file_struct *f, char *fname)
                                continue;
                        }
                }
@@ -33,7 +34,7 @@ switches to --detect-moved blindly accepts the staged file.
                diff = u_strcmp(fmid->basename, f->basename);
                if (diff == 0) {
                        good_match = mid;
-@@ -1831,6 +1833,21 @@ static void recv_generator(char *fname, 
+@@ -1864,6 +1866,21 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                fnamecmp = partialptr;
                fnamecmp_type = FNAMECMP_PARTIAL_DIR;
                statret = 0;
@@ -55,9 +56,10 @@ switches to --detect-moved blindly accepts the staged file.
        }
  
        if (!do_xfers)
---- old/options.c
-+++ new/options.c
-@@ -385,6 +385,8 @@ void usage(enum logcode F)
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -387,6 +387,8 @@ void usage(enum logcode F)
    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,"     --detect-renamed        try to find renamed files to speed up the transfer\n");
@@ -66,7 +68,7 @@ switches to --detect-moved blindly accepts the staged file.
    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");
-@@ -563,7 +565,9 @@ static struct poptOption long_options[] 
+@@ -565,7 +567,9 @@ 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 },
@@ -77,7 +79,7 @@ switches to --detect-moved blindly accepts the staged file.
    {"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 },
-@@ -1889,8 +1893,14 @@ void server_options(char **args, int *ar
+@@ -1892,8 +1896,14 @@ void server_options(char **args, int *argc_p)
                        args[ac++] = "--super";
                if (size_only)
                        args[ac++] = "--size-only";
@@ -94,9 +96,10 @@ switches to --detect-moved blindly accepts the staged file.
        } else {
                if (skip_compress) {
                        if (asprintf(&arg, "--skip-compress=%s", skip_compress) < 0)
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -385,6 +385,8 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -386,6 +386,8 @@ to the detailed description below for a complete description.  verb(
   -T, --temp-dir=DIR          create temporary files in directory DIR
   -y, --fuzzy                 find similar file for basis if no dest file
       --detect-renamed        try to find renamed files to speed the xfer
@@ -105,7 +108,7 @@ switches to --detect-moved blindly accepts the staged 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
-@@ -1446,6 +1448,17 @@ the bf(--partial-dir) option, that direc
+@@ -1467,6 +1469,17 @@ the bf(--partial-dir) option, that directory will be used instead.  These
  potential alternate-basis files will be removed as the transfer progresses.
  This option conflicts with bf(--inplace) and bf(--append).
  
index 706ccd9..5a2b3e1 100644 (file)
@@ -32,8 +32,9 @@ TODO:
   a file that can't use it, while missing out on giving it to a file
   that could use it.
 
---- old/compat.c
-+++ new/compat.c
+diff --git a/compat.c b/compat.c
+--- a/compat.c
++++ b/compat.c
 @@ -41,6 +41,7 @@ extern int checksum_seed;
  extern int basis_dir_cnt;
  extern int prune_empty_dirs;
@@ -50,8 +51,9 @@ TODO:
          || delay_updates || prune_empty_dirs))
                allow_inc_recurse = 0;
        else if (am_server && !local_server
---- old/flist.c
-+++ new/flist.c
+diff --git a/flist.c b/flist.c
+--- a/flist.c
++++ b/flist.c
 @@ -61,6 +61,7 @@ extern int non_perishable_cnt;
  extern int prune_empty_dirs;
  extern int copy_links;
@@ -59,8 +61,8 @@ TODO:
 +extern int detect_renamed;
  extern int protocol_version;
  extern int sanitize_paths;
- extern int need_unsorted_flist;
-@@ -117,6 +118,8 @@ static int64 tmp_dev, tmp_ino;
+ extern int munge_symlinks;
+@@ -118,6 +119,8 @@ static int64 tmp_dev, tmp_ino;
  #endif
  static char tmp_sum[MAX_DIGEST_LEN];
  
@@ -69,7 +71,7 @@ TODO:
  static char empty_sum[MAX_DIGEST_LEN];
  static int flist_count_offset; /* for --delete --progress */
  static int dir_count = 0;
-@@ -256,6 +259,45 @@ static int is_excluded(char *fname, int 
+@@ -262,6 +265,45 @@ static int is_excluded(char *fname, int is_dir, int filter_level)
        return 0;
  }
  
@@ -115,7 +117,7 @@ TODO:
  static void send_directory(int f, struct file_list *flist,
                           char *fbuf, int len, int flags);
  
-@@ -2169,6 +2211,25 @@ struct file_list *recv_file_list(int f)
+@@ -2183,6 +2225,25 @@ struct file_list *recv_file_list(int f)
  
        clean_flist(flist, relative_paths);
  
@@ -141,8 +143,9 @@ TODO:
        if (protocol_version < 30) {
                /* Recv the io_error flag */
                if (ignore_errors)
---- old/generator.c
-+++ new/generator.c
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
 @@ -79,6 +79,7 @@ extern char *basis_dir[];
  extern int compare_dest;
  extern int copy_dest;
@@ -299,7 +302,7 @@ TODO:
   */
  static enum delret delete_item(char *fbuf, int mode, char *replace, int flags)
  {
-@@ -160,6 +274,8 @@ static enum delret delete_item(char *fbu
+@@ -160,6 +274,8 @@ static enum delret delete_item(char *fbuf, int mode, char *replace, int flags)
                        goto check_ret;
                /* OK: try to delete the directory. */
        }
@@ -308,7 +311,7 @@ TODO:
  
        if (!replace && max_delete >= 0 && ++deletion_count > max_delete)
                return DR_AT_LIMIT;
-@@ -206,6 +322,8 @@ static enum delret delete_item(char *fbu
+@@ -206,6 +322,8 @@ static enum delret delete_item(char *fbuf, int mode, char *replace, int flags)
   * 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.)
@@ -317,7 +320,7 @@ TODO:
   */
  static enum delret delete_dir_contents(char *fname, int flags)
  {
-@@ -225,7 +343,9 @@ static enum delret delete_dir_contents(c
+@@ -225,7 +343,9 @@ static enum delret delete_dir_contents(char *fname, int flags)
        save_filters = push_local_filters(fname, dlen);
  
        non_perishable_cnt = 0;
@@ -327,7 +330,7 @@ TODO:
        ret = non_perishable_cnt ? DR_NOT_EMPTY : DR_SUCCESS;
  
        if (!dirlist->used)
-@@ -262,6 +382,8 @@ static enum delret delete_dir_contents(c
+@@ -262,6 +382,8 @@ static enum delret delete_dir_contents(char *fname, int flags)
                if (S_ISDIR(fp->mode)
                 && delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS)
                        ret = DR_NOT_EMPTY;
@@ -336,7 +339,7 @@ TODO:
                if (delete_item(fname, fp->mode, NULL, flags) != DR_SUCCESS)
                        ret = DR_NOT_EMPTY;
        }
-@@ -414,13 +536,18 @@ static void do_delayed_deletions(char *d
+@@ -414,13 +536,18 @@ static void do_delayed_deletions(char *delbuf)
   * 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
@@ -359,7 +362,7 @@ TODO:
  
        if (!fbuf) {
                change_local_filter_dir(NULL, 0, 0);
-@@ -430,21 +557,28 @@ static void delete_in_dir(char *fbuf, st
+@@ -430,21 +557,28 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
        if (verbose > 2)
                rprintf(FINFO, "delete_in_dir(%s)\n", fbuf);
  
@@ -393,7 +396,7 @@ TODO:
        if (one_file_system) {
                if (file->flags & FLAG_TOP_DIR)
                        filesystem_dev = *fs_dev;
-@@ -454,6 +588,14 @@ static void delete_in_dir(char *fbuf, st
+@@ -454,6 +588,14 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
  
        dirlist = get_dirlist(fbuf, dlen, 0);
  
@@ -408,7 +411,7 @@ TODO:
        /* If an item in dirlist is not found in flist, delete it
         * from the filesystem. */
        for (i = dirlist->used; i--; ) {
-@@ -466,16 +608,25 @@ static void delete_in_dir(char *fbuf, st
+@@ -466,16 +608,25 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
                                        f_name(fp, NULL));
                        continue;
                }
@@ -449,7 +452,7 @@ TODO:
  
        if (do_progress && !am_server)
                rprintf(FINFO, "                    \r");
-@@ -1139,6 +1290,7 @@ static void list_file_entry(struct file_
+@@ -1139,6 +1290,7 @@ static void list_file_entry(struct file_struct *f)
        }
  }
  
@@ -457,7 +460,7 @@ TODO:
  static int phase = 0;
  static int dflt_perms;
  
-@@ -1383,8 +1535,12 @@ static void recv_generator(char *fname, 
+@@ -1383,8 +1535,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                        }
                }
                else if (delete_during && f_out != -1 && !phase && dry_run < 2
@@ -472,7 +475,7 @@ TODO:
                goto cleanup;
        }
  
-@@ -1662,8 +1818,14 @@ static void recv_generator(char *fname, 
+@@ -1662,8 +1818,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                        goto cleanup;
                }
  #endif
@@ -485,10 +488,10 @@ TODO:
 +                      }
                        goto notify_others;
 +              }
-               rsyserr(FERROR, stat_errno, "recv_generator: failed to stat %s",
+               rsyserr(FERROR_XFER, stat_errno, "recv_generator: failed to stat %s",
                        full_fname(fname));
                goto cleanup;
-@@ -2000,6 +2162,12 @@ void generate_files(int f_out, const cha
+@@ -2000,6 +2162,12 @@ void generate_files(int f_out, const char *local_name)
        if (verbose > 2)
                rprintf(FINFO, "generator starting pid=%ld\n", (long)getpid());
  
@@ -501,7 +504,7 @@ TODO:
        if (delete_before && !solo_file && cur_flist->used > 0)
                do_delete_pass();
        if (delete_during == 2) {
-@@ -2010,7 +2178,7 @@ void generate_files(int f_out, const cha
+@@ -2010,7 +2178,7 @@ void generate_files(int f_out, const char *local_name)
        }
        do_progress = 0;
  
@@ -510,7 +513,7 @@ TODO:
                whole_file = 0;
        if (verbose >= 2) {
                rprintf(FINFO, "delta-transmission %s\n",
-@@ -2048,7 +2216,7 @@ void generate_files(int f_out, const cha
+@@ -2048,7 +2216,7 @@ void generate_files(int f_out, const char *local_name)
                                                dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
                                        } else
                                                dirdev = MAKEDEV(0, 0);
@@ -519,7 +522,7 @@ TODO:
                                }
                        }
                }
-@@ -2091,7 +2259,21 @@ void generate_files(int f_out, const cha
+@@ -2091,7 +2259,21 @@ void generate_files(int f_out, const char *local_name)
        } while ((cur_flist = cur_flist->next) != NULL);
  
        if (delete_during)
@@ -542,8 +545,9 @@ TODO:
        phase++;
        if (verbose > 2)
                rprintf(FINFO, "generate_files phase=%d\n", phase);
---- old/options.c
-+++ new/options.c
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
 @@ -80,6 +80,7 @@ int am_generator = 0;
  int am_starting_up = 1;
  int relative_paths = -1;
@@ -552,7 +556,7 @@ TODO:
  int numeric_ids = 0;
  int allow_8bit_chars = 0;
  int force_delete = 0;
-@@ -383,6 +384,7 @@ void usage(enum logcode F)
+@@ -385,6 +386,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");
@@ -560,7 +564,7 @@ TODO:
    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");
-@@ -561,6 +563,7 @@ static struct poptOption long_options[] 
+@@ -563,6 +565,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 },
@@ -568,7 +572,7 @@ TODO:
    {"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 },
-@@ -1532,7 +1535,7 @@ int parse_arguments(int *argc_p, const c
+@@ -1535,7 +1538,7 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                inplace = 1;
        }
  
@@ -577,7 +581,7 @@ TODO:
                partial_dir = tmp_partialdir;
  
        if (inplace) {
-@@ -1541,6 +1544,7 @@ int parse_arguments(int *argc_p, const c
+@@ -1544,6 +1547,7 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                        snprintf(err_buf, sizeof err_buf,
                                 "--%s cannot be used with --%s\n",
                                 append_mode ? "append" : "inplace",
@@ -585,7 +589,7 @@ TODO:
                                 delay_updates ? "delay-updates" : "partial-dir");
                        return 0;
                }
-@@ -1885,6 +1889,8 @@ void server_options(char **args, int *ar
+@@ -1888,6 +1892,8 @@ void server_options(char **args, int *argc_p)
                        args[ac++] = "--super";
                if (size_only)
                        args[ac++] = "--size-only";
@@ -594,9 +598,10 @@ TODO:
        } else {
                if (skip_compress) {
                        if (asprintf(&arg, "--skip-compress=%s", skip_compress) < 0)
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -384,6 +384,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -385,6 +385,7 @@ to the detailed description below for a complete description.  verb(
       --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
@@ -604,7 +609,7 @@ TODO:
       --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
-@@ -1438,6 +1439,21 @@ Note that the use of the bf(--delete) op
+@@ -1451,6 +1452,21 @@ Note that the use of the bf(--delete) option might get rid of any potential
  fuzzy-match files, so either use bf(--delete-after) or specify some
  filename exclusions if you need to prevent this.
  
@@ -626,9 +631,10 @@ TODO:
  dit(bf(--compare-dest=DIR)) This option instructs rsync to use em(DIR) on
  the destination machine as an additional hierarchy to compare destination
  files against doing transfers (if the files are missing in the destination
---- old/util.c
-+++ new/util.c
-@@ -1042,6 +1042,32 @@ int handle_partial_dir(const char *fname
+diff --git a/util.c b/util.c
+--- a/util.c
++++ b/util.c
+@@ -1019,6 +1019,32 @@ int handle_partial_dir(const char *fname, int create)
        return 1;
  }
  
index 08598d1..5ef63b1 100644 (file)
@@ -7,8 +7,9 @@ To use this patch, run these commands for a successful build:
     ./configure                                 (optional if already run)
     make
 
---- old/generator.c
-+++ new/generator.c
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
 @@ -54,6 +54,7 @@ extern int ignore_errors;
  extern int remove_source_files;
  extern int delay_updates;
@@ -17,7 +18,7 @@ To use this patch, run these commands for a successful build:
  extern int ignore_existing;
  extern int ignore_non_existing;
  extern int inplace;
-@@ -1528,6 +1529,13 @@ static void recv_generator(char *fname, 
+@@ -1603,6 +1604,13 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                goto cleanup;
        }
  
@@ -31,7 +32,7 @@ To use this patch, run these commands for a successful build:
        fnamecmp = fname;
        fnamecmp_type = FNAMECMP_FNAME;
  
-@@ -1825,6 +1833,7 @@ void check_for_finished_files(int itemiz
+@@ -1917,6 +1925,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
                ignore_existing = -ignore_existing;
                ignore_non_existing = -ignore_non_existing;
                update_only = -update_only;
@@ -39,7 +40,7 @@ To use this patch, run these commands for a successful build:
                always_checksum = -always_checksum;
                size_only = -size_only;
                append_mode = -append_mode;
-@@ -1850,6 +1859,7 @@ void check_for_finished_files(int itemiz
+@@ -1942,6 +1951,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
                ignore_existing = -ignore_existing;
                ignore_non_existing = -ignore_non_existing;
                update_only = -update_only;
@@ -47,9 +48,10 @@ To use this patch, run these commands for a successful build:
                always_checksum = -always_checksum;
                size_only = -size_only;
                append_mode = -append_mode;
---- old/options.c
-+++ new/options.c
-@@ -57,6 +57,7 @@ int preserve_uid = 0;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -58,6 +58,7 @@ int preserve_uid = 0;
  int preserve_gid = 0;
  int preserve_times = 0;
  int update_only = 0;
@@ -57,7 +59,7 @@ To use this patch, run these commands for a successful build:
  int cvs_exclude = 0;
  int dry_run = 0;
  int do_xfers = 1;
-@@ -318,6 +319,7 @@ void usage(enum logcode F)
+@@ -320,6 +321,7 @@ void usage(enum logcode F)
    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");
@@ -65,7 +67,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F,"     --inplace               update destination files in-place (SEE MAN PAGE)\n");
    rprintf(F,"     --append                append data onto shorter files\n");
    rprintf(F,"     --append-verify         like --append, but with old data in file checksum\n");
-@@ -522,6 +524,7 @@ static struct poptOption long_options[] 
+@@ -524,6 +526,7 @@ static struct poptOption long_options[] = {
    {"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 },
index e0a3558..d3448df 100644 (file)
@@ -63,8 +63,9 @@ Changes:
 * pass --drop-cache on to the remote server
 * make test works now
 
---- old/checksum.c
-+++ new/checksum.c
+diff --git a/checksum.c b/checksum.c
+--- a/checksum.c
++++ b/checksum.c
 @@ -26,6 +26,10 @@ extern int protocol_version;
  
  int csum_length = SHORT_SUM_LENGTH; /* initial value */
@@ -76,8 +77,9 @@ Changes:
  /*
    a simple 32 bit checksum that can be upadted from either end
    (inspired by Mark Adler's Adler-32 checksum)
---- old/cleanup.c
-+++ new/cleanup.c
+diff --git a/cleanup.c b/cleanup.c
+--- a/cleanup.c
++++ b/cleanup.c
 @@ -46,7 +46,13 @@ void close_all(void)
        int fd;
        int ret;
@@ -92,9 +94,10 @@ Changes:
        max_fd = sysconf(_SC_OPEN_MAX) - 1;
        for (fd = max_fd; fd >= 0; fd--) {
                if ((ret = do_fstat(fd, &st)) == 0) {
---- old/configure.in
-+++ new/configure.in
-@@ -547,7 +547,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
+diff --git a/configure.in b/configure.in
+--- a/configure.in
++++ b/configure.in
+@@ -552,7 +552,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
      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 getxattr \
@@ -103,8 +106,9 @@ Changes:
  
  AC_CHECK_FUNCS(getpgrp tcgetpgrp)
  if test $ac_cv_func_getpgrp = yes; then
---- old/fileio.c
-+++ new/fileio.c
+diff --git a/fileio.c b/fileio.c
+--- a/fileio.c
++++ b/fileio.c
 @@ -30,6 +30,12 @@ extern int sparse_files;
  static char last_byte;
  static size_t sparse_seek = 0;
@@ -118,8 +122,9 @@ Changes:
  int sparse_end(int f)
  {
        int ret;
---- old/generator.c
-+++ new/generator.c
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
 @@ -112,6 +112,10 @@ static int need_retouch_dir_times;
  static int need_retouch_dir_perms;
  static const char *solo_file = NULL;
@@ -131,8 +136,9 @@ Changes:
  /* 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 */
---- old/options.c
-+++ new/options.c
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
 @@ -58,6 +58,7 @@ int preserve_uid = 0;
  int preserve_gid = 0;
  int preserve_times = 0;
@@ -141,7 +147,7 @@ Changes:
  int cvs_exclude = 0;
  int dry_run = 0;
  int do_xfers = 1;
-@@ -319,6 +320,9 @@ void usage(enum logcode F)
+@@ -320,6 +321,9 @@ void usage(enum logcode F)
    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");
@@ -151,7 +157,7 @@ Changes:
    rprintf(F,"     --inplace               update destination files in-place (SEE MAN PAGE)\n");
    rprintf(F,"     --append                append data onto shorter files\n");
    rprintf(F,"     --append-verify         like --append, but with old data in file checksum\n");
-@@ -522,6 +526,9 @@ static struct poptOption long_options[] 
+@@ -524,6 +528,9 @@ static struct poptOption long_options[] = {
    {"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 },
@@ -161,7 +167,7 @@ Changes:
    {"existing",         0,  POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
    {"ignore-non-existing",0,POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
    {"ignore-existing",  0,  POPT_ARG_NONE,   &ignore_existing, 0, 0, 0 },
-@@ -1659,6 +1666,11 @@ void server_options(char **args, int *ar
+@@ -1662,6 +1669,11 @@ void server_options(char **args, int *argc_p)
        if (!am_sender)
                args[ac++] = "--sender";
  
@@ -173,8 +179,9 @@ Changes:
        x = 1;
        argstr[0] = '-';
  
---- old/receiver.c
-+++ new/receiver.c
+diff --git a/receiver.c b/receiver.c
+--- a/receiver.c
++++ b/receiver.c
 @@ -62,6 +62,10 @@ static int phase = 0, redoing = 0;
  /* We're either updating the basis file or an identical copy: */
  static int updating_basis_or_equiv;
@@ -186,9 +193,10 @@ Changes:
  /*
   * get_tmpname() - create a tmp filename for a given filename
   *
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -352,6 +352,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -352,6 +352,7 @@ to the detailed description below for a complete description.  verb(
       --super                 receiver attempts super-user activities
       --fake-super            store/recover privileged attrs using xattrs
   -S, --sparse                handle sparse files efficiently
@@ -196,7 +204,7 @@ Changes:
   -n, --dry-run               perform a trial run with no changes made
   -W, --whole-file            copy files whole (without rsync algorithm)
   -x, --one-file-system       don't cross filesystem boundaries
-@@ -1022,6 +1023,10 @@ NOTE: Don't use this option when the des
+@@ -1023,6 +1024,10 @@ NOTE: Don't use this option when the destination is a Solaris "tmpfs"
  filesystem. It doesn't seem to handle seeks over null regions
  correctly and ends up corrupting the files.
  
@@ -207,8 +215,9 @@ Changes:
  dit(bf(-n, --dry-run)) This makes rsync perform a trial run that doesn't
  make any changes (and produces mostly the same output as a real run).  It
  is most commonly used in combination with the bf(-v, --verbose) and/or
---- old/sender.c
-+++ new/sender.c
+diff --git a/sender.c b/sender.c
+--- a/sender.c
++++ b/sender.c
 @@ -46,6 +46,10 @@ extern int write_batch;
  extern struct stats stats;
  extern struct file_list *cur_flist, *first_flist, *dir_flist;
@@ -220,8 +229,9 @@ Changes:
  /**
   * @file
   *
---- old/t_unsafe.c
-+++ new/t_unsafe.c
+diff --git a/t_unsafe.c b/t_unsafe.c
+--- a/t_unsafe.c
++++ b/t_unsafe.c
 @@ -28,6 +28,7 @@ int am_root = 0;
  int read_only = 0;
  int list_only = 0;
@@ -230,8 +240,9 @@ Changes:
  int preserve_perms = 0;
  
  int
---- old/util.c
-+++ new/util.c
+diff --git a/util.c b/util.c
+--- a/util.c
++++ b/util.c
 @@ -26,6 +26,7 @@
  extern int verbose;
  extern int dry_run;
diff --git a/dynamic_hash.diff b/dynamic_hash.diff
deleted file mode 100644 (file)
index 4294ae3..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-This patch makes the processing of large really large files more efficient
-by making sure that the sender's hash table is large enough to hold all the
-checksum entries without being overloaded.
-
-Updated to use the current hashtable method when possible, and the new
-hashtable method (which requires a modulus calculation for up to every byte
-of the source file) only on large files that need a larger hashtable size.
-This avoids slowing down files that don't need the extra-large hashtable.
-
-This was updated for the latest codebase from a patch written by Shachar
-Shemesh.
-
-To use this patch, run these commands for a successful build:
-
-    patch -p1 <patches/dynamic_hash.diff
-    ./configure                                 (optional if already run)
-    make
-
---- old/match.c
-+++ new/match.c
-@@ -39,40 +39,51 @@ static int total_matches;
- extern struct stats stats;
--#define TABLESIZE (1<<16)
-+#define TRADITIONAL_TABLESIZE (1<<16)
-+static uint32 tablesize;
- static int32 *hash_table;
- #define SUM2HASH2(s1,s2) (((s1) + (s2)) & 0xFFFF)
- #define SUM2HASH(sum) SUM2HASH2((sum)&0xFFFF,(sum)>>16)
--static int32 build_hash_table(struct sum_struct *s, int32 start)
-+#define BIG_SUM2HASH(sum) ((sum)%tablesize)
-+
-+static void build_hash_table(struct sum_struct *s)
- {
--      int32 i, end = s->count;
-+      static uint32 alloc_size;
-+      int32 i;
--      if (!hash_table) {
--              hash_table = new_array(int32, TABLESIZE);
-+      /* Dynamically calculate the hash table size so that the hash load
-+       * for big files is about 80%.  A number greater than the traditional
-+       * size must be odd or s2 will not be able to span the entire set. */
-+      tablesize = (uint32)(s->count/8) * 10 + 11;
-+      if (tablesize < TRADITIONAL_TABLESIZE)
-+              tablesize = TRADITIONAL_TABLESIZE;
-+      if (tablesize > alloc_size || tablesize < alloc_size - 16*1024) {
-+              if (hash_table)
-+                      free(hash_table);
-+              hash_table = new_array(int32, tablesize);
-               if (!hash_table)
-                       out_of_memory("build_hash_table");
-+              alloc_size = tablesize;
-       }
--      memset(hash_table, 0xFF, TABLESIZE * sizeof hash_table[0]);
--
--      if (end - start > TABLESIZE*8/10)
--              end = start + TABLESIZE*8/10;
--
--      for (i = start; i < end; i++) {
--              uint32 t = SUM2HASH(s->sums[i].sum1);
--              s->sums[i].chain = hash_table[t];
--              hash_table[t] = i;
--      }
-+      memset(hash_table, 0xFF, tablesize * sizeof hash_table[0]);
--      if (verbose > 2) {
--              rprintf(FINFO, "built hash table for entries %ld - %ld\n",
--                      (long)start, (long)end - 1);
-+      if (tablesize == TRADITIONAL_TABLESIZE) {
-+              for (i = 0; i < s->count; i++) {
-+                      uint32 t = SUM2HASH(s->sums[i].sum1);
-+                      s->sums[i].chain = hash_table[t];
-+                      hash_table[t] = i;
-+              }
-+      } else {
-+              for (i = 0; i < s->count; i++) {
-+                      uint32 t = BIG_SUM2HASH(s->sums[i].sum1);
-+                      s->sums[i].chain = hash_table[t];
-+                      hash_table[t] = i;
-+              }
-       }
--
--      return end;
- }
-@@ -130,8 +141,8 @@ static void matched(int f, struct sum_st
- static void hash_search(int f,struct sum_struct *s,
-                       struct map_struct *buf, OFF_T len)
- {
--      OFF_T offset, end, reset = 0;
--      int32 k, want_i, backup, sum_pos = 0;
-+      OFF_T offset, end;
-+      int32 k, want_i, backup;
-       char sum2[SUM_LENGTH];
-       uint32 s1, s2, sum;
-       int more;
-@@ -169,24 +180,21 @@ static void hash_search(int f,struct sum
-               int done_csum2 = 0;
-               int32 i;
--              if (offset >= reset) {
--                      sum_pos = build_hash_table(s, sum_pos);
--                      if (sum_pos == s->count)
--                              reset = len;
--                      else
--                              reset = sum_pos * s->blength;
--              }
--
-               if (verbose > 4) {
-                       rprintf(FINFO, "offset=%.0f sum=%04x%04x\n",
-                               (double)offset, s2 & 0xFFFF, s1 & 0xFFFF);
-               }
--              i = hash_table[SUM2HASH2(s1,s2)];
--              if (i < 0)
--                      goto null_hash;
-+              if (tablesize == TRADITIONAL_TABLESIZE) {
-+                      if ((i = hash_table[SUM2HASH2(s1,s2)]) < 0)
-+                              goto null_hash;
-+                      sum = (s1 & 0xffff) | (s2 << 16);
-+              } else {
-+                      sum = (s1 & 0xffff) | (s2 << 16);
-+                      if ((i = hash_table[BIG_SUM2HASH(sum)]) < 0)
-+                              goto null_hash;
-+              }
--              sum = (s1 & 0xffff) | (s2 << 16);
-               hash_hits++;
-               do {
-                       int32 l;
-@@ -354,6 +362,11 @@ void match_sums(int f, struct sum_struct
-       }
-       if (len > 0 && s->count > 0) {
-+              build_hash_table(s);
-+
-+              if (verbose > 2)
-+                      rprintf(FINFO,"built hash table\n");
-+
-               hash_search(f, s, buf, len);
-               if (verbose > 2)
diff --git a/early-checksum.diff b/early-checksum.diff
deleted file mode 100644 (file)
index 6f6c931..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-This patch changes the way the --checksum option works by having the
-receiving side perform a checksum-read of every file in the file list
-as the list is received (if the sizes are equal), marking non-matching
-items with a flag.  The idea is that the checksum pass on the sender and
-the receiver can then happen in parallel instead of having the reciever
-to its checksum pass during its normal find-the-different-files pass.
-
-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.
-
-To use this patch, run these commands for a successful build:
-
-    patch -p1 <patches/early-checksum.diff
-    ./configure                                 (optional if already run)
-    make
-
---- old/flist.c
-+++ new/flist.c
-@@ -34,6 +34,7 @@ extern int am_generator;
- extern int inc_recurse;
- extern int do_progress;
- extern int always_checksum;
-+extern int pre_checksum;
- extern int module_id;
- extern int ignore_errors;
- extern int numeric_ids;
-@@ -949,6 +950,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 && bp != tmp_sum) {
-+                      STRUCT_STAT st;
-+                      char *fname = f_name(file, NULL);
-+                      if (stat(fname, &st) == 0 && st.st_size == file_length) {
-+                              file_checksum(fname, tmp_sum, st.st_size);
-+                              if (memcmp(bp, tmp_sum, checksum_len) != 0)
-+                                      file->flags |= FLAG_SUM_DIFFERS;
-+                      }
-+              }
-       }
- #ifdef SUPPORT_ACLS
---- old/generator.c
-+++ new/generator.c
-@@ -73,6 +73,7 @@ extern int protocol_version;
- extern int file_total;
- extern int fuzzy_basis;
- extern int always_checksum;
-+extern int pre_checksum;
- extern int checksum_len;
- extern char *partial_dir;
- extern char *basis_dir[];
-@@ -617,7 +618,8 @@ 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)
-+int unchanged_file(char *fn, int fnamecmp_type, struct file_struct *file,
-+                 STRUCT_STAT *st)
- {
-       if (st->st_size != F_LENGTH(file))
-               return 0;
-@@ -626,6 +628,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[MAX_DIGEST_LEN];
-+              if (pre_checksum && fnamecmp_type == FNAMECMP_FNAME)
-+                      return !(file->flags & FLAG_SUM_DIFFERS);
-               file_checksum(fn, sum, st->st_size);
-               return memcmp(sum, F_SUM(file), checksum_len) == 0;
-       }
-@@ -846,7 +850,7 @@ static int try_dests_reg(struct file_str
-                       match_level = 1;
-                       /* FALL THROUGH */
-               case 1:
--                      if (!unchanged_file(cmpbuf, file, &sxp->st))
-+                      if (!unchanged_file(cmpbuf, 0, file, &sxp->st))
-                               continue;
-                       best_match = j;
-                       match_level = 2;
-@@ -1638,7 +1642,7 @@ static void recv_generator(char *fname, 
-               ;
-       else if (fnamecmp_type == FNAMECMP_FUZZY)
-               ;
--      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
-@@ -353,7 +353,7 @@ int hard_link_check(struct file_struct *
-                               }
-                               break;
-                       }
--                      if (!unchanged_file(cmpbuf, file, &alt_sx.st))
-+                      if (!unchanged_file(cmpbuf, 0, file, &alt_sx.st))
-                               continue;
-                       statret = 1;
-                       if (unchanged_attrs(cmpbuf, file, &alt_sx))
---- old/main.c
-+++ new/main.c
-@@ -46,6 +46,7 @@ extern int module_id;
- extern int copy_links;
- extern int copy_dirlinks;
- extern int keep_dirlinks;
-+extern int always_checksum;
- extern int preserve_hard_links;
- extern int protocol_version;
- extern int file_total;
-@@ -78,6 +79,9 @@ extern struct filter_list_struct server_
- extern iconv_t ic_send;
- #endif
-+extern char curr_dir[MAXPATHLEN];
-+
-+int pre_checksum = 0;
- int local_server = 0;
- int daemon_over_rsh = 0;
- mode_t orig_umask = 0;
-@@ -850,6 +854,7 @@ static void do_server_recv(int f_in, int
-       struct file_list *flist;
-       char *local_name = NULL;
-       char *dir = NULL;
-+      char olddir[sizeof curr_dir];
-       int save_verbose = verbose;
-       if (filesfrom_fd >= 0) {
-@@ -896,6 +901,10 @@ static void do_server_recv(int f_in, int
-               filesfrom_fd = -1;
-       }
-+      strlcpy(olddir, curr_dir, sizeof olddir);
-+      if (always_checksum && !local_server && argc > 0)
-+              pre_checksum = push_dir(argv[0], 0);
-+
-       flist = recv_file_list(f_in);
-       if (!flist) {
-               rprintf(FERROR,"server_recv: recv_file_list error\n");
-@@ -905,6 +914,9 @@ static void do_server_recv(int f_in, int
-               recv_additional_file_list(f_in);
-       verbose = save_verbose;
-+      if (pre_checksum)
-+              pop_dir(olddir);
-+
-       if (argc > 0)
-               local_name = get_local_name(flist,argv[0]);
-@@ -981,6 +993,7 @@ int client_run(int f_in, int f_out, pid_
- {
-       struct file_list *flist = NULL;
-       int exit_code = 0, exit_code2 = 0;
-+      char olddir[sizeof curr_dir];
-       char *local_name = NULL;
-       cleanup_child_pid = pid;
-@@ -1058,12 +1071,19 @@ int client_run(int f_in, int f_out, pid_
-               filesfrom_fd = -1;
-       }
-+      strlcpy(olddir, curr_dir, sizeof olddir);
-+      if (always_checksum && !local_server)
-+              pre_checksum = push_dir(argv[0], 0);
-+
-       if (write_batch && !am_server)
-               start_write_batch(f_in);
-       flist = recv_file_list(f_in);
-       if (inc_recurse && file_total == 1)
-               recv_additional_file_list(f_in);
-+      if (pre_checksum)
-+              pop_dir(olddir);
-+
-       if (flist && flist->used > 0) {
-               local_name = get_local_name(flist, argv[0]);
---- old/rsync.h
-+++ new/rsync.h
-@@ -73,6 +73,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 */
-+#define FLAG_SUM_DIFFERS (1<<11)/* receiver/generator */
- /* These flags are passed to functions but not stored. */
index 6bfabb1..8ad65fc 100644 (file)
@@ -8,8 +8,9 @@ To use this patch, run these commands for a successful build:
     ./configure
     make
 
---- old/compat.c
-+++ new/compat.c
+diff --git a/compat.c b/compat.c
+--- a/compat.c
++++ b/compat.c
 @@ -44,6 +44,7 @@ extern int protocol_version;
  extern int protect_args;
  extern int preserve_uid;
@@ -36,9 +37,10 @@ To use this patch, run these commands for a successful build:
        if (preserve_acls && !am_sender)
                acls_ndx = ++file_extra_cnt;
        if (preserve_xattrs)
---- old/configure.in
-+++ new/configure.in
-@@ -544,7 +544,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
+diff --git a/configure.in b/configure.in
+--- a/configure.in
++++ b/configure.in
+@@ -551,7 +551,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
      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 \
@@ -47,8 +49,9 @@ To use this patch, run these commands for a successful build:
      extattr_get_link sigaction sigprocmask setattrlist)
  
  AC_CHECK_FUNCS(getpgrp tcgetpgrp)
---- old/flist.c
-+++ new/flist.c
+diff --git a/flist.c b/flist.c
+--- a/flist.c
++++ b/flist.c
 @@ -50,6 +50,7 @@ extern int preserve_links;
  extern int preserve_hard_links;
  extern int preserve_devices;
@@ -57,7 +60,7 @@ To use this patch, run these commands for a successful build:
  extern int uid_ndx;
  extern int gid_ndx;
  extern int eol_nulls;
-@@ -339,6 +340,9 @@ static void send_file_entry(int f, struc
+@@ -345,6 +346,9 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_
  {
        static time_t modtime;
        static mode_t mode;
@@ -67,7 +70,7 @@ To use this patch, run these commands for a successful build:
  #ifdef SUPPORT_HARD_LINKS
        static int64 dev;
  #endif
-@@ -397,6 +401,12 @@ static void send_file_entry(int f, struc
+@@ -403,6 +407,12 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_
                xflags |= XMIT_SAME_MODE;
        else
                mode = file->mode;
@@ -80,7 +83,7 @@ To use this patch, run these commands for a successful build:
  
        if ((preserve_devices && IS_DEVICE(mode))
         || (preserve_specials && IS_SPECIAL(mode))) {
-@@ -517,6 +527,10 @@ static void send_file_entry(int f, struc
+@@ -523,6 +533,10 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_
        }
        if (!(xflags & XMIT_SAME_MODE))
                write_int(f, to_wire_mode(mode));
@@ -91,7 +94,7 @@ To use this patch, run these commands for a successful build:
        if (uid_ndx && !(xflags & XMIT_SAME_UID)) {
                if (protocol_version < 30)
                        write_int(f, uid);
-@@ -605,6 +619,9 @@ static struct file_struct *recv_file_ent
+@@ -611,6 +625,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
  {
        static int64 modtime;
        static mode_t mode;
@@ -101,7 +104,7 @@ To use this patch, run these commands for a successful build:
  #ifdef SUPPORT_HARD_LINKS
        static int64 dev;
  #endif
-@@ -736,9 +753,12 @@ static struct file_struct *recv_file_ent
+@@ -742,9 +759,12 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
        }
        if (!(xflags & XMIT_SAME_MODE))
                mode = from_wire_mode(read_int(f));
@@ -115,7 +118,7 @@ To use this patch, run these commands for a successful build:
  
        if (uid_ndx && !(xflags & XMIT_SAME_UID)) {
                if (protocol_version < 30)
-@@ -858,6 +878,10 @@ static struct file_struct *recv_file_ent
+@@ -866,6 +886,10 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
                OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32);
        }
        file->mode = mode;
@@ -126,7 +129,7 @@ To use this patch, run these commands for a successful build:
        if (uid_ndx)
                F_OWNER(file) = uid;
        if (gid_ndx) {
-@@ -1182,6 +1206,10 @@ struct file_struct *make_file(const char
+@@ -1196,6 +1220,10 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
                OPT_EXTRA(file, 0)->unum = (uint32)(st.st_size >> 32);
        }
        file->mode = st.st_mode;
@@ -137,8 +140,9 @@ To use this patch, run these commands for a successful build:
        if (uid_ndx)
                F_OWNER(file) = st.st_uid;
        if (gid_ndx)
---- old/generator.c
-+++ new/generator.c
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
 @@ -112,6 +112,14 @@ static int need_retouch_dir_times;
  static int need_retouch_dir_perms;
  static const char *solo_file = NULL;
@@ -186,7 +190,7 @@ To use this patch, run these commands for a successful build:
        if (S_ISDIR(mode) && !(flags & DEL_DIR_IS_EMPTY)) {
                ignore_perishable = 1;
                /* If DEL_RECURSE is not set, this just reports emptiness. */
-@@ -262,7 +272,7 @@ static enum delret delete_dir_contents(c
+@@ -262,7 +272,7 @@ static enum delret delete_dir_contents(char *fname, int flags)
                if (S_ISDIR(fp->mode)
                 && delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS)
                        ret = DR_NOT_EMPTY;
@@ -195,7 +199,7 @@ To use this patch, run these commands for a successful build:
                        ret = DR_NOT_EMPTY;
        }
  
-@@ -318,8 +328,9 @@ static int remember_delete(struct file_s
+@@ -318,8 +328,9 @@ static int remember_delete(struct file_struct *file, const char *fname)
  
        while (1) {
                len = snprintf(deldelay_buf + deldelay_cnt,
@@ -207,7 +211,7 @@ To use this patch, run these commands for a successful build:
                if ((deldelay_cnt += len) <= deldelay_size)
                        break;
                if (deldelay_fd < 0 && !start_delete_delay_temp())
-@@ -332,7 +343,7 @@ static int remember_delete(struct file_s
+@@ -332,7 +343,7 @@ static int remember_delete(struct file_struct *file, const char *fname)
        return 1;
  }
  
@@ -250,7 +254,7 @@ To use this patch, run these commands for a successful build:
        if (deldelay_fd >= 0)
                close(deldelay_fd);
  }
-@@ -472,7 +483,7 @@ static void delete_in_dir(char *fbuf, st
+@@ -472,7 +483,7 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
                                if (!remember_delete(fp, delbuf))
                                        break;
                        } else
@@ -259,7 +263,7 @@ To use this patch, run these commands for a successful build:
                }
        }
  
-@@ -1296,7 +1307,7 @@ static void recv_generator(char *fname, 
+@@ -1296,7 +1307,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                         * full later (right before we handle its contents). */
                        if (statret == 0
                         && (S_ISDIR(sx.st.st_mode)
@@ -268,7 +272,7 @@ To use this patch, run these commands for a successful build:
                                goto cleanup; /* Any errors get reported later. */
                        if (do_mkdir(fname, file->mode & 0700) == 0)
                                file->flags |= FLAG_DIR_CREATED;
-@@ -1308,7 +1319,7 @@ static void recv_generator(char *fname, 
+@@ -1308,7 +1319,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                 * we need to delete it.  If it doesn't exist, then
                 * (perhaps recursively) create it. */
                if (statret == 0 && !S_ISDIR(sx.st.st_mode)) {
@@ -277,7 +281,7 @@ To use this patch, run these commands for a successful build:
                                goto skipping_dir_contents;
                        statret = -1;
                }
-@@ -1437,7 +1448,7 @@ static void recv_generator(char *fname, 
+@@ -1437,7 +1448,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                        }
                        /* Not the right symlink (or not a symlink), so
                         * delete it. */
@@ -286,7 +290,7 @@ To use this patch, run these commands for a successful build:
                                goto cleanup;
                } else if (basis_dir[0] != NULL) {
                        int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx,
-@@ -1516,7 +1527,7 @@ static void recv_generator(char *fname, 
+@@ -1516,7 +1527,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                                        goto return_with_success;
                                goto cleanup;
                        }
@@ -295,7 +299,7 @@ To use this patch, run these commands for a successful build:
                                goto cleanup;
                } else if (basis_dir[0] != NULL) {
                        int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx,
-@@ -1607,7 +1618,7 @@ static void recv_generator(char *fname, 
+@@ -1607,7 +1618,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
        fnamecmp_type = FNAMECMP_FNAME;
  
        if (statret == 0 && !S_ISREG(sx.st.st_mode)) {
@@ -304,8 +308,9 @@ To use this patch, run these commands for a successful build:
                        goto cleanup;
                statret = -1;
                stat_errno = ENOENT;
---- old/options.c
-+++ new/options.c
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
 @@ -51,6 +51,7 @@ int preserve_hard_links = 0;
  int preserve_acls = 0;
  int preserve_xattrs = 0;
@@ -314,7 +319,7 @@ To use this patch, run these commands for a successful build:
  int preserve_executability = 0;
  int preserve_devices = 0;
  int preserve_specials = 0;
-@@ -221,6 +222,7 @@ static void print_rsync_version(enum log
+@@ -222,6 +223,7 @@ static void print_rsync_version(enum logcode f)
        char const *links = "no ";
        char const *iconv = "no ";
        char const *ipv6 = "no ";
@@ -322,7 +327,7 @@ To use this patch, run these commands for a successful build:
        STRUCT_STAT *dumstat;
  
  #if SUBPROTOCOL_VERSION != 0
-@@ -250,6 +252,9 @@ static void print_rsync_version(enum log
+@@ -251,6 +253,9 @@ static void print_rsync_version(enum logcode f)
  #ifdef ICONV_OPTION
        iconv = "";
  #endif
@@ -332,7 +337,7 @@ To use this patch, run these commands for a successful build:
  
        rprintf(f, "%s  version %s  protocol version %d%s\n",
                RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -263,8 +268,8 @@ static void print_rsync_version(enum log
+@@ -264,8 +269,8 @@ static void print_rsync_version(enum logcode f)
                (int)(sizeof (int64) * 8));
        rprintf(f, "    %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
                got_socketpair, hardlinks, links, ipv6, have_inplace);
@@ -343,7 +348,7 @@ To use this patch, run these commands for a successful build:
  
  #ifdef MAINTAINER_MODE
        rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -331,6 +336,7 @@ void usage(enum logcode F)
+@@ -332,6 +337,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");
@@ -351,7 +356,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F," -E, --executability         preserve the file's executability\n");
    rprintf(F,"     --chmod=CHMOD           affect file and/or directory permissions\n");
  #ifdef SUPPORT_ACLS
-@@ -470,6 +476,8 @@ static struct poptOption long_options[] 
+@@ -472,6 +478,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 },
@@ -360,7 +365,7 @@ To use this patch, run these commands for a successful build:
    {"executability",   'E', POPT_ARG_NONE,   &preserve_executability, 0, 0, 0 },
    {"acls",            'A', POPT_ARG_NONE,   0, 'A', 0, 0 },
    {"no-acls",          0,  POPT_ARG_VAL,    &preserve_acls, 0, 0, 0 },
-@@ -1284,6 +1292,15 @@ int parse_arguments(int *argc_p, const c
+@@ -1287,6 +1295,15 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
        }
  #endif
  
@@ -376,7 +381,7 @@ To use this patch, run these commands for a successful build:
        if (write_batch && read_batch) {
                snprintf(err_buf, sizeof err_buf,
                        "--write-batch and --read-batch can not be used together\n");
-@@ -1792,6 +1809,9 @@ void server_options(char **args, int *ar
+@@ -1795,6 +1812,9 @@ void server_options(char **args, int *argc_p)
        if (xfer_dirs && !recurse && delete_mode && am_sender)
                args[ac++] = "--no-r";
  
@@ -386,8 +391,9 @@ To use this patch, run these commands for a successful build:
        if (do_compression && def_compress_level != Z_DEFAULT_COMPRESSION) {
                if (asprintf(&arg, "--compress-level=%d", def_compress_level) < 0)
                        goto oom;
---- old/rsync.c
-+++ new/rsync.c
+diff --git a/rsync.c b/rsync.c
+--- a/rsync.c
++++ b/rsync.c
 @@ -32,6 +32,7 @@ extern int dry_run;
  extern int preserve_acls;
  extern int preserve_xattrs;
@@ -413,7 +419,7 @@ To use this patch, run these commands for a successful build:
  static const char *default_charset(void)
  {
  # if defined HAVE_LIBCHARSET_H && defined HAVE_LOCALE_CHARSET
-@@ -337,6 +348,41 @@ mode_t dest_mode(mode_t flist_mode, mode
+@@ -337,6 +348,41 @@ mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms,
        return new_mode;
  }
  
@@ -422,7 +428,7 @@ To use this patch, run these commands for a successful build:
 +static int set_fileflags(const char *fname, uint32 fileflags)
 +{
 +      if (do_chflags(fname, fileflags) != 0) {
-+              rsyserr(FERROR, errno,
++              rsyserr(FERROR_XFER, errno,
 +                      "failed to set file flags on %s",
 +                      full_fname(fname));
 +              return 0;
@@ -455,7 +461,7 @@ To use this patch, run these commands for a successful build:
  int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
                   const char *fnamecmp, int flags)
  {
-@@ -468,6 +514,15 @@ int set_file_attrs(const char *fname, st
+@@ -468,6 +514,15 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
        }
  #endif
  
@@ -471,7 +477,7 @@ To use this patch, run these commands for a successful build:
        if (verbose > 1 && flags & ATTRS_REPORT) {
                if (updated)
                        rprintf(FCLIENT, "%s\n", fname);
-@@ -527,6 +582,9 @@ void finish_transfer(const char *fname, 
+@@ -527,6 +582,9 @@ void finish_transfer(const char *fname, const char *fnametmp,
        set_file_attrs(fnametmp, file, NULL, fnamecmp,
                       ok_to_set_time ? 0 : ATTRS_SKIP_MTIME);
  
@@ -481,7 +487,7 @@ To use this patch, run these commands for a successful build:
        /* move tmp file over real file */
        if (verbose > 2)
                rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
-@@ -541,6 +599,9 @@ void finish_transfer(const char *fname, 
+@@ -541,6 +599,9 @@ void finish_transfer(const char *fname, const char *fnametmp,
        }
        if (ret == 0) {
                /* The file was moved into place (not copied), so it's done. */
@@ -491,9 +497,10 @@ To use this patch, run these commands for a successful build:
                return;
        }
        /* The file was copied, so tweak the perms of the copied file.  If it
---- old/rsync.h
-+++ new/rsync.h
-@@ -57,6 +57,7 @@
+diff --git a/rsync.h b/rsync.h
+--- a/rsync.h
++++ b/rsync.h
+@@ -60,6 +60,7 @@
  #define XMIT_RDEV_MINOR_8_pre30 (1<<11)       /* protocols 28 - 29  */
  #define XMIT_GROUP_NAME_FOLLOWS (1<<11) /* protocols 30 - now */
  #define XMIT_HLINK_FIRST (1<<12)      /* protocols 30 - now (HLINKED files only) */
@@ -501,7 +508,7 @@ To use this patch, run these commands for a successful build:
  
  /* These flags are used in the live flist data. */
  
-@@ -441,6 +442,10 @@ typedef unsigned int size_t;
+@@ -451,6 +452,10 @@ typedef unsigned int size_t;
  #endif
  #endif
  
@@ -512,7 +519,7 @@ To use this patch, run these commands for a successful build:
  /* 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. */
-@@ -608,6 +613,7 @@ extern int file_extra_cnt;
+@@ -618,6 +623,7 @@ extern int file_extra_cnt;
  extern int inc_recurse;
  extern int uid_ndx;
  extern int gid_ndx;
@@ -520,7 +527,7 @@ To use this patch, run these commands for a successful build:
  extern int acls_ndx;
  extern int xattrs_ndx;
  
-@@ -645,6 +651,7 @@ extern int xattrs_ndx;
+@@ -655,6 +661,7 @@ extern int xattrs_ndx;
  /* When the associated option is on, all entries will have these present: */
  #define F_OWNER(f) REQ_EXTRA(f, uid_ndx)->unum
  #define F_GROUP(f) REQ_EXTRA(f, gid_ndx)->unum
@@ -528,9 +535,10 @@ To use this patch, run these commands for a successful build:
  #define F_ACL(f) REQ_EXTRA(f, acls_ndx)->num
  #define F_XATTR(f) REQ_EXTRA(f, xattrs_ndx)->num
  #define F_NDX(f) REQ_EXTRA(f, unsort_ndx)->num
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -338,6 +338,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -338,6 +338,7 @@ to the detailed description below for a complete description.  verb(
   -K, --keep-dirlinks         treat symlinked dir on receiver as dir
   -H, --hard-links            preserve hard links
   -p, --perms                 preserve permissions
@@ -538,7 +546,7 @@ To use this patch, run these commands for a successful build:
   -E, --executability         preserve executability
       --chmod=CHMOD           affect file and/or directory permissions
   -A, --acls                  preserve ACLs (implies -p)
-@@ -539,7 +540,9 @@ specified, in which case bf(-r) is not i
+@@ -540,7 +541,9 @@ specified, in which case bf(-r) is not implied.
  
  Note that bf(-a) bf(does not preserve hardlinks), because
  finding multiply-linked files is expensive.  You must separately
@@ -549,7 +557,7 @@ To use this patch, run these commands for a successful build:
  
  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-":
-@@ -908,6 +911,13 @@ super-user copies all namespaces except 
+@@ -909,6 +912,13 @@ super-user copies all namespaces except system.*.  A normal user only copies
  the user.* namespace.  To be able to backup and restore non-user namespaces as
  a normal user, see the bf(--fake-super) option.
  
@@ -563,9 +571,10 @@ To use this patch, run these commands for a successful build:
  dit(bf(--chmod)) This option tells rsync to apply one or more
  comma-separated "chmod" strings to the permission of the files in the
  transfer.  The resulting value is treated as though it was the permissions
---- old/syscall.c
-+++ new/syscall.c
-@@ -173,6 +173,15 @@ int do_chmod(const char *path, mode_t mo
+diff --git a/syscall.c b/syscall.c
+--- a/syscall.c
++++ b/syscall.c
+@@ -173,6 +173,15 @@ int do_chmod(const char *path, mode_t mode)
  }
  #endif
  
index 7d53eda..a189255 100644 (file)
@@ -7,9 +7,10 @@ To use this patch, run these commands for a successful build:
     ./configure                         (optional if already run)
     make
 
---- old/options.c
-+++ new/options.c
-@@ -45,6 +45,7 @@ int append_mode = 0;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -46,6 +46,7 @@ int append_mode = 0;
  int keep_dirlinks = 0;
  int copy_dirlinks = 0;
  int copy_links = 0;
@@ -17,23 +18,23 @@ To use this patch, run these commands for a successful build:
  int preserve_links = 0;
  int preserve_hard_links = 0;
  int preserve_acls = 0;
-@@ -375,6 +376,7 @@ void usage(enum logcode F)
+@@ -377,6 +378,7 @@ void usage(enum logcode F)
    rprintf(F,"     --partial-dir=DIR       put a partially transferred file into DIR\n");
    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,"     --fsync                 fsync every written file\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");
-@@ -600,6 +602,7 @@ static struct poptOption long_options[] 
-   {"no-numeric-ids",   0,  POPT_ARG_VAL,    &numeric_ids, 0, 0, 0 },
+   rprintf(F,"     --timeout=SECONDS       set I/O timeout in seconds\n");
+   rprintf(F,"     --contimeout=SECONDS    set daemon connection timeout in seconds\n");
+@@ -606,6 +608,7 @@ static struct poptOption long_options[] = {
    {"timeout",          0,  POPT_ARG_INT,    &io_timeout, 0, 0, 0 },
    {"no-timeout",       0,  POPT_ARG_VAL,    &io_timeout, 0, 0, 0 },
+   {"contimeout",       0,  POPT_ARG_INT,    &connect_timeout, 0, 0, 0 },
 +  {"fsync",            0,  POPT_ARG_NONE,   &do_fsync, 0, 0, 0 },
    {"rsh",             'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
    {"rsync-path",       0,  POPT_ARG_STRING, &rsync_path, 0, 0, 0 },
    {"temp-dir",        'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
-@@ -1934,6 +1937,9 @@ void server_options(char **args, int *ar
+@@ -1946,6 +1949,9 @@ void server_options(char **args, int *argc_p)
                        args[ac++] = tmpdir;
                }
  
@@ -43,8 +44,9 @@ To use this patch, run these commands for a successful build:
                if (basis_dir[0]) {
                        /* the server only needs this option if it is not the sender,
                         *   and it may be an older version that doesn't know this
---- old/receiver.c
-+++ new/receiver.c
+diff --git a/receiver.c b/receiver.c
+--- a/receiver.c
++++ b/receiver.c
 @@ -39,6 +39,7 @@ extern int relative_paths;
  extern int preserve_hard_links;
  extern int preserve_perms;
@@ -53,7 +55,7 @@ To use this patch, run these commands for a successful build:
  extern int basis_dir_cnt;
  extern int make_backups;
  extern int cleanup_got_literal;
-@@ -261,6 +262,12 @@ static int receive_data(int f_in, char *
+@@ -298,6 +299,12 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
                exit_cleanup(RERR_FILEIO);
        }
  
@@ -66,8 +68,9 @@ To use this patch, run these commands for a successful build:
        sum_len = sum_end(file_sum1);
  
        if (mapbuf)
---- old/t_stub.c
-+++ new/t_stub.c
+diff --git a/t_stub.c b/t_stub.c
+--- a/t_stub.c
++++ b/t_stub.c
 @@ -21,6 +21,7 @@
  
  #include "rsync.h"
@@ -76,9 +79,10 @@ To use this patch, run these commands for a successful build:
  int modify_window = 0;
  int module_id = -1;
  int relative_paths = 0;
---- old/util.c
-+++ new/util.c
-@@ -25,6 +25,7 @@
+diff --git a/util.c b/util.c
+--- a/util.c
++++ b/util.c
+@@ -26,6 +26,7 @@
  extern int verbose;
  extern int dry_run;
  extern int module_id;
@@ -86,7 +90,7 @@ To use this patch, run these commands for a successful build:
  extern int modify_window;
  extern int relative_paths;
  extern int human_readable;
-@@ -310,6 +311,13 @@ int copy_file(const char *source, const 
+@@ -314,6 +315,13 @@ int copy_file(const char *source, const char *dest, int ofd,
                        full_fname(source));
        }
  
@@ -98,5 +102,5 @@ To use this patch, run these commands for a successful build:
 +      }
 +
        if (close(ofd) < 0) {
-               rsyserr(FERROR, errno, "close failed on %s",
+               rsyserr(FERROR_XFER, errno, "close failed on %s",
                        full_fname(dest));
diff --git a/gzip-rsyncable-checksum.diff b/gzip-rsyncable-checksum.diff
deleted file mode 100644 (file)
index fb66473..0000000
+++ /dev/null
@@ -1,551 +0,0 @@
-NOTE: this patch is for _gzip_!
-
-Kevin Day's version of the gzip-rsyncable patch that uses the rsync
-checksum algorithm.
-
---- gzip-1.2.2/deflate.c       2004-09-15 10:28:14.000000000 -0700
-+++ rsyncable/deflate.c        2005-02-17 14:37:14.660957200 -0700
-@@ -98,6 +98,10 @@
-                             int length));
- #endif
-+local void rsync_roll(deflate_state *s, unsigned start, unsigned num);
-+local void rsync_roll_noop(deflate_state *s, unsigned start, unsigned num);
-+local void rsync_roll2(deflate_state *s, unsigned start, unsigned num);
-+
- /* ===========================================================================
-  * Local data
-  */
-@@ -115,6 +119,39 @@
-  * See deflate.c for comments about the MIN_MATCH+1.
-  */
-+
-+
-+/* 
-+      Valid values for RSYNC_DEFAULT_CHECKSUM_TYPE are:
-+
-+      Z_RSYNCABLE_OFF
-+      Z_RSYNCABLE_SIMPLESUM
-+      Z_RSYNCABLE_RSSUM
-+*/
-+
-+#ifndef RSYNC_DEFAULT_CHECKSUM_TYPE
-+#     define RSYNC_DEFAULT_CHECKSUM_TYPE Z_RSYNCABLE_RSSUM
-+#endif
-+
-+#ifndef RSYNC_DEFAULT_WINDOW_SIZE
-+#     define RSYNC_DEFAULT_WINDOW_SIZE 30
-+#endif
-+
-+#ifndef RSYNC_DEFAULT_RESET_BLOCK_SIZE
-+#     define RSYNC_DEFAULT_RESET_BLOCK_SIZE 4096 
-+#endif
-+
-+#ifndef RSYNC_RESET_MAGIC_VALUE
-+#     define RSYNC_RESET_MAGIC_VALUE 0
-+#endif
-+
-+#define RSYNC_SUM_MATCH(s) ((s)->rsync_sum % (s)->rsync_reset_block_size == RSYNC_RESET_MAGIC_VALUE)
-+/* Whether window sum matches magic value */
-+
-+/* Global rsync mode control variable */
-+int zlib_rsync = 1 ;
-+
-+
- /* Values for max_lazy_match, good_match and max_chain_length, depending on
-  * the desired pack level (0..9). The values given below have been tuned to
-  * exclude worst case performance for pathological files. Better values may be
-@@ -212,6 +249,36 @@
-     /* To do: ignore strm->next_in if we use it as window */
- }
-+int ZEXPORT deflateSetRsyncParameters_(strm, checksum_type, window_size, reset_block_size)
-+    z_streamp strm;
-+    int  checksum_type;
-+      ulg window_size;
-+      ulg reset_block_size;
-+{
-+      deflate_state *s = strm->state;
-+
-+      switch(checksum_type){
-+              case Z_RSYNCABLE_SIMPLESUM: 
-+                      s->rsync_rollfunction = rsync_roll; 
-+                      break;
-+              case Z_RSYNCABLE_RSSUM: 
-+                      s->rsync_rollfunction = rsync_roll2; 
-+                      break;
-+              default: 
-+                      s->rsync_rollfunction = rsync_roll_noop;
-+      }
-+
-+      s->rsync_window_size = window_size != 0 ? window_size : RSYNC_DEFAULT_WINDOW_SIZE;
-+      s->rsync_reset_block_size = reset_block_size != 0 ? reset_block_size : s->rsync_window_size;
-+
-+    s->rsync_chunk_end = 0xFFFFFFFFUL;
-+    s->rsync_sum = 0;
-+      s->rsync_s1 = 0;
-+      s->rsync_s2 = 0;
-+
-+      return Z_OK;
-+}
-+
- /* ========================================================================= */
- int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
-                   version, stream_size)
-@@ -307,9 +374,13 @@
-     s->strategy = strategy;
-     s->method = (Byte)method;
-+      deflateSetRsyncParameters_(strm, RSYNC_DEFAULT_CHECKSUM_TYPE, RSYNC_DEFAULT_WINDOW_SIZE, RSYNC_DEFAULT_RESET_BLOCK_SIZE);
-+
-     return deflateReset(strm);
- }
-+
-+
- /* ========================================================================= */
- int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
-     z_streamp strm;
-@@ -841,6 +912,13 @@
- #ifdef ASMV
-     match_init(); /* initialize the asm code */
- #endif
-+
-+    /* rsync params */
-+    s->rsync_chunk_end = 0xFFFFFFFFUL;
-+    s->rsync_sum = 0;
-+      s->rsync_s1 = 0;
-+      s->rsync_s2 = 0;
-+
- }
- #ifndef FASTEST
-@@ -1123,6 +1201,8 @@
-             zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
-             s->match_start -= wsize;
-             s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
-+            if (s->rsync_chunk_end != 0xFFFFFFFFUL)
-+                s->rsync_chunk_end -= wsize;
-             s->block_start -= (long) wsize;
-             /* Slide the hash table (could be avoided with 32 bit values
-@@ -1184,15 +1264,98 @@
-     } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
- }
-+local void rsync_roll(s, start, num)
-+    deflate_state *s;
-+    unsigned start;
-+    unsigned num;
-+{
-+    unsigned i;
-+
-+    if (start < s->rsync_window_size) {
-+      /* before window fills. */
-+      for (i = start; i < s->rsync_window_size; i++) {
-+          if (i == start + num) return;
-+          s->rsync_sum += (ulg)s->window[i];
-+      }
-+      num -= (s->rsync_window_size - start);
-+      start = s->rsync_window_size;
-+    }
-+
-+    /* buffer after window full */
-+    for (i = start; i < start+num; i++) {
-+      /* New character in */
-+      s->rsync_sum += (ulg)s->window[i];
-+      /* Old character out */
-+      s->rsync_sum -= (ulg)s->window[i - s->rsync_window_size];
-+      if (s->rsync_chunk_end == 0xFFFFFFFFUL
-+            && RSYNC_SUM_MATCH(s))
-+          s->rsync_chunk_end = i;
-+    }
-+}
-+
-+local void rsync_roll_noop(s, start, num)
-+    deflate_state *s;
-+    unsigned start;
-+    unsigned num;
-+{
-+}
-+
-+/*
-+ Implements the 2 part rsync checksum, instead of a simple summation checksum.
-+*/
-+local void rsync_roll2(deflate_state *s, unsigned start, unsigned num)
-+{
-+    unsigned i;
-+
-+    if (start < s->rsync_window_size) {
-+              /* before window fills. */
-+              for (i = start; i < s->rsync_window_size; i++) {
-+                      if (i == start + num) return;
-+                      s->rsync_s1 = (s->rsync_s1 + (ulg)s->window[i]) & 0xffff;
-+                      s->rsync_s2 = (s->rsync_s2 + s->rsync_s1) & 0xffff;
-+              }
-+              num -= (s->rsync_window_size - start);
-+              start = s->rsync_window_size;
-+    }
-+
-+    /* buffer after window full */
-+    for (i = start; i < start+num; i++) {
-+              /* Old character out */
-+
-+              s->rsync_s1 = (s->rsync_s1 - (ulg)s->window[i - s->rsync_window_size]) & 0xffff;
-+              s->rsync_s2 = (s->rsync_s2 - s->rsync_window_size * (ulg)s->window[i - s->rsync_window_size]) & 0xffff;
-+
-+              /* New character in */
-+              s->rsync_s1 = (s->rsync_s1 + (ulg)s->window[i]) & 0xffff;
-+              s->rsync_s2 = (s->rsync_s2 + s->rsync_s1) & 0xffff;
-+
-+              // add the two together for the match calculation
-+              s->rsync_sum = s->rsync_s1 + s->rsync_s2;
-+
-+
-+              if (s->rsync_chunk_end == 0xFFFFFFFFUL
-+                      && RSYNC_SUM_MATCH(s)){
-+                      s->rsync_chunk_end = i;
-+              }
-+    }
-+}
-+
-+/* ===========================================================================
-+ * Set rsync_chunk_end if window sum matches magic value.
-+ */
-+#define RSYNC_ROLL(s, start, num) \
-+   do { if (zlib_rsync) (s)->rsync_rollfunction((s), (start), (num)); } while(0)
-+
- /* ===========================================================================
-  * Flush the current block, with given end-of-file flag.
-  * IN assertion: strstart is set to the end of the current match.
-  */
--#define FLUSH_BLOCK_ONLY(s, eof) { \
-+#define FLUSH_BLOCK_ONLY(s, eof, pad) { \
-    _tr_flush_block(s, (s->block_start >= 0L ? \
-                    (charf *)&s->window[(unsigned)s->block_start] : \
-                    (charf *)Z_NULL), \
-                 (ulg)((long)s->strstart - s->block_start), \
-+                (pad), \
-                 (eof)); \
-    s->block_start = s->strstart; \
-    flush_pending(s->strm); \
-@@ -1200,8 +1363,8 @@
- }
- /* Same but force premature exit if necessary. */
--#define FLUSH_BLOCK(s, eof) { \
--   FLUSH_BLOCK_ONLY(s, eof); \
-+#define FLUSH_BLOCK(s, eof, pad) { \
-+   FLUSH_BLOCK_ONLY(s, eof, pad); \
-    if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
- }
-@@ -1252,16 +1415,16 @@
-             /* strstart == 0 is possible when wraparound on 16-bit machine */
-             s->lookahead = (uInt)(s->strstart - max_start);
-             s->strstart = (uInt)max_start;
--            FLUSH_BLOCK(s, 0);
-+            FLUSH_BLOCK(s, 0, 0);
-         }
-         /* Flush if we may have to slide, otherwise block_start may become
-          * negative and the data will be gone:
-          */
-         if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
--            FLUSH_BLOCK(s, 0);
-+            FLUSH_BLOCK(s, 0, 0);
-         }
-     }
--    FLUSH_BLOCK(s, flush == Z_FINISH);
-+    FLUSH_BLOCK(s, flush == Z_FINISH, 0);
-     return flush == Z_FINISH ? finish_done : block_done;
- }
-@@ -1330,6 +1493,7 @@
-             s->lookahead -= s->match_length;
-+            RSYNC_ROLL(s, s->strstart, s->match_length);
-             /* Insert new strings in the hash table only if the match length
-              * is not too large. This saves time but degrades compression.
-              */
-@@ -1363,12 +1527,17 @@
-             /* No match, output a literal byte */
-             Tracevv((stderr,"%c", s->window[s->strstart]));
-             _tr_tally_lit (s, s->window[s->strstart], bflush);
-+            RSYNC_ROLL(s, s->strstart, 1);
-             s->lookahead--;
-             s->strstart++;
-         }
--        if (bflush) FLUSH_BLOCK(s, 0);
-+      if (zlib_rsync && s->strstart > s->rsync_chunk_end) {
-+          s->rsync_chunk_end = 0xFFFFFFFFUL;
-+          bflush = 2;
-+      }
-+        if (bflush) FLUSH_BLOCK(s, 0, bflush-1);
-     }
--    FLUSH_BLOCK(s, flush == Z_FINISH);
-+    FLUSH_BLOCK(s, flush == Z_FINISH, bflush-1);
-     return flush == Z_FINISH ? finish_done : block_done;
- }
-@@ -1457,6 +1626,7 @@
-              */
-             s->lookahead -= s->prev_length-1;
-             s->prev_length -= 2;
-+            RSYNC_ROLL(s, s->strstart, s->prev_length+1);
-             do {
-                 if (++s->strstart <= max_insert) {
-                     INSERT_STRING(s, s->strstart, hash_head);
-@@ -1466,7 +1636,11 @@
-             s->match_length = MIN_MATCH-1;
-             s->strstart++;
--            if (bflush) FLUSH_BLOCK(s, 0);
-+            if (zlib_rsync && s->strstart > s->rsync_chunk_end) {
-+                s->rsync_chunk_end = 0xFFFFFFFFUL;
-+                bflush = 2;
-+            } 
-+            if (bflush) FLUSH_BLOCK(s, 0, bflush-1);
-         } else if (s->match_available) {
-             /* If there was no match at the previous position, output a
-@@ -1475,9 +1649,14 @@
-              */
-             Tracevv((stderr,"%c", s->window[s->strstart-1]));
-             _tr_tally_lit(s, s->window[s->strstart-1], bflush);
-+            if (zlib_rsync && s->strstart > s->rsync_chunk_end) {
-+                s->rsync_chunk_end = 0xFFFFFFFFUL;
-+              bflush = 2;
-+            } 
-             if (bflush) {
--                FLUSH_BLOCK_ONLY(s, 0);
-+                FLUSH_BLOCK_ONLY(s, 0, bflush-1);
-             }
-+            RSYNC_ROLL(s, s->strstart, 1);
-             s->strstart++;
-             s->lookahead--;
-             if (s->strm->avail_out == 0) return need_more;
-@@ -1485,7 +1664,14 @@
-             /* There is no previous match to compare with, wait for
-              * the next step to decide.
-              */
-+            if (zlib_rsync && s->strstart > s->rsync_chunk_end) {
-+                /* Reset huffman tree */
-+                s->rsync_chunk_end = 0xFFFFFFFFUL;
-+                bflush = 2;
-+                FLUSH_BLOCK(s, 0, bflush-1);
-+            } 
-             s->match_available = 1;
-+            RSYNC_ROLL(s, s->strstart, 1);
-             s->strstart++;
-             s->lookahead--;
-         }
-@@ -1496,7 +1682,7 @@
-         _tr_tally_lit(s, s->window[s->strstart-1], bflush);
-         s->match_available = 0;
-     }
--    FLUSH_BLOCK(s, flush == Z_FINISH);
-+    FLUSH_BLOCK(s, flush == Z_FINISH, bflush-1);
-     return flush == Z_FINISH ? finish_done : block_done;
- }
- #endif /* FASTEST */
---- gzip-1.2.2/deflate.h       2004-02-24 07:38:44.000000000 -0700
-+++ rsyncable/deflate.h        2005-02-17 13:46:12.056551200 -0700
-@@ -254,6 +254,17 @@
-      * are always zero.
-      */
-+    ulg rsync_sum;      /* rolling sum of rsync window */
-+    ulg rsync_chunk_end; /* next rsync sequence point */
-+      ulg rsync_window_size; /* the number of bytes used in computing the rolling checksum */
-+      ulg rsync_reset_block_size; /* the compressed stream will be reset approximately every 'rsync_reset_block_size' bytes */
-+      ulg rsync_s1; /* part 1 of the checksum for use with checksum type Z_RSYNCABLE_RSSUM*/
-+      ulg rsync_s2; /* part 2 of the checksum for use with checksum type Z_RSYNCABLE_RSSUM*/
-+
-+      /* the function that should be called for performing the rsyncable checksum roll */
-+      void (*rsync_rollfunction)(struct internal_state*s , unsigned start, unsigned num);
-+
-+
- } FAR deflate_state;
- /* Output a byte on the stream.
-@@ -276,7 +287,7 @@
- void _tr_init         OF((deflate_state *s));
- int  _tr_tally        OF((deflate_state *s, unsigned dist, unsigned lc));
- void _tr_flush_block  OF((deflate_state *s, charf *buf, ulg stored_len,
--                          int eof));
-+                          int pad, int eof));
- void _tr_align        OF((deflate_state *s));
- void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
-                           int eof));
---- gzip-1.2.2/minigzip.c      2003-11-04 18:19:26.000000000 -0700
-+++ rsyncable/minigzip.c       2005-02-17 13:11:35.472851600 -0700
-@@ -215,7 +215,7 @@
-     }
-     gz_compress(in, out);
--    unlink(file);
-+    //unlink(file);
- }
-@@ -236,7 +236,10 @@
-     if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
-         infile = file;
-         outfile = buf;
--        outfile[len-3] = '\0';
-+        outfile[len-3] = '.';
-+        outfile[len-2] = 'u';
-+        outfile[len-1] = 'z';
-+        outfile[len-0] = '\0';
-     } else {
-         outfile = file;
-         infile = buf;
-@@ -255,7 +258,7 @@
-     gz_uncompress(in, out);
--    unlink(infile);
-+    //unlink(infile);
- }
---- gzip-1.2.2/trees.c 2004-02-24 07:36:38.000000000 -0700
-+++ rsyncable/trees.c  2005-02-17 13:09:38.768435100 -0700
-@@ -918,10 +918,11 @@
-  * Determine the best encoding for the current block: dynamic trees, static
-  * trees or store, and output the encoded block to the zip file.
-  */
--void _tr_flush_block(s, buf, stored_len, eof)
-+void _tr_flush_block(s, buf, stored_len, pad, eof)
-     deflate_state *s;
-     charf *buf;       /* input block, or NULL if too old */
-     ulg stored_len;   /* length of input block */
-+    int pad;          /* pad output to byte boundary */
-     int eof;          /* true if this is the last block for a file */
- {
-     ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
-@@ -1009,6 +1010,12 @@
- #ifdef DEBUG
-         s->compressed_len += 7;  /* align on byte boundary */
- #endif
-+#ifdef DEBUG
-+    } else if (pad && (s->compressed_len % 8) != 0) {
-+#else
-+    } else if (pad) {
-+#endif
-+        _tr_stored_block(s, buf, 0, eof);
-     }
-     Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
-            s->compressed_len-7*eof));
---- gzip-1.2.2/zlib.def        1969-12-31 17:00:00.000000000 -0700
-+++ rsyncable/zlib.def 2005-02-17 14:01:48.972258000 -0700
-@@ -0,0 +1,61 @@
-+LIBRARY
-+; zlib data compression library
-+
-+EXPORTS
-+; basic functions
-+    zlibVersion
-+    deflate
-+    deflateEnd
-+    inflate
-+    inflateEnd
-+; advanced functions
-+    deflateSetDictionary
-+    deflateCopy
-+    deflateReset
-+    deflateParams
-+    deflateBound
-+    deflatePrime
-+    inflateSetDictionary
-+    inflateSync
-+    inflateCopy
-+    inflateReset
-+    inflateBack
-+    inflateBackEnd
-+    zlibCompileFlags
-+; utility functions
-+    compress
-+    compress2
-+    compressBound
-+    uncompress
-+    gzopen
-+    gzdopen
-+    gzsetparams
-+    gzread
-+    gzwrite
-+    gzprintf
-+    gzputs
-+    gzgets
-+    gzputc
-+    gzgetc
-+    gzungetc
-+    gzflush
-+    gzseek
-+    gzrewind
-+    gztell
-+    gzeof
-+    gzclose
-+    gzerror
-+    gzclearerr
-+; checksum functions
-+    adler32
-+    crc32
-+; various hacks, don't look :)
-+    deflateInit_
-+    deflateInit2_
-+    inflateInit_
-+    inflateInit2_
-+    inflateBackInit_
-+    inflateSyncPoint
-+    get_crc_table
-+    zError
-+      deflateSetRsyncParameters_
-\ No newline at end of file
---- gzip-1.2.2/zlib.h  2004-10-03 22:57:26.000000000 -0700
-+++ rsyncable/zlib.h   2005-02-17 14:02:11.753362200 -0700
-@@ -179,6 +179,13 @@
- #define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
-+
-+/* Constants used for selecting Rsyncable checksum type */
-+#define Z_RSYNCABLE_OFF                       0
-+#define Z_RSYNCABLE_SIMPLESUM 1
-+#define Z_RSYNCABLE_RSSUM             2
-+
-+
- #define zlib_version zlibVersion()
- /* for compatibility with versions < 1.0.2 */
-@@ -1185,6 +1192,17 @@
-         ZLIB_VERSION, sizeof(z_stream))
-+
-+/* deflateSetRsyncParameters allows for setting rsyncable parameters on a stream.
-+      These parameters MUST be set immediately after the stream is created, and before
-+      any data is written to the stream.
-+ */
-+ZEXTERN int ZEXPORT deflateSetRsyncParameters_ OF((z_stream FAR *strm, int checksum_type, unsigned long window_size, unsigned long reset_block_size));
-+
-+#define deflateSetRsyncParameters(strm, checksum_type, window_size, reset_block_size) \
-+        deflateSetRsyncParameters_((strm), (checksum_type), (window_size), (reset_block_size))
-+
-+
- #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
-     struct internal_state {int dummy;}; /* hack for buggy compilers */
- #endif
-@@ -1193,6 +1211,10 @@
- ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
- ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
-+/* Global rsync mode control variable */
-+extern int zlib_rsync;
-+
-+
- #ifdef __cplusplus
- }
- #endif
diff --git a/gzip-rsyncable.diff b/gzip-rsyncable.diff
deleted file mode 100644 (file)
index 844ed93..0000000
+++ /dev/null
@@ -1,299 +0,0 @@
-NOTE: this patch is for _gzip_!
-
-This is pending for actual inclusion in gzip.  It is currently being
-tried out in the default gzip for Debian Sarge, and may go into the
-upstream gzip at somepoint in the not-too-distant future.
-
---- gzip-1.3.5/deflate.c       1999-10-07 23:46:28 -0700
-+++ rsyncable/deflate.c        2005-02-05 09:40:33 -0800
-@@ -122,6 +122,14 @@
- #endif
- /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
-+#ifndef RSYNC_WIN
-+#  define RSYNC_WIN 4096
-+#endif
-+/* Size of rsync window, must be < MAX_DIST */
-+
-+#define RSYNC_SUM_MATCH(sum) ((sum) % RSYNC_WIN == 0)
-+/* Whether window sum matches magic value */
-+
- /* ===========================================================================
-  * Local data used by the "longest match" routines.
-  */
-@@ -203,6 +211,8 @@
- unsigned near good_match;
- /* Use a faster search when the previous match is longer than this */
-+local ulg rsync_sum;  /* rolling sum of rsync window */
-+local ulg rsync_chunk_end; /* next rsync sequence point */
- /* Values for max_lazy_match, good_match and max_chain_length, depending on
-  * the desired pack level (0..9). The values given below have been tuned to
-@@ -301,6 +311,10 @@
- #endif
-     /* prev will be initialized on the fly */
-+    /* rsync params */
-+    rsync_chunk_end = 0xFFFFFFFFUL;
-+    rsync_sum = 0;
-+
-     /* Set the default configuration parameters:
-      */
-     max_lazy_match   = configuration_table[pack_level].max_lazy;
-@@ -537,6 +551,8 @@
-         memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
-         match_start -= WSIZE;
-         strstart    -= WSIZE; /* we now have strstart >= MAX_DIST: */
-+      if (rsync_chunk_end != 0xFFFFFFFFUL)
-+          rsync_chunk_end -= WSIZE;
-         block_start -= (long) WSIZE;
-@@ -564,13 +580,46 @@
-     }
- }
-+local void rsync_roll(start, num)
-+    unsigned start;
-+    unsigned num;
-+{
-+    unsigned i;
-+
-+    if (start < RSYNC_WIN) {
-+      /* before window fills. */
-+      for (i = start; i < RSYNC_WIN; i++) {
-+          if (i == start + num) return;
-+          rsync_sum += (ulg)window[i];
-+      }
-+      num -= (RSYNC_WIN - start);
-+      start = RSYNC_WIN;
-+    }
-+
-+    /* buffer after window full */
-+    for (i = start; i < start+num; i++) {
-+      /* New character in */
-+      rsync_sum += (ulg)window[i];
-+      /* Old character out */
-+      rsync_sum -= (ulg)window[i - RSYNC_WIN];
-+      if (rsync_chunk_end == 0xFFFFFFFFUL && RSYNC_SUM_MATCH(rsync_sum))
-+          rsync_chunk_end = i;
-+    }
-+}
-+
-+/* ===========================================================================
-+ * Set rsync_chunk_end if window sum matches magic value.
-+ */
-+#define RSYNC_ROLL(s, n) \
-+   do { if (rsync) rsync_roll((s), (n)); } while(0)
-+
- /* ===========================================================================
-  * Flush the current block, with given end-of-file flag.
-  * IN assertion: strstart is set to the end of the current match.
-  */
- #define FLUSH_BLOCK(eof) \
-    flush_block(block_start >= 0L ? (char*)&window[(unsigned)block_start] : \
--                (char*)NULL, (long)strstart - block_start, (eof))
-+                (char*)NULL, (long)strstart - block_start, flush-1, (eof))
- /* ===========================================================================
-  * Processes a new input file and return its compressed length. This
-@@ -581,7 +630,7 @@
- local off_t deflate_fast()
- {
-     IPos hash_head; /* head of the hash chain */
--    int flush;      /* set if current block must be flushed */
-+    int flush;      /* set if current block must be flushed, 2=>and padded  */
-     unsigned match_length = 0;  /* length of best match */
-     prev_length = MIN_MATCH-1;
-@@ -610,6 +659,7 @@
-             lookahead -= match_length;
-+          RSYNC_ROLL(strstart, match_length);
-           /* Insert new strings in the hash table only if the match length
-              * is not too large. This saves time but degrades compression.
-              */
-@@ -638,9 +688,14 @@
-             /* No match, output a literal byte */
-             Tracevv((stderr,"%c",window[strstart]));
-             flush = ct_tally (0, window[strstart]);
-+          RSYNC_ROLL(strstart, 1);
-             lookahead--;
-           strstart++; 
-         }
-+      if (rsync && strstart > rsync_chunk_end) {
-+          rsync_chunk_end = 0xFFFFFFFFUL;
-+          flush = 2;
-+      } 
-         if (flush) FLUSH_BLOCK(0), block_start = strstart;
-         /* Make sure that we always have enough lookahead, except
-@@ -713,6 +768,7 @@
-              */
-             lookahead -= prev_length-1;
-             prev_length -= 2;
-+          RSYNC_ROLL(strstart, prev_length+1);
-             do {
-                 strstart++;
-                 INSERT_STRING(strstart, hash_head);
-@@ -725,24 +781,39 @@
-             match_available = 0;
-             match_length = MIN_MATCH-1;
-             strstart++;
--            if (flush) FLUSH_BLOCK(0), block_start = strstart;
-+          if (rsync && strstart > rsync_chunk_end) {
-+              rsync_chunk_end = 0xFFFFFFFFUL;
-+              flush = 2;
-+          }
-+            if (flush) FLUSH_BLOCK(0), block_start = strstart;
-         } else if (match_available) {
-             /* If there was no match at the previous position, output a
-              * single literal. If there was a match but the current match
-              * is longer, truncate the previous match to a single literal.
-              */
-             Tracevv((stderr,"%c",window[strstart-1]));
--            if (ct_tally (0, window[strstart-1])) {
--                FLUSH_BLOCK(0), block_start = strstart;
--            }
-+          flush = ct_tally (0, window[strstart-1]);
-+          if (rsync && strstart > rsync_chunk_end) {
-+              rsync_chunk_end = 0xFFFFFFFFUL;
-+              flush = 2;
-+          }
-+            if (flush) FLUSH_BLOCK(0), block_start = strstart;
-+          RSYNC_ROLL(strstart, 1);
-             strstart++;
-             lookahead--;
-         } else {
-             /* There is no previous match to compare with, wait for
-              * the next step to decide.
-              */
-+          if (rsync && strstart > rsync_chunk_end) {
-+              /* Reset huffman tree */
-+              rsync_chunk_end = 0xFFFFFFFFUL;
-+              flush = 2;
-+              FLUSH_BLOCK(0), block_start = strstart;
-+          }
-             match_available = 1;
-+          RSYNC_ROLL(strstart, 1);
-             strstart++;
-             lookahead--;
-         }
---- gzip-1.3.5/gzip.c  2002-09-28 00:38:43 -0700
-+++ rsyncable/gzip.c   2005-02-05 09:40:33 -0800
-@@ -256,6 +256,7 @@
- unsigned insize;           /* valid bytes in inbuf */
- unsigned inptr;            /* index of next byte to be processed in inbuf */
- unsigned outcnt;           /* bytes in output buffer */
-+int rsync = 0;             /* make ryncable chunks */
- struct option longopts[] =
- {
-@@ -285,6 +286,7 @@
-     {"best",       0, 0, '9'}, /* compress better */
-     {"lzw",        0, 0, 'Z'}, /* make output compatible with old compress */
-     {"bits",       1, 0, 'b'}, /* max number of bits per code (implies -Z) */
-+    {"rsyncable",  0, 0, 'R'}, /* make rsync-friendly archive */
-     { 0, 0, 0, 0 }
- };
-@@ -365,6 +367,7 @@
-  " -Z --lzw         produce output compatible with old compress",
-  " -b --bits maxbits   max number of bits per code (implies -Z)",
- #endif
-+ "    --rsyncable   Make rsync-friendly archive",
-  " file...          files to (de)compress. If none given, use standard input.",
-  "Report bugs to <bug-gzip@gnu.org>.",
-   0};
-@@ -543,6 +546,9 @@
- #else
-           recursive = 1; break;
- #endif
-+      case 'R':
-+          rsync = 1; break;
-+
-       case 'S':
- #ifdef NO_MULTIPLE_DOTS
-             if (*optarg == '.') optarg++;
---- gzip-1.3.5/gzip.h  2001-09-30 23:53:41 -0700
-+++ rsyncable/gzip.h   2005-02-05 09:40:33 -0800
-@@ -133,6 +133,7 @@
- extern unsigned insize; /* valid bytes in inbuf */
- extern unsigned inptr;  /* index of next byte to be processed in inbuf */
- extern unsigned outcnt; /* bytes in output buffer */
-+extern int rsync;  /* deflate into rsyncable chunks */
- extern off_t bytes_in;   /* number of input bytes */
- extern off_t bytes_out;  /* number of output bytes */
-@@ -281,7 +282,7 @@
-         /* in trees.c */
- void ct_init     OF((ush *attr, int *method));
- int  ct_tally    OF((int dist, int lc));
--off_t flush_block OF((char *buf, ulg stored_len, int eof));
-+off_t flush_block OF((char *buf, ulg stored_len, int pad, int eof));
-         /* in bits.c */
- void     bi_init    OF((file_t zipfile));
---- gzip-1.3.5/gzip.texi       2002-09-29 23:57:29 -0700
-+++ rsyncable/gzip.texi        2005-02-05 09:40:33 -0800
-@@ -334,6 +334,14 @@
- into the directory and compress all the files it finds there (or
- decompress them in the case of @code{gunzip}).
-+@item --rsyncable
-+While compressing, synchronize the output occasionally based on the
-+input.  This increases size by less than 1 percent most cases, but
-+means that the @code{rsync} program can take advantage of similarities
-+in the uncompressed input when syncronizing two files compressed with
-+this flag.  @code{gunzip} cannot tell the difference between a
-+compressed file created with this option, and one created without it.
-+
- @item --suffix @var{suf}
- @itemx -S @var{suf}
- Use suffix @samp{@var{suf}} instead of @samp{.gz}. Any suffix can be
---- gzip-1.3.5/trees.c 1999-10-05 22:00:00 -0700
-+++ rsyncable/trees.c  2005-02-05 09:40:33 -0800
-@@ -46,12 +46,13 @@
-  *      void ct_tally (int dist, int lc);
-  *          Save the match info and tally the frequency counts.
-  *
-- *      off_t flush_block (char *buf, ulg stored_len, int eof)
-+ *      off_t flush_block (char *buf, ulg stored_len, int pad, int eof)
-  *          Determine the best encoding for the current block: dynamic trees,
-  *          static trees or store, and output the encoded block to the zip
-- *          file. Returns the total compressed length for the file so far.
-- *
-- */
-+ *          file. If pad is set, pads the block to the next
-+ *          byte. Returns the total compressed length for the file so
-+ *          far.
-+ * */
- #include <config.h>
- #include <ctype.h>
-@@ -847,9 +848,10 @@
-  * trees or store, and output the encoded block to the zip file. This function
-  * returns the total compressed length for the file so far.
-  */
--off_t flush_block(buf, stored_len, eof)
-+off_t flush_block(buf, stored_len, pad, eof)
-     char *buf;        /* input block, or NULL if too old */
-     ulg stored_len;   /* length of input block */
-+    int pad;          /* pad output to byte boundary */
-     int eof;          /* true if this is the last block for a file */
- {
-     ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
-@@ -941,6 +943,10 @@
-         Assert (input_len == bytes_in, "bad input size");
-         bi_windup();
-         compressed_len += 7;  /* align on byte boundary */
-+    } else if (pad && (compressed_len % 8) != 0) {
-+        send_bits((STORED_BLOCK<<1)+eof, 3);  /* send block type */
-+        compressed_len = (compressed_len + 3 + 7) & ~7L;
-+        copy_block(buf, 0, 1); /* with header */
-     }
-     return compressed_len >> 3;
index 81c28b2..94f8f79 100644 (file)
@@ -12,8 +12,9 @@ TODO:
  - Make this code handle multibyte character encodings, and honor the
    --iconv setting when converting case.
 
---- old/exclude.c
-+++ new/exclude.c
+diff --git a/exclude.c b/exclude.c
+--- a/exclude.c
++++ b/exclude.c
 @@ -21,6 +21,7 @@
   */
  
@@ -22,7 +23,7 @@ TODO:
  
  extern int verbose;
  extern int am_server;
-@@ -583,16 +584,15 @@ static int rule_matches(char *name, stru
+@@ -580,16 +581,15 @@ static int rule_matches(char *fname, struct filter_struct *ex, int name_is_dir)
                if (litmatch_array(pattern, strings, slash_handling))
                        return ret_match;
        } else if (anchored_match) {
@@ -43,8 +44,9 @@ TODO:
        }
  
        return !ret_match;
---- old/flist.c
-+++ new/flist.c
+diff --git a/flist.c b/flist.c
+--- a/flist.c
++++ b/flist.c
 @@ -35,6 +35,7 @@ extern int inc_recurse;
  extern int do_progress;
  extern int always_checksum;
@@ -53,7 +55,7 @@ TODO:
  extern int ignore_errors;
  extern int numeric_ids;
  extern int recurse;
-@@ -2570,6 +2571,7 @@ int f_name_cmp(const struct file_struct 
+@@ -2619,6 +2620,7 @@ int f_name_cmp(const struct file_struct *f1, const struct file_struct *f2)
  {
        int dif;
        const uchar *c1, *c2;
@@ -61,7 +63,7 @@ TODO:
        enum fnc_state state1, state2;
        enum fnc_type type1, type2;
        enum fnc_type t_path = protocol_version >= 29 ? t_PATH : t_ITEM;
-@@ -2680,7 +2682,15 @@ int f_name_cmp(const struct file_struct 
+@@ -2729,7 +2731,15 @@ int f_name_cmp(const struct file_struct *f1, const struct file_struct *f2)
                        if (type1 != type2)
                                return type1 == t_PATH ? 1 : -1;
                }
@@ -78,8 +80,9 @@ TODO:
  
        return dif;
  }
---- old/ifuncs.h
-+++ new/ifuncs.h
+diff --git a/ifuncs.h b/ifuncs.h
+--- a/ifuncs.h
++++ b/ifuncs.h
 @@ -98,3 +98,38 @@ toUpper(const char *ptr)
  {
        return toupper(*(unsigned char *)ptr);
@@ -119,8 +122,9 @@ TODO:
 +#define strnNE(s1,s2,n) (!strnEQ(s1,s2,n))
 +#define ic_strNE(s1,s2) (!ic_strEQ(s1,s2))
 +#define ic_strnNE(s1,s2) (!ic_strnEQ(s1,s2,n))
---- old/lib/wildmatch.c
-+++ new/lib/wildmatch.c
+diff --git a/lib/wildmatch.c b/lib/wildmatch.c
+--- a/lib/wildmatch.c
++++ b/lib/wildmatch.c
 @@ -53,6 +53,8 @@
  #define ISUPPER(c) (ISASCII(c) && isupper(c))
  #define ISXDIGIT(c) (ISASCII(c) && isxdigit(c))
@@ -130,7 +134,7 @@ TODO:
  #ifdef WILD_TEST_ITERATIONS
  int wildmatch_iteration_count;
  #endif
-@@ -72,6 +74,8 @@ static int dowild(const uchar *p, const 
+@@ -72,6 +74,8 @@ static int dowild(const uchar *p, const uchar *text, const uchar*const *a)
      for ( ; (p_ch = *p) != '\0'; text++, p++) {
        int matched, special;
        uchar t_ch, prev_ch;
@@ -139,7 +143,7 @@ TODO:
        while ((t_ch = *text) == '\0') {
            if (*a == NULL) {
                if (p_ch != '*')
-@@ -237,12 +241,21 @@ static int dowild(const uchar *p, const 
+@@ -237,12 +241,21 @@ static int dowild(const uchar *p, const uchar *text, const uchar*const *a)
   * of "text" and any strings in array "a". */
  static int doliteral(const uchar *s, const uchar *text, const uchar*const *a)
  {
@@ -162,7 +166,7 @@ TODO:
            return FALSE;
      }
  
-@@ -288,10 +301,14 @@ static const uchar *trailing_N_elements(
+@@ -288,10 +301,14 @@ static const uchar *trailing_N_elements(const uchar*const **a_ptr, int count)
  int wildmatch(const char *pattern, const char *text)
  {
      static const uchar *nomore[1]; /* A NULL pointer. */
@@ -178,7 +182,7 @@ TODO:
  }
  
  /* Match the "pattern" against the forced-to-lower-case "text" string. */
-@@ -331,12 +348,14 @@ int wildmatch_array(const char *pattern,
+@@ -331,12 +348,14 @@ int wildmatch_array(const char *pattern, const char*const *texts, int where)
      if (!text)
        return FALSE;
  
@@ -194,7 +198,7 @@ TODO:
                continue;
            }
            if (*text++ == '/' && (matched = dowild(p, text, a)) != FALSE
-@@ -344,6 +363,9 @@ int wildmatch_array(const char *pattern,
+@@ -344,6 +363,9 @@ int wildmatch_array(const char *pattern, const char*const *texts, int where)
                break;
        }
      }
@@ -204,9 +208,10 @@ TODO:
      return matched == TRUE;
  }
  
---- old/options.c
-+++ new/options.c
-@@ -115,6 +115,7 @@ OFF_T max_size = 0;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -116,6 +116,7 @@ OFF_T max_size = 0;
  OFF_T min_size = 0;
  int ignore_errors = 0;
  int modify_window = 0;
@@ -214,7 +219,7 @@ TODO:
  int blocking_io = -1;
  int checksum_seed = 0;
  int inplace = 0;
-@@ -400,6 +401,7 @@ void usage(enum logcode F)
+@@ -402,6 +403,7 @@ void usage(enum logcode F)
    rprintf(F,"     --files-from=FILE       read list of source-file names from FILE\n");
    rprintf(F," -0, --from0                 all *-from/filter files are delimited by 0s\n");
    rprintf(F," -s, --protect-args          no space-splitting; only wildcard special-chars\n");
@@ -222,7 +227,7 @@ TODO:
    rprintf(F,"     --address=ADDRESS       bind address for outgoing socket to daemon\n");
    rprintf(F,"     --port=PORT             specify double-colon alternate port number\n");
    rprintf(F,"     --sockopts=OPTIONS      specify custom TCP options\n");
-@@ -593,6 +595,8 @@ static struct poptOption long_options[] 
+@@ -595,6 +597,8 @@ static struct poptOption long_options[] = {
    {"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 },
    {"only-write-batch", 0,  POPT_ARG_STRING, &batch_name, OPT_ONLY_WRITE_BATCH, 0, 0 },
@@ -231,7 +236,7 @@ TODO:
    {"files-from",       0,  POPT_ARG_STRING, &files_from, 0, 0, 0 },
    {"from0",           '0', POPT_ARG_VAL,    &eol_nulls, 1, 0, 0},
    {"no-from0",         0,  POPT_ARG_VAL,    &eol_nulls, 0, 0, 0},
-@@ -1909,6 +1913,9 @@ void server_options(char **args, int *ar
+@@ -1908,6 +1912,9 @@ void server_options(char **args, int *argc_p)
                args[ac++] = arg;
        }
  
@@ -241,9 +246,10 @@ TODO:
        if (partial_dir && am_sender) {
                if (partial_dir != tmp_partialdir) {
                        args[ac++] = "--partial-dir";
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -402,6 +402,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -402,6 +402,7 @@ to the detailed description below for a complete description.  verb(
       --files-from=FILE       read list of source-file names from FILE
   -0, --from0                 all *from/filter files are delimited by 0s
   -s, --protect-args          no space-splitting; wildcard chars only
@@ -251,7 +257,7 @@ TODO:
       --address=ADDRESS       bind address for outgoing socket to daemon
       --port=PORT             specify double-colon alternate port number
       --sockopts=OPTIONS      specify custom TCP options
-@@ -1383,6 +1384,10 @@ If you use this option with bf(--iconv),
+@@ -1409,6 +1410,10 @@ If you use this option with bf(--iconv), the args will also be translated
  from the local to the remote character set.  The translation happens before
  wild-cards are expanded.  See also the bf(--files-from) option.
  
@@ -262,8 +268,9 @@ TODO:
  dit(bf(-T, --temp-dir=DIR)) This option instructs rsync to use DIR as a
  scratch directory when creating temporary copies of the files transferred
  on the receiving side.  The default behavior is to create each temporary
---- old/wildtest.c
-+++ new/wildtest.c
+diff --git a/wildtest.c b/wildtest.c
+--- a/wildtest.c
++++ b/wildtest.c
 @@ -31,6 +31,7 @@ int fnmatch_errors = 0;
  #endif
  
index 9e5ffac..9cc0144 100644 (file)
@@ -12,9 +12,10 @@ To use this patch, run these commands for a successful build:
     ./configure
     make
 
---- old/Makefile.in
-+++ new/Makefile.in
-@@ -35,7 +35,7 @@ OBJS1=flist.o rsync.o generator.o receiv
+diff --git a/Makefile.in b/Makefile.in
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -36,7 +36,7 @@ OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
        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 hashtable.o \
        fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
@@ -23,9 +24,10 @@ To use this patch, run these commands for a successful build:
  DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
  popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
        popt/popthelp.o popt/poptparse.o
---- old/flist.c
-+++ new/flist.c
-@@ -67,6 +67,7 @@ extern int need_unsorted_flist;
+diff --git a/flist.c b/flist.c
+--- a/flist.c
++++ b/flist.c
+@@ -68,6 +68,7 @@ extern int need_unsorted_flist;
  extern int unsort_ndx;
  extern struct stats stats;
  extern char *filesfrom_host;
@@ -33,7 +35,7 @@ To use this patch, run these commands for a successful build:
  
  extern char curr_dir[MAXPATHLEN];
  
-@@ -815,7 +816,7 @@ static struct file_struct *recv_file_ent
+@@ -823,7 +824,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
                extra_len += (S_ISDIR(mode) ? 2 : 1) * EXTRA_LEN;
  #endif
  
@@ -42,8 +44,10 @@ To use this patch, run these commands for a successful build:
                extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
  
        if (file_length > 0xFFFFFFFFu && S_ISREG(mode))
---- old/hashlink.c
-+++ new/hashlink.c
+diff --git a/hashlink.c b/hashlink.c
+new file mode 100644
+--- /dev/null
++++ b/hashlink.c
 @@ -0,0 +1,336 @@
 +/*
 +   Copyright (C) Cronosys, LLC 2004
@@ -381,9 +385,10 @@ To use this patch, run these commands for a successful build:
 +      return rc;
 +}
 +#endif
---- old/options.c
-+++ new/options.c
-@@ -154,6 +154,7 @@ char *backup_suffix = NULL;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -155,6 +155,7 @@ char *backup_suffix = NULL;
  char *tmpdir = NULL;
  char *partial_dir = NULL;
  char *basis_dir[MAX_BASIS_DIRS+1];
@@ -391,7 +396,7 @@ To use this patch, run these commands for a successful build:
  char *config_file = NULL;
  char *shell_cmd = NULL;
  char *logfile_name = NULL;
-@@ -386,6 +387,7 @@ void usage(enum logcode F)
+@@ -388,6 +389,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");
@@ -399,7 +404,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F," -z, --compress              compress file data during the transfer\n");
    rprintf(F,"     --compress-level=NUM    explicitly set compression level\n");
    rprintf(F,"     --skip-compress=LIST    skip compressing files with a suffix in LIST\n");
-@@ -438,7 +440,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -440,7 +442,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
        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,
@@ -408,7 +413,7 @@ To use this patch, run these commands for a successful build:
        OPT_SERVER, OPT_REFUSED_BASE = 9000};
  
  static struct poptOption long_options[] = {
-@@ -561,6 +563,7 @@ static struct poptOption long_options[] 
+@@ -563,6 +565,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 },
@@ -416,7 +421,7 @@ To use this patch, run these commands for a successful build:
    {"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 },
-@@ -1221,6 +1224,21 @@ int parse_arguments(int *argc_p, const c
+@@ -1224,6 +1227,21 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                        return 0;
  #endif
  
@@ -438,7 +443,7 @@ To use this patch, run these commands for a successful build:
                default:
                        /* A large opt value means that set_refuse_options()
                         * turned this option off. */
-@@ -1963,6 +1981,11 @@ void server_options(char **args, int *ar
+@@ -1966,6 +1984,11 @@ void server_options(char **args, int *argc_p)
        } else if (inplace)
                args[ac++] = "--inplace";
  
@@ -450,9 +455,10 @@ To use this patch, run these commands for a successful build:
        if (files_from && (!am_sender || filesfrom_host)) {
                if (filesfrom_host) {
                        args[ac++] = "--files-from";
---- old/receiver.c
-+++ new/receiver.c
-@@ -162,12 +162,14 @@ int open_tmpfile(char *fnametmp, const c
+diff --git a/receiver.c b/receiver.c
+--- a/receiver.c
++++ b/receiver.c
+@@ -162,12 +162,14 @@ int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file)
  }
  
  static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
@@ -468,7 +474,7 @@ To use this patch, run these commands for a successful build:
        int32 len, sum_len;
        OFF_T offset = 0;
        OFF_T offset2;
-@@ -187,6 +189,9 @@ static int receive_data(int f_in, char *
+@@ -187,6 +189,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
        } else
                mapbuf = NULL;
  
@@ -478,7 +484,7 @@ To use this patch, run these commands for a successful build:
        sum_init(checksum_seed);
  
        if (append_mode > 0) {
-@@ -231,6 +236,8 @@ static int receive_data(int f_in, char *
+@@ -231,6 +236,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
                        cleanup_got_literal = 1;
  
                        sum_update(data, i);
@@ -487,7 +493,7 @@ To use this patch, run these commands for a successful build:
  
                        if (fd != -1 && write_file(fd,data,i) != i)
                                goto report_write_error;
-@@ -257,6 +264,8 @@ static int receive_data(int f_in, char *
+@@ -257,6 +264,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
  
                        see_token(map, len);
                        sum_update(map, len);
@@ -496,7 +502,7 @@ To use this patch, run these commands for a successful build:
                }
  
                if (updating_basis_or_equiv) {
-@@ -299,6 +308,8 @@ static int receive_data(int f_in, char *
+@@ -299,6 +308,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
        }
  
        sum_len = sum_end(file_sum1);
@@ -505,7 +511,7 @@ To use this patch, run these commands for a successful build:
  
        if (mapbuf)
                unmap_file(mapbuf);
-@@ -314,7 +325,7 @@ static int receive_data(int f_in, char *
+@@ -314,7 +325,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
  
  static void discard_receive_data(int f_in, OFF_T length)
  {
@@ -514,7 +520,7 @@ To use this patch, run these commands for a successful build:
  }
  
  static void handle_delayed_updates(char *local_name)
-@@ -673,7 +684,7 @@ int recv_files(int f_in, char *local_nam
+@@ -673,7 +684,7 @@ int recv_files(int f_in, char *local_name)
  
                /* recv file data */
                recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
@@ -523,8 +529,9 @@ To use this patch, run these commands for a successful build:
  
                log_item(log_code, file, &initial_stats, iflags, NULL);
  
---- old/rsync.c
-+++ new/rsync.c
+diff --git a/rsync.c b/rsync.c
+--- a/rsync.c
++++ b/rsync.c
 @@ -48,6 +48,7 @@ extern int inplace;
  extern int flist_eof;
  extern int keep_dirlinks;
@@ -533,7 +540,7 @@ To use this patch, run these commands for a successful build:
  extern struct file_list *cur_flist, *first_flist, *dir_flist;
  extern struct chmod_mode_struct *daemon_chmod_modes;
  #ifdef ICONV_OPTION
-@@ -530,8 +531,15 @@ void finish_transfer(const char *fname, 
+@@ -530,8 +531,15 @@ void finish_transfer(const char *fname, const char *fnametmp,
        /* move tmp file over real file */
        if (verbose > 2)
                rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
@@ -549,11 +556,12 @@ To use this patch, run these commands for a successful build:
 +                                  file->mode & INITACCESSPERMS);
 +      }
        if (ret < 0) {
-               rsyserr(FERROR, errno, "%s %s -> \"%s\"",
+               rsyserr(FERROR_XFER, errno, "%s %s -> \"%s\"",
                        ret == -2 ? "copy" : "rename",
---- old/rsync.h
-+++ new/rsync.h
-@@ -807,6 +807,14 @@ struct stats {
+diff --git a/rsync.h b/rsync.h
+--- a/rsync.h
++++ b/rsync.h
+@@ -817,6 +817,14 @@ struct stats {
        int current_file_index;
  };
  
@@ -568,9 +576,10 @@ To use this patch, run these commands for a successful build:
  struct chmod_mode_struct;
  
  #define EMPTY_ITEM_LIST {NULL, 0, 0}
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -387,6 +387,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -388,6 +388,7 @@ to the detailed description below for a complete description.  verb(
       --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
diff --git a/links-depth.diff b/links-depth.diff
deleted file mode 100644 (file)
index e908bb8..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-The attached patch gives the user ability to define how many symbolic
-links rsync should follow before actually adding it to the file list.
-
-The patch has been heavily modified from its original form to work
-with the latest codebase, but even in its original form it didn't
-handle relative symlinks properly, and that has not yet been fixed
-in this modified version.
-
-To use this patch, run these commands for a successful build:
-
-    patch -p1 <patches/links-depth.diff
-    ./configure                          (optional if already run)
-    make
-
---- old/flist.c
-+++ new/flist.c
-@@ -47,6 +47,7 @@ extern int keep_dirlinks;
- extern int preserve_acls;
- extern int preserve_xattrs;
- extern int preserve_links;
-+extern int follow_links_depth;
- extern int preserve_hard_links;
- extern int preserve_devices;
- extern int preserve_specials;
-@@ -980,6 +981,30 @@ static struct file_struct *recv_file_ent
-       return file;
- }
-+#if SUPPORT_LINKS
-+static int links_depth(char *linkname, STRUCT_STAT *st_ptr)
-+{
-+      char buf[MAXPATHLEN];
-+      STRUCT_STAT st;
-+      int i;
-+
-+      for (i = 0; i < follow_links_depth; i++) {
-+              /* XXX This doesn't handle relative symlinks! */
-+              if (readlink_stat(linkname, &st, buf) != 0)
-+                      break;
-+              *st_ptr = st;
-+              if (!S_ISLNK(st.st_mode))
-+                      return 1;
-+              strlcpy(linkname, buf, MAXPATHLEN);
-+#if 0
-+              fprintf(stderr, "\n%s:%i [#%i] %s -> %s\n", __FILE__, __LINE__, i, file->u.link, linkname);
-+#endif
-+      }
-+
-+      return 0;
-+}
-+#endif
-+
- /* Create a file_struct for a named file by reading its stat() information
-  * and performing extensive checks against global options.
-  *
-@@ -1120,7 +1145,13 @@ struct file_struct *make_file(const char
-       basename_len = strlen(basename) + 1; /* count the '\0' */
- #ifdef SUPPORT_LINKS
--      linkname_len = S_ISLNK(st.st_mode) ? strlen(linkname) + 1 : 0;
-+      if (S_ISLNK(st.st_mode)) {
-+              if (follow_links_depth && links_depth(linkname, &st))
-+                      linkname_len = 0;
-+              else
-+                      linkname_len = strlen(linkname) + 1;
-+      } else
-+              linkname_len = 0;
- #else
-       linkname_len = 0;
- #endif
---- old/options.c
-+++ new/options.c
-@@ -46,6 +46,7 @@ int keep_dirlinks = 0;
- int copy_dirlinks = 0;
- int copy_links = 0;
- int preserve_links = 0;
-+int follow_links_depth = 0;
- int preserve_hard_links = 0;
- int preserve_acls = 0;
- int preserve_xattrs = 0;
-@@ -321,6 +322,7 @@ void usage(enum logcode F)
-   rprintf(F,"     --append                append data onto shorter files\n");
-   rprintf(F," -d, --dirs                  transfer directories without recursing\n");
-   rprintf(F," -l, --links                 copy symlinks as symlinks\n");
-+  rprintf(F,"     --links-depth=NUM       follow symlinks up to NUM depth\n");
-   rprintf(F," -L, --copy-links            transform symlink into referent file/dir\n");
-   rprintf(F,"     --copy-unsafe-links     only \"unsafe\" symlinks are transformed\n");
-   rprintf(F,"     --safe-links            ignore symlinks that point outside the source tree\n");
-@@ -496,6 +498,7 @@ static struct poptOption long_options[] 
-   {"links",           'l', POPT_ARG_VAL,    &preserve_links, 1, 0, 0 },
-   {"no-links",         0,  POPT_ARG_VAL,    &preserve_links, 0, 0, 0 },
-   {"no-l",             0,  POPT_ARG_VAL,    &preserve_links, 0, 0, 0 },
-+  {"links-depth",      0,  POPT_ARG_INT,    &follow_links_depth , 0, 0, 0 },
-   {"copy-links",      'L', POPT_ARG_NONE,   &copy_links, 0, 0, 0 },
-   {"copy-unsafe-links",0,  POPT_ARG_NONE,   &copy_unsafe_links, 0, 0, 0 },
-   {"safe-links",       0,  POPT_ARG_NONE,   &safe_symlinks, 0, 0, 0 },
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -335,6 +335,7 @@ to the detailed description below for a 
-      --append                append data onto shorter files
-  -d, --dirs                  transfer directories without recursing
-  -l, --links                 copy symlinks as symlinks
-+     --links-depth=NUM       follow symlinks up to NUM depth
-  -L, --copy-links            transform symlink into referent file/dir
-      --copy-unsafe-links     only "unsafe" symlinks are transformed
-      --safe-links            ignore symlinks that point outside the tree
index 5e3b1a3..530ca18 100644 (file)
@@ -6,9 +6,10 @@ compute them.
 
 -- Matt McCutchen <hashproduct@gmail.com>
 
---- old/log.c
-+++ new/log.c
-@@ -55,6 +55,9 @@ extern char curr_dir[];
+diff --git a/log.c b/log.c
+--- a/log.c
++++ b/log.c
+@@ -56,6 +56,9 @@ extern char curr_dir[];
  extern char *module_dir;
  extern unsigned int module_dirlen;
  
@@ -18,7 +19,7 @@ compute them.
  static int log_initialised;
  static int logfile_was_closed;
  static FILE *logfile_fp;
-@@ -610,6 +613,19 @@ static void log_formatted(enum logcode c
+@@ -621,6 +624,19 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
                        snprintf(buf2, sizeof buf2, fmt, (double)b);
                        n = buf2;
                        break;
@@ -38,9 +39,10 @@ compute them.
                case 'i':
                        if (iflags & ITEM_DELETED) {
                                n = "*deleting";
---- old/match.c
-+++ new/match.c
-@@ -286,6 +286,10 @@ static void hash_search(int f,struct sum
+diff --git a/match.c b/match.c
+--- a/match.c
++++ b/match.c
+@@ -312,6 +312,10 @@ static void hash_search(int f,struct sum_struct *s,
        map_ptr(buf, len-1, 1);
  }
  
@@ -51,7 +53,7 @@ compute them.
  
  /**
   * Scan through a origin file, looking for sections that match
-@@ -303,9 +307,6 @@ static void hash_search(int f,struct sum
+@@ -329,9 +333,6 @@ static void hash_search(int f,struct sum_struct *s,
   **/
  void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)
  {
@@ -61,7 +63,7 @@ compute them.
        last_match = 0;
        false_alarms = 0;
        hash_hits = 0;
-@@ -353,14 +354,26 @@ void match_sums(int f, struct sum_struct
+@@ -379,14 +380,26 @@ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)
                matched(f, s, buf, len, -1);
        }
  
@@ -93,9 +95,10 @@ compute them.
  
        if (verbose > 2)
                rprintf(FINFO, "false_alarms=%d hash_hits=%d matches=%d\n",
---- old/options.c
-+++ new/options.c
-@@ -1439,7 +1439,8 @@ int parse_arguments(int *argc, const cha
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -1469,7 +1469,8 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                else if (log_format_has(stdout_format, 'i'))
                        stdout_format_has_i = itemize_changes | 1;
                if (!log_format_has(stdout_format, 'b')
@@ -105,11 +108,12 @@ compute them.
                        log_before_transfer = !am_server;
        } else if (itemize_changes) {
                stdout_format = "%i %n%L";
---- old/receiver.c
-+++ new/receiver.c
+diff --git a/receiver.c b/receiver.c
+--- a/receiver.c
++++ b/receiver.c
 @@ -62,6 +62,9 @@ static int phase = 0, redoing = 0;
  /* We're either updating the basis file or an identical copy: */
- static int updating_basis;
+ static int updating_basis_or_equiv;
  
 +extern char sender_file_sum[MAX_DIGEST_LEN];
 +extern int file_sum_len;
@@ -117,7 +121,7 @@ compute them.
  /*
   * get_tmpname() - create a tmp filename for a given filename
   *
-@@ -128,10 +131,9 @@ static int receive_data(int f_in, char *
+@@ -165,10 +168,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
                        const char *fname, int fd, OFF_T total_size)
  {
        static char file_sum1[MAX_DIGEST_LEN];
@@ -129,7 +133,7 @@ compute them.
        OFF_T offset = 0;
        OFF_T offset2;
        char *data;
-@@ -261,15 +263,15 @@ static int receive_data(int f_in, char *
+@@ -298,15 +300,15 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
                exit_cleanup(RERR_FILEIO);
        }
  
@@ -148,9 +152,10 @@ compute them.
                return 0;
        return 1;
  }
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -1970,7 +1970,7 @@ by the server and defaults to the curren
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -2046,7 +2046,7 @@ by the server and defaults to the current code(time()).  This option
  is used to set a specific checksum seed, which is useful for
  applications that want repeatable block and file checksums, or
  in the case where the user wants a more random checksum seed.
@@ -159,9 +164,10 @@ compute them.
  for checksum seed.
  enddit()
  
---- old/rsyncd.conf.yo
-+++ new/rsyncd.conf.yo
-@@ -421,7 +421,8 @@ quote(itemization(
+diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
+--- a/rsyncd.conf.yo
++++ b/rsyncd.conf.yo
+@@ -460,7 +460,8 @@ quote(itemization(
    it() %a the remote IP address
    it() %b the number of bytes actually transferred
    it() %B the permission bits of the file (e.g. rwxrwxrwt)
index 8732782..5c3bdef 100644 (file)
@@ -9,9 +9,10 @@ To use this patch, run these commands for a successful build:
     ./configure                           (optional if already run)
     make
 
---- old/access.c
-+++ new/access.c
-@@ -20,11 +20,14 @@
+diff --git a/access.c b/access.c
+--- a/access.c
++++ b/access.c
+@@ -19,11 +19,14 @@
   */
  
  #include "rsync.h"
index 8bd9e2a..7721f3f 100644 (file)
@@ -7,8 +7,9 @@ To use this patch, run these commands for a successful build:
     ./configure                              (optional if already run)
     make
 
---- old/generator.c
-+++ new/generator.c
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
 @@ -43,6 +43,7 @@ extern int preserve_specials;
  extern int preserve_hard_links;
  extern int preserve_perms;
@@ -17,7 +18,7 @@ To use this patch, run these commands for a successful build:
  extern int uid_ndx;
  extern int gid_ndx;
  extern int delete_mode;
-@@ -554,6 +555,7 @@ void itemize(const char *fnamecmp, struc
+@@ -560,6 +561,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
                int keep_time = !preserve_times ? 0
                    : S_ISDIR(file->mode) ? preserve_times > 1
                    : !S_ISLNK(file->mode);
@@ -25,7 +26,7 @@ To use this patch, run these commands for a successful build:
  
                if (S_ISREG(file->mode) && F_LENGTH(file) != sxp->st.st_size)
                        iflags |= ITEM_REPORT_SIZE;
-@@ -569,10 +571,11 @@ void itemize(const char *fnamecmp, struc
+@@ -575,10 +577,11 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
  #endif
                if (!BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
                        iflags |= ITEM_REPORT_PERMS;
@@ -40,7 +41,7 @@ To use this patch, run these commands for a successful build:
                        iflags |= ITEM_REPORT_GROUP;
  #ifdef SUPPORT_ACLS
                if (preserve_acls && !S_ISLNK(file->mode)) {
-@@ -1288,7 +1291,7 @@ static void recv_generator(char *fname, 
+@@ -1321,7 +1324,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                real_sx = sx;
                if (file->flags & FLAG_DIR_CREATED)
                        statret = -1;
@@ -49,8 +50,9 @@ To use this patch, run these commands for a successful build:
                        file->mode = dest_mode(file->mode, sx.st.st_mode,
                                               dflt_perms, statret == 0);
                }
---- old/options.c
-+++ new/options.c
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
 @@ -57,6 +57,7 @@ int preserve_specials = 0;
  int preserve_uid = 0;
  int preserve_gid = 0;
@@ -59,7 +61,7 @@ To use this patch, run these commands for a successful build:
  int update_only = 0;
  int cvs_exclude = 0;
  int dry_run = 0;
-@@ -346,6 +347,7 @@ void usage(enum logcode F)
+@@ -347,6 +348,7 @@ void usage(enum logcode F)
    rprintf(F," -D                          same as --devices --specials\n");
    rprintf(F," -t, --times                 preserve modification times\n");
    rprintf(F," -O, --omit-dir-times        omit directories from --times\n");
@@ -67,7 +69,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F,"     --super                 receiver attempts super-user activities\n");
  #ifdef SUPPORT_XATTRS
    rprintf(F,"     --fake-super            store/recover privileged attrs using xattrs\n");
-@@ -483,6 +485,7 @@ static struct poptOption long_options[] 
+@@ -485,6 +487,7 @@ static struct poptOption long_options[] = {
    {"omit-dir-times",  'O', POPT_ARG_VAL,    &omit_dir_times, 1, 0, 0 },
    {"no-omit-dir-times",0,  POPT_ARG_VAL,    &omit_dir_times, 0, 0, 0 },
    {"no-O",             0,  POPT_ARG_VAL,    &omit_dir_times, 0, 0, 0 },
@@ -75,7 +77,7 @@ To use this patch, run these commands for a successful build:
    {"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 },
-@@ -1451,6 +1454,8 @@ int parse_arguments(int *argc_p, const c
+@@ -1454,6 +1457,8 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                parse_rule(&filter_list, backup_dir_buf, 0, 0);
        }
  
@@ -84,7 +86,7 @@ To use this patch, run these commands for a successful build:
        if (make_backups && !backup_dir) {
                omit_dir_times = 0; /* Implied, so avoid -O to sender. */
                if (preserve_times > 1)
-@@ -1687,6 +1692,8 @@ void server_options(char **args, int *ar
+@@ -1690,6 +1695,8 @@ void server_options(char **args, int *argc_p)
                        argstr[x++] = 'm';
                if (omit_dir_times)
                        argstr[x++] = 'O';
@@ -93,8 +95,9 @@ To use this patch, run these commands for a successful build:
        } else {
                if (copy_links)
                        argstr[x++] = 'L';
---- old/rsync.c
-+++ new/rsync.c
+diff --git a/rsync.c b/rsync.c
+--- a/rsync.c
++++ b/rsync.c
 @@ -34,6 +34,7 @@ extern int preserve_xattrs;
  extern int preserve_perms;
  extern int preserve_executability;
@@ -103,7 +106,7 @@ To use this patch, run these commands for a successful build:
  extern int am_root;
  extern int am_server;
  extern int am_sender;
-@@ -397,9 +398,11 @@ int set_file_attrs(const char *fname, st
+@@ -400,9 +401,11 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
                        updated = 1;
        }
  
@@ -117,9 +120,10 @@ To use this patch, run these commands for a successful build:
  #if !defined HAVE_LCHOWN && !defined CHOWN_MODIFIES_SYMLINK
        if (S_ISLNK(sxp->st.st_mode)) {
                ;
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -349,6 +349,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -349,6 +349,7 @@ to the detailed description below for a complete description.  verb(
   -D                          same as --devices --specials
   -t, --times                 preserve modification times
   -O, --omit-dir-times        omit directories from --times
@@ -127,7 +131,7 @@ To use this patch, run these commands for a successful build:
       --super                 receiver attempts super-user activities
       --fake-super            store/recover privileged attrs using xattrs
   -S, --sparse                handle sparse files efficiently
-@@ -965,6 +966,10 @@ it is preserving modification times (see
+@@ -974,6 +975,10 @@ it is preserving modification times (see bf(--times)).  If NFS is sharing
  the directories on the receiving side, it is a good idea to use bf(-O).
  This option is inferred if you use bf(--backup) without bf(--backup-dir).
  
index 65ba135..2953149 100644 (file)
@@ -35,9 +35,10 @@ To use this patch, run these commands for a successful build:
     ./configure
     make
 
---- old/Makefile.in
-+++ new/Makefile.in
-@@ -39,7 +39,7 @@ OBJS3=progress.o pipe.o
+diff --git a/Makefile.in b/Makefile.in
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -40,7 +40,7 @@ OBJS3=progress.o pipe.o
  DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
  popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
        popt/popthelp.o popt/poptparse.o
@@ -46,8 +47,9 @@ To use this patch, run these commands for a successful build:
  
  TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
  
---- old/cleanup.c
-+++ new/cleanup.c
+diff --git a/cleanup.c b/cleanup.c
+--- a/cleanup.c
++++ b/cleanup.c
 @@ -25,6 +25,9 @@
  extern int am_server;
  extern int am_daemon;
@@ -56,9 +58,9 @@ To use this patch, run these commands for a successful build:
 +extern int use_ssl;
 +#endif
  extern int keep_partial;
- extern int log_got_error;
+ extern int got_xfer_error;
  extern char *partial_dir;
-@@ -121,6 +124,14 @@ NORETURN void _exit_cleanup(int code, co
+@@ -121,6 +124,14 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
                                code, file, line);
                }
  
@@ -73,9 +75,10 @@ To use this patch, run these commands for a successful build:
                /* FALLTHROUGH */
  #include "case_N.h"
  
---- old/clientserver.c
-+++ new/clientserver.c
-@@ -29,6 +29,9 @@ extern int am_sender;
+diff --git a/clientserver.c b/clientserver.c
+--- a/clientserver.c
++++ b/clientserver.c
+@@ -30,6 +30,9 @@ extern int am_sender;
  extern int am_server;
  extern int am_daemon;
  extern int am_root;
@@ -85,14 +88,13 @@ To use this patch, run these commands for a successful build:
  extern int rsync_port;
  extern int ignore_errors;
  extern int kluge_around_eof;
-@@ -112,8 +115,18 @@ int start_socket_client(char *host, int 
+@@ -115,8 +118,18 @@ int start_socket_client(char *host, int remote_argc, char *remote_argv[],
        set_socket_options(fd, sockopts);
  
        ret = start_inband_exchange(fd, fd, user, remote_argc, remote_argv);
 +      if (ret)
 +              return ret;
--      return ret ? ret : client_run(fd, fd, -1, argc, argv);
++
 +#ifdef HAVE_OPENSSL
 +      if (use_ssl) {
 +              int f_in = get_tls_rfd();
@@ -100,12 +102,13 @@ To use this patch, run these commands for a successful build:
 +              return client_run(f_in, f_out, -1, argc, argv);
 +      }
 +#endif
-+
+-      return ret ? ret : client_run(fd, fd, -1, argc, argv);
 +      return client_run(fd, fd, -1, argc, argv);
  }
  
  static int exchange_protocols(int f_in, int f_out, char *buf, size_t bufsiz, int am_client)
-@@ -256,6 +269,32 @@ int start_inband_exchange(int f_in, int 
+@@ -259,6 +272,32 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
        if (verbose > 1)
                print_child_argv("sending daemon args:", sargs);
  
@@ -138,7 +141,7 @@ To use this patch, run these commands for a successful build:
        io_printf(f_out, "%.*s\n", modlen, modname);
  
        /* Old servers may just drop the connection here,
-@@ -281,6 +320,10 @@ int start_inband_exchange(int f_in, int 
+@@ -284,6 +323,10 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
                         * server to terminate the listing of modules.
                         * We don't want to go on and transfer
                         * anything; just exit. */
@@ -149,7 +152,7 @@ To use this patch, run these commands for a successful build:
                        exit(0);
                }
  
-@@ -288,6 +331,10 @@ int start_inband_exchange(int f_in, int 
+@@ -291,6 +334,10 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
                        rprintf(FERROR, "%s\n", line);
                        /* This is always fatal; the server will now
                         * close the socket. */
@@ -160,7 +163,7 @@ To use this patch, run these commands for a successful build:
                        return -1;
                }
  
-@@ -818,6 +865,9 @@ int start_daemon(int f_in, int f_out)
+@@ -835,6 +882,9 @@ int start_daemon(int f_in, int f_out)
        if (exchange_protocols(f_in, f_out, line, sizeof line, 0) < 0)
                return -1;
  
@@ -170,7 +173,7 @@ To use this patch, run these commands for a successful build:
        line[0] = 0;
        if (!read_line_old(f_in, line, sizeof line))
                return -1;
-@@ -829,6 +879,20 @@ int start_daemon(int f_in, int f_out)
+@@ -846,6 +896,20 @@ int start_daemon(int f_in, int f_out)
                return -1;
        }
  
@@ -191,9 +194,10 @@ To use this patch, run these commands for a successful build:
        if (*line == '#') {
                /* it's some sort of command that I don't understand */
                io_printf(f_out, "@ERROR: Unknown command '%s'\n", line);
---- old/configure.in
-+++ new/configure.in
-@@ -290,6 +290,21 @@ if test x"$enable_locale" != x"no"; then
+diff --git a/configure.in b/configure.in
+--- a/configure.in
++++ b/configure.in
+@@ -295,6 +295,21 @@ if test x"$enable_locale" != x"no"; then
        AC_DEFINE(CONFIG_LOCALE)
  fi
  
@@ -215,9 +219,10 @@ To use this patch, run these commands for a successful build:
  AC_MSG_CHECKING([whether to call shutdown on all sockets])
  case $host_os in
        *cygwin* ) AC_MSG_RESULT(yes)
---- old/options.c
-+++ new/options.c
-@@ -182,6 +182,14 @@ int logfile_format_has_o_or_i = 0;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -183,6 +183,14 @@ int logfile_format_has_o_or_i = 0;
  int always_checksum = 0;
  int list_only = 0;
  
@@ -232,7 +237,7 @@ To use this patch, run these commands for a successful build:
  #define MAX_BATCH_NAME_LEN 256        /* Must be less than MAXPATHLEN-13 */
  char *batch_name = NULL;
  
-@@ -221,6 +229,7 @@ static void print_rsync_version(enum log
+@@ -222,6 +230,7 @@ static void print_rsync_version(enum logcode f)
        char const *links = "no ";
        char const *iconv = "no ";
        char const *ipv6 = "no ";
@@ -240,7 +245,7 @@ To use this patch, run these commands for a successful build:
        STRUCT_STAT *dumstat;
  
  #if SUBPROTOCOL_VERSION != 0
-@@ -250,6 +259,9 @@ static void print_rsync_version(enum log
+@@ -251,6 +260,9 @@ static void print_rsync_version(enum logcode f)
  #ifdef ICONV_OPTION
        iconv = "";
  #endif
@@ -250,7 +255,7 @@ To use this patch, run these commands for a successful build:
  
        rprintf(f, "%s  version %s  protocol version %d%s\n",
                RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -263,8 +275,8 @@ static void print_rsync_version(enum log
+@@ -264,8 +276,8 @@ static void print_rsync_version(enum logcode f)
                (int)(sizeof (int64) * 8));
        rprintf(f, "    %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
                got_socketpair, hardlinks, links, ipv6, have_inplace);
@@ -261,7 +266,7 @@ To use this patch, run these commands for a successful build:
  
  #ifdef MAINTAINER_MODE
        rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -425,6 +437,13 @@ void usage(enum logcode F)
+@@ -427,6 +439,13 @@ void usage(enum logcode F)
  #endif
    rprintf(F," -4, --ipv4                  prefer IPv4\n");
    rprintf(F," -6, --ipv6                  prefer IPv6\n");
@@ -275,7 +280,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F,"     --version               print version number\n");
    rprintf(F,"(-h) --help                  show this help (-h works with no other options)\n");
  
-@@ -438,7 +457,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -440,7 +459,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
        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,
@@ -284,7 +289,7 @@ To use this patch, run these commands for a successful build:
        OPT_SERVER, OPT_REFUSED_BASE = 9000};
  
  static struct poptOption long_options[] = {
-@@ -623,6 +642,13 @@ static struct poptOption long_options[] 
+@@ -626,6 +645,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 },
@@ -298,7 +303,7 @@ To use this patch, run these commands for a successful build:
    /* 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 },
-@@ -648,6 +674,13 @@ static void daemon_usage(enum logcode F)
+@@ -651,6 +677,13 @@ static void daemon_usage(enum logcode F)
    rprintf(F," -v, --verbose               increase verbosity\n");
    rprintf(F," -4, --ipv4                  prefer IPv4\n");
    rprintf(F," -6, --ipv6                  prefer IPv6\n");
@@ -312,7 +317,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F,"     --help                  show this help screen\n");
  
    rprintf(F,"\n");
-@@ -672,6 +705,13 @@ static struct poptOption long_daemon_opt
+@@ -675,6 +708,13 @@ static struct poptOption long_daemon_options[] = {
    {"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 },
@@ -326,7 +331,7 @@ To use this patch, run these commands for a successful build:
    {"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 },
-@@ -946,6 +986,12 @@ int parse_arguments(int *argc_p, const c
+@@ -949,6 +989,12 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                                        verbose++;
                                        break;
  
@@ -339,7 +344,7 @@ To use this patch, run these commands for a successful build:
                                default:
                                        rprintf(FERROR,
                                            "rsync: %s: %s (in daemon mode)\n",
-@@ -969,6 +1015,17 @@ int parse_arguments(int *argc_p, const c
+@@ -972,6 +1018,17 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                                exit_cleanup(RERR_SYNTAX);
                        }
  
@@ -357,7 +362,7 @@ To use this patch, run these commands for a successful build:
                        *argv_p = argv = poptGetArgs(pc);
                        *argc_p = argc = count_args(argv);
                        am_starting_up = 0;
-@@ -1221,6 +1278,12 @@ int parse_arguments(int *argc_p, const c
+@@ -1224,6 +1281,12 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                        return 0;
  #endif
  
@@ -370,7 +375,7 @@ To use this patch, run these commands for a successful build:
                default:
                        /* A large opt value means that set_refuse_options()
                         * turned this option off. */
-@@ -1535,6 +1598,17 @@ int parse_arguments(int *argc_p, const c
+@@ -1538,6 +1601,17 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
        if (delay_updates && !partial_dir)
                partial_dir = tmp_partialdir;
  
@@ -388,13 +393,14 @@ To use this patch, run these commands for a successful build:
        if (inplace) {
  #ifdef HAVE_FTRUNCATE
                if (partial_dir) {
-@@ -2007,10 +2081,27 @@ char *check_for_hostspec(char *s, char *
+@@ -2010,10 +2084,27 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr)
        char *p;
        int not_host;
        int hostlen;
-+      int url_prefix_len = sizeof URL_PREFIX - 1;
+-
 -      if (port_ptr && strncasecmp(URL_PREFIX, s, strlen(URL_PREFIX)) == 0) {
++      int url_prefix_len = sizeof URL_PREFIX - 1;
++
 +      if (!port_ptr)
 +              url_prefix_len = 0;
 +      else if (strncasecmp(URL_PREFIX, s, url_prefix_len) != 0) {
@@ -418,17 +424,18 @@ To use this patch, run these commands for a successful build:
                if ((p = strchr(s, '/')) != NULL) {
                        hostlen = p - s;
                        path = p + 1;
---- old/rsync.h
-+++ new/rsync.h
+diff --git a/rsync.h b/rsync.h
+--- a/rsync.h
++++ b/rsync.h
 @@ -31,6 +31,7 @@
  
  #define DEFAULT_LOCK_FILE "/var/run/rsyncd.lock"
  #define URL_PREFIX "rsync://"
 +#define SSL_URL_PREFIX "rsyncs://"
  
- #define BACKUP_SUFFIX "~"
-@@ -520,6 +521,11 @@ typedef unsigned int size_t;
+ #define SYMLINK_PREFIX "/rsyncd-munged/"
+ #define SYMLINK_PREFIX_LEN ((int)sizeof SYMLINK_PREFIX - 1)
+@@ -536,6 +537,11 @@ typedef unsigned int size_t;
  # define SIZEOF_INT64 SIZEOF_OFF_T
  #endif
  
@@ -440,8 +447,10 @@ To use this patch, run these commands for a successful build:
  struct hashtable {
        void *nodes;
        int32 size, entries;
---- old/ssl.c
-+++ new/ssl.c
+diff --git a/ssl.c b/ssl.c
+new file mode 100644
+--- /dev/null
++++ b/ssl.c
 @@ -0,0 +1,370 @@
 +/* -*- c-file-style: "linux" -*-
 + * ssl.c: operations for negotiating SSL rsync connections. 
index c2c77ff..862f427 100644 (file)
@@ -8,9 +8,10 @@ To use this patch, run these commands for a successful build:
     ./configure                                 (optional if already run)
     make
 
---- old/lib/sysxattrs.c
-+++ new/lib/sysxattrs.c
-@@ -52,29 +52,118 @@ ssize_t sys_llistxattr(const char *path,
+diff --git a/lib/sysxattrs.c b/lib/sysxattrs.c
+--- a/lib/sysxattrs.c
++++ b/lib/sysxattrs.c
+@@ -52,29 +52,118 @@ ssize_t sys_llistxattr(const char *path, char *list, size_t size)
  
  #elif HAVE_OSX_XATTRS
  
index 476b4da..6c43dbe 100644 (file)
@@ -9,9 +9,10 @@ To use this patch, run these commands for a successful build:
     ./configure
     make
 
---- old/configure.in
-+++ new/configure.in
-@@ -547,7 +547,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
+diff --git a/configure.in b/configure.in
+--- a/configure.in
++++ b/configure.in
+@@ -552,7 +552,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
      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 getxattr \
@@ -20,8 +21,9 @@ To use this patch, run these commands for a successful build:
  
  AC_CHECK_FUNCS(getpgrp tcgetpgrp)
  if test $ac_cv_func_getpgrp = yes; then
---- old/options.c
-+++ new/options.c
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
 @@ -71,6 +71,7 @@ int remove_source_files = 0;
  int one_file_system = 0;
  int protocol_version = PROTOCOL_VERSION;
@@ -30,7 +32,7 @@ To use this patch, run these commands for a successful build:
  int do_compression = 0;
  int def_compress_level = Z_DEFAULT_COMPRESSION;
  int am_root = 0; /* 0 = normal, 1 = root, 2 = --super, -1 = --fake-super */
-@@ -221,6 +222,7 @@ static void print_rsync_version(enum log
+@@ -222,6 +223,7 @@ static void print_rsync_version(enum logcode f)
        char const *links = "no ";
        char const *iconv = "no ";
        char const *ipv6 = "no ";
@@ -38,7 +40,7 @@ To use this patch, run these commands for a successful build:
        STRUCT_STAT *dumstat;
  
  #if SUBPROTOCOL_VERSION != 0
-@@ -250,6 +252,9 @@ static void print_rsync_version(enum log
+@@ -251,6 +253,9 @@ static void print_rsync_version(enum logcode f)
  #ifdef ICONV_OPTION
        iconv = "";
  #endif
@@ -48,7 +50,7 @@ To use this patch, run these commands for a successful build:
  
        rprintf(f, "%s  version %s  protocol version %d%s\n",
                RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -263,8 +268,8 @@ static void print_rsync_version(enum log
+@@ -264,8 +269,8 @@ static void print_rsync_version(enum logcode f)
                (int)(sizeof (int64) * 8));
        rprintf(f, "    %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
                got_socketpair, hardlinks, links, ipv6, have_inplace);
@@ -59,7 +61,7 @@ To use this patch, run these commands for a successful build:
  
  #ifdef MAINTAINER_MODE
        rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -351,6 +356,9 @@ void usage(enum logcode F)
+@@ -352,6 +357,9 @@ void usage(enum logcode F)
    rprintf(F,"     --fake-super            store/recover privileged attrs using xattrs\n");
  #endif
    rprintf(F," -S, --sparse                handle sparse files efficiently\n");
@@ -69,7 +71,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F," -n, --dry-run               perform a trial run with no changes made\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");
-@@ -528,6 +536,7 @@ static struct poptOption long_options[] 
+@@ -530,6 +538,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 },
@@ -77,7 +79,7 @@ To use this patch, run these commands for a successful build:
    {"inplace",          0,  POPT_ARG_NONE,   &inplace, 0, 0, 0 },
    {"append",           0,  POPT_ARG_NONE,   0, OPT_APPEND, 0, 0 },
    {"append-verify",    0,  POPT_ARG_VAL,    &append_mode, 2, 0, 0 },
-@@ -1284,6 +1293,15 @@ int parse_arguments(int *argc_p, const c
+@@ -1287,6 +1296,15 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
        }
  #endif
  
@@ -93,7 +95,7 @@ To use this patch, run these commands for a successful build:
        if (write_batch && read_batch) {
                snprintf(err_buf, sizeof err_buf,
                        "--write-batch and --read-batch can not be used together\n");
-@@ -1988,6 +2006,9 @@ void server_options(char **args, int *ar
+@@ -1991,6 +2009,9 @@ void server_options(char **args, int *argc_p)
        else if (remove_source_files)
                args[ac++] = "--remove-sent-files";
  
@@ -103,8 +105,9 @@ To use this patch, run these commands for a successful build:
        *argc_p = ac;
        return;
  
---- old/receiver.c
-+++ new/receiver.c
+diff --git a/receiver.c b/receiver.c
+--- a/receiver.c
++++ b/receiver.c
 @@ -45,6 +45,7 @@ extern int cleanup_got_literal;
  extern int remove_source_files;
  extern int append_mode;
@@ -113,12 +116,12 @@ To use this patch, run these commands for a successful build:
  extern int keep_partial;
  extern int checksum_seed;
  extern int inplace;
-@@ -175,6 +176,19 @@ static int receive_data(int f_in, char *
+@@ -175,6 +176,19 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
        int32 i;
        char *map = NULL;
  
 +#ifdef SUPPORT_PREALLOCATION
-+      int preallocated_len = 0;
++      OFF_T preallocated_len = 0;
 +
 +      if (preallocate_files && fd != -1 && total_size > 0) {
 +              /* Preallocate enough space for file's eventual length if
@@ -133,7 +136,7 @@ To use this patch, run these commands for a successful build:
        read_sum_head(f_in, &sum);
  
        if (fd_r >= 0 && size_r > 0) {
-@@ -284,8 +298,18 @@ static int receive_data(int f_in, char *
+@@ -284,8 +298,18 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
                goto report_write_error;
  
  #ifdef HAVE_FTRUNCATE
@@ -150,13 +153,14 @@ To use this patch, run these commands for a successful build:
 +              if (ftruncate(fd, offset) < 0)
 +                      /* If we fail to truncate, the dest file may be wrong, so we
 +                       * must trigger the "partial transfer" error. */
-+                      rsyserr(FERROR, errno, "ftruncate %s", full_fname(fname));
++                      rsyserr(FERROR_XFER, errno, "ftruncate %s", full_fname(fname));
  #endif
  
        if (do_progress)
---- old/rsync.h
-+++ new/rsync.h
-@@ -590,6 +590,10 @@ struct ht_int64_node {
+diff --git a/rsync.h b/rsync.h
+--- a/rsync.h
++++ b/rsync.h
+@@ -600,6 +600,10 @@ struct ht_int64_node {
  #define ACLS_NEED_MASK 1
  #endif
  
@@ -167,9 +171,10 @@ To use this patch, run these commands for a successful build:
  union file_extras {
        int32 num;
        uint32 unum;
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -352,6 +352,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -352,6 +352,7 @@ to the detailed description below for a complete description.  verb(
       --super                 receiver attempts super-user activities
       --fake-super            store/recover privileged attrs using xattrs
   -S, --sparse                handle sparse files efficiently
@@ -177,7 +182,7 @@ To use this patch, run these commands for a successful build:
   -n, --dry-run               perform a trial run with no changes made
   -W, --whole-file            copy files whole (without rsync algorithm)
   -x, --one-file-system       don't cross filesystem boundaries
-@@ -1022,6 +1023,19 @@ NOTE: Don't use this option when the des
+@@ -1023,6 +1024,19 @@ NOTE: Don't use this option when the destination is a Solaris "tmpfs"
  filesystem. It doesn't seem to handle seeks over null regions
  correctly and ends up corrupting the files.
  
@@ -197,8 +202,9 @@ To use this patch, run these commands for a successful build:
  dit(bf(-n, --dry-run)) This makes rsync perform a trial run that doesn't
  make any changes (and produces mostly the same output as a real run).  It
  is most commonly used in combination with the bf(-v, --verbose) and/or
---- old/t_stub.c
-+++ new/t_stub.c
+diff --git a/t_stub.c b/t_stub.c
+--- a/t_stub.c
++++ b/t_stub.c
 @@ -22,6 +22,7 @@
  #include "rsync.h"
  
@@ -207,8 +213,9 @@ To use this patch, run these commands for a successful build:
  int module_id = -1;
  int relative_paths = 0;
  int human_readable = 0;
---- old/util.c
-+++ new/util.c
+diff --git a/util.c b/util.c
+--- a/util.c
++++ b/util.c
 @@ -25,6 +25,7 @@
  
  extern int verbose;
@@ -217,18 +224,18 @@ To use this patch, run these commands for a successful build:
  extern int module_id;
  extern int modify_window;
  extern int relative_paths;
-@@ -272,6 +273,10 @@ int copy_file(const char *source, const 
+@@ -272,6 +273,10 @@ int copy_file(const char *source, const char *dest, int ofd,
        int ifd;
        char buf[1024 * 8];
        int len;   /* Number of bytes read into `buf'. */
 +#ifdef SUPPORT_PREALLOCATION
-+      int preallocated_len = 0;
-+      int offset = 0;
++      OFF_T preallocated_len = 0;
++      OFF_T offset = 0;
 +#endif
  
        if ((ifd = do_open(source, O_RDONLY, 0)) < 0) {
-               rsyserr(FERROR, errno, "open %s", full_fname(source));
-@@ -293,7 +298,27 @@ int copy_file(const char *source, const 
+               rsyserr(FERROR_XFER, errno, "open %s", full_fname(source));
+@@ -293,7 +298,27 @@ int copy_file(const char *source, const char *dest, int ofd,
                }
        }
  
@@ -254,9 +261,9 @@ To use this patch, run these commands for a successful build:
 +              offset += len;
 +#endif
                if (full_write(ofd, buf, len) < 0) {
-                       rsyserr(FERROR, errno, "write %s", full_fname(dest));
+                       rsyserr(FERROR_XFER, errno, "write %s", full_fname(dest));
                        close(ifd);
-@@ -314,6 +339,16 @@ int copy_file(const char *source, const 
+@@ -314,6 +339,16 @@ int copy_file(const char *source, const char *dest, int ofd,
                        full_fname(source));
        }
  
@@ -267,9 +274,9 @@ To use this patch, run these commands for a successful build:
 +              if (ftruncate(ofd, offset) < 0)
 +                      /* If we fail to truncate, the dest file may be wrong, so we
 +                       * must trigger the "partial transfer" error. */
-+                      rsyserr(FERROR, errno, "ftruncate %s", full_fname(dest));
++                      rsyserr(FERROR_XFER, errno, "ftruncate %s", full_fname(dest));
 +#endif
 +
        if (close(ofd) < 0) {
-               rsyserr(FERROR, errno, "close failed on %s",
+               rsyserr(FERROR_XFER, errno, "close failed on %s",
                        full_fname(dest));
diff --git a/segment_large_hash.diff b/segment_large_hash.diff
deleted file mode 100644 (file)
index f7297bb..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-This patch causes the sender to segment its use of the block-finding
-hashtable for really large files.  This avoids overloading the
-hashtable, and the ensuing slowdown that ensues from trying to find
-blocks in an overloaded hashtable.  This does mean that the sender
-won't notice some migrations of data past segment boundaries, but since
-this only affects files with ~1.6GB or more data, and the blocksize is
-already so large that we only find really large sequences of matching
-data anyway, I don't consider this that big of a loss.
-
-I also decreased the MAX_BLOCK_SIZE value to something more reasonable.
-
-To use this patch, run these commands for a successful build:
-
-    patch -p1 <patches/segment_large_hash.diff
-    ./configure                                 (optional if already run)
-    make
-
---- old/match.c
-+++ new/match.c
-@@ -46,9 +46,9 @@ static int32 *hash_table;
- #define SUM2HASH2(s1,s2) (((s1) + (s2)) & 0xFFFF)
- #define SUM2HASH(sum) SUM2HASH2((sum)&0xFFFF,(sum)>>16)
--static void build_hash_table(struct sum_struct *s)
-+static int32 build_hash_table(struct sum_struct *s, int32 start)
- {
--      int32 i;
-+      int32 i, end = s->count;
-       if (!hash_table) {
-               hash_table = new_array(int32, TABLESIZE);
-@@ -58,11 +58,21 @@ static void build_hash_table(struct sum_
-       memset(hash_table, 0xFF, TABLESIZE * sizeof hash_table[0]);
--      for (i = 0; i < s->count; i++) {
-+      if (end - start > TABLESIZE*8/10)
-+              end = start + TABLESIZE*8/10;
-+
-+      for (i = start; i < end; i++) {
-               uint32 t = SUM2HASH(s->sums[i].sum1);
-               s->sums[i].chain = hash_table[t];
-               hash_table[t] = i;
-       }
-+
-+      if (verbose > 2) {
-+              rprintf(FINFO, "built hash table for entries %ld - %ld\n",
-+                      (long)start, (long)end - 1);
-+      }
-+
-+      return end;
- }
-@@ -120,8 +130,8 @@ static void matched(int f, struct sum_st
- static void hash_search(int f,struct sum_struct *s,
-                       struct map_struct *buf, OFF_T len)
- {
--      OFF_T offset, end;
--      int32 k, want_i, backup;
-+      OFF_T offset, end, reset = 0;
-+      int32 k, want_i, backup, sum_pos = 0;
-       char sum2[SUM_LENGTH];
-       uint32 s1, s2, sum;
-       int more;
-@@ -159,6 +169,11 @@ static void hash_search(int f,struct sum
-               int done_csum2 = 0;
-               int32 i;
-+              if (offset >= reset) {
-+                      sum_pos = build_hash_table(s, sum_pos);
-+                      reset = sum_pos * s->blength;
-+              }
-+
-               if (verbose > 4) {
-                       rprintf(FINFO, "offset=%.0f sum=%04x%04x\n",
-                               (double)offset, s2 & 0xFFFF, s1 & 0xFFFF);
-@@ -336,11 +351,6 @@ void match_sums(int f, struct sum_struct
-       }
-       if (len > 0 && s->count > 0) {
--              build_hash_table(s);
--
--              if (verbose > 2)
--                      rprintf(FINFO,"built hash table\n");
--
-               hash_search(f, s, buf, len);
-               if (verbose > 2)
---- old/rsync.h
-+++ new/rsync.h
-@@ -121,7 +121,7 @@
- #define CHUNK_SIZE (32*1024)
- #define MAX_MAP_SIZE (256*1024)
- #define IO_BUFFER_SIZE (4092)
--#define MAX_BLOCK_SIZE ((int32)1 << 29)
-+#define MAX_BLOCK_SIZE ((int32)1 << 17)
- #define IOERR_GENERAL (1<<0) /* For backward compatibility, this must == 1 */
- #define IOERR_VANISHED        (1<<1)
index a5083cb..55ba0bb 100644 (file)
@@ -14,17 +14,18 @@ To use this patch, run these commands for a successful build:
     ./configure                           (optional if already run)
     make
 
---- old/flist.c
-+++ new/flist.c
-@@ -65,6 +65,7 @@ extern int protocol_version;
- extern int sanitize_paths;
+diff --git a/flist.c b/flist.c
+--- a/flist.c
++++ b/flist.c
+@@ -66,6 +66,7 @@ extern int sanitize_paths;
+ extern int munge_symlinks;
  extern int need_unsorted_flist;
  extern int unsort_ndx;
 +extern unsigned long sleep_asec;
  extern struct stats stats;
  extern char *filesfrom_host;
  
-@@ -1480,6 +1481,9 @@ static void send_directory(int f, struct
+@@ -1494,6 +1495,9 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
                }
  
                send_file_name(f, flist, fbuf, NULL, flags, filter_level);
@@ -34,9 +35,10 @@ To use this patch, run these commands for a successful build:
        }
  
        fbuf[len] = '\0';
---- old/options.c
-+++ new/options.c
-@@ -106,6 +106,7 @@ int size_only = 0;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -107,6 +107,7 @@ int size_only = 0;
  int daemon_bwlimit = 0;
  int bwlimit = 0;
  int fuzzy_basis = 0;
@@ -44,7 +46,7 @@ To use this patch, run these commands for a successful build:
  size_t bwlimit_writemax = 0;
  int ignore_existing = 0;
  int ignore_non_existing = 0;
-@@ -416,6 +417,7 @@ void usage(enum logcode F)
+@@ -418,6 +419,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");
@@ -52,7 +54,7 @@ To use this patch, run these commands for a successful build:
    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");
-@@ -583,6 +585,7 @@ static struct poptOption long_options[] 
+@@ -585,6 +587,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 },
index daa0f91..a09ebdf 100644 (file)
--- a/slp.diff
+++ b/slp.diff
@@ -10,8 +10,9 @@ To use this patch, run these commands for a successful build:
 TODO: the configure changes should abort if the user requests --enable-slp
 and we can't honor that request.
 
---- old/Makefile.in
-+++ new/Makefile.in
+diff --git a/Makefile.in b/Makefile.in
+--- a/Makefile.in
++++ b/Makefile.in
 @@ -13,6 +13,8 @@ CFLAGS=@CFLAGS@
  CPPFLAGS=@CPPFLAGS@
  EXEEXT=@EXEEXT@
@@ -21,7 +22,7 @@ and we can't honor that request.
  
  INSTALLCMD=@INSTALL@
  INSTALLMAN=@INSTALL@
-@@ -36,7 +38,7 @@ OBJS1=flist.o rsync.o generator.o receiv
+@@ -37,7 +39,7 @@ OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
  OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
        fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
  OBJS3=progress.o pipe.o
@@ -30,7 +31,7 @@ and we can't honor that request.
  popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
        popt/popthelp.o popt/poptparse.o
  OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@
-@@ -72,7 +74,7 @@ install-strip:
+@@ -73,7 +75,7 @@ install-strip:
        $(MAKE) INSTALL_STRIP='-s' install
  
  rsync$(EXEEXT): $(OBJS)
@@ -39,9 +40,10 @@ and we can't honor that request.
  
  $(OBJS): $(HEADERS)
  
---- old/clientserver.c
-+++ new/clientserver.c
-@@ -952,6 +952,13 @@ int daemon_main(void)
+diff --git a/clientserver.c b/clientserver.c
+--- a/clientserver.c
++++ b/clientserver.c
+@@ -969,6 +969,13 @@ int daemon_main(void)
         * address too.  In fact, why not just do inet_ntop on the
         * local address??? */
  
@@ -55,9 +57,10 @@ and we can't honor that request.
        start_accept_loop(rsync_port, start_daemon);
        return -1;
  }
---- old/configure.in
-+++ new/configure.in
-@@ -625,6 +625,29 @@ if test $rsync_cv_can_hardlink_special =
+diff --git a/configure.in b/configure.in
+--- a/configure.in
++++ b/configure.in
+@@ -632,6 +632,29 @@ if test $rsync_cv_can_hardlink_special = yes; then
      AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
  fi
  
@@ -87,8 +90,9 @@ and we can't honor that request.
  AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
  AC_TRY_RUN([
  #include <sys/types.h>
---- old/loadparm.c
-+++ new/loadparm.c
+diff --git a/loadparm.c b/loadparm.c
+--- a/loadparm.c
++++ b/loadparm.c
 @@ -111,6 +111,9 @@ typedef struct
        char *socket_options;
  
@@ -99,7 +103,7 @@ and we can't honor that request.
  } global;
  
  static global Globals;
-@@ -296,6 +299,9 @@ static struct parm_struct parm_table[] =
+@@ -298,6 +301,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},
@@ -109,7 +113,7 @@ and we can't honor that request.
   {"socket options",    P_STRING, P_GLOBAL,&Globals.socket_options,     NULL,0},
  
   {"auth users",        P_STRING, P_LOCAL, &sDefault.auth_users,        NULL,0},
-@@ -387,6 +393,9 @@ FN_GLOBAL_STRING(lp_pid_file, &Globals.p
+@@ -390,6 +396,9 @@ FN_GLOBAL_STRING(lp_pid_file, &Globals.pid_file)
  FN_GLOBAL_STRING(lp_socket_options, &Globals.socket_options)
  
  FN_GLOBAL_INTEGER(lp_rsync_port, &Globals.rsync_port)
@@ -119,9 +123,10 @@ and we can't honor that request.
  
  FN_LOCAL_STRING(lp_auth_users, auth_users)
  FN_LOCAL_STRING(lp_comment, comment)
---- old/main.c
-+++ new/main.c
-@@ -1139,6 +1139,18 @@ static int start_client(int argc, char *
+diff --git a/main.c b/main.c
+--- a/main.c
++++ b/main.c
+@@ -1141,6 +1141,18 @@ static int start_client(int argc, char *argv[])
  
        if (!read_batch) { /* for read_batch, NO source is specified */
                char *path = check_for_hostspec(argv[0], &shell_machine, &rsync_port);
@@ -140,9 +145,10 @@ and we can't honor that request.
                if (path) { /* source is remote */
                        char *dummy_host;
                        int dummy_port = 0;
---- old/options.c
-+++ new/options.c
-@@ -221,6 +221,7 @@ static void print_rsync_version(enum log
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -222,6 +222,7 @@ static void print_rsync_version(enum logcode f)
        char const *links = "no ";
        char const *iconv = "no ";
        char const *ipv6 = "no ";
@@ -150,7 +156,7 @@ and we can't honor that request.
        STRUCT_STAT *dumstat;
  
  #if SUBPROTOCOL_VERSION != 0
-@@ -250,6 +251,9 @@ static void print_rsync_version(enum log
+@@ -251,6 +252,9 @@ static void print_rsync_version(enum logcode f)
  #ifdef ICONV_OPTION
        iconv = "";
  #endif
@@ -160,7 +166,7 @@ and we can't honor that request.
  
        rprintf(f, "%s  version %s  protocol version %d%s\n",
                RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -263,8 +267,8 @@ static void print_rsync_version(enum log
+@@ -264,8 +268,8 @@ static void print_rsync_version(enum logcode f)
                (int)(sizeof (int64) * 8));
        rprintf(f, "    %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
                got_socketpair, hardlinks, links, ipv6, have_inplace);
@@ -171,9 +177,10 @@ and we can't honor that request.
  
  #ifdef MAINTAINER_MODE
        rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
---- old/rsync.h
-+++ new/rsync.h
-@@ -183,6 +183,10 @@
+diff --git a/rsync.h b/rsync.h
+--- a/rsync.h
++++ b/rsync.h
+@@ -186,6 +186,10 @@
  #define SIGNIFICANT_ITEM_FLAGS (~(\
        ITEM_BASIS_TYPE_FOLLOWS | ITEM_XNAME_FOLLOWS | ITEM_LOCAL_CHANGE))
  
@@ -184,9 +191,10 @@ and we can't honor that request.
  #define CFN_KEEP_LEADING_DOT_DIR (1<<0)
  #define CFN_KEEP_TRAILING_SLASH (1<<1)
  #define CFN_DROP_TRAILING_DOT_DIR (1<<2)
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -144,7 +144,12 @@ particular rsync daemon by leaving off t
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -144,7 +144,12 @@ particular rsync daemon by leaving off the module name:
  
  quote(tt(rsync somehost.mydomain.com::))
  
@@ -200,15 +208,18 @@ and we can't honor that request.
  
  manpagesection(ADVANCED USAGE)
  
---- old/rsyncd.conf
-+++ new/rsyncd.conf
+diff --git a/rsyncd.conf b/rsyncd.conf
+new file mode 100644
+--- /dev/null
++++ b/rsyncd.conf
 @@ -0,0 +1,3 @@
 +
 +slp refresh = 300
 +
---- old/rsyncd.conf.yo
-+++ new/rsyncd.conf.yo
-@@ -104,6 +104,15 @@ details on some of the options you may b
+diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
+--- a/rsyncd.conf.yo
++++ b/rsyncd.conf.yo
+@@ -104,6 +104,15 @@ details on some of the options you may be able to set. By default no
  special socket options are set.  These settings are superseded by the
  bf(--sockopts) command-line option.
  
@@ -224,7 +235,7 @@ and we can't honor that request.
  enddit()
  
  
-@@ -566,6 +575,7 @@ use chroot = no
+@@ -603,6 +612,7 @@ use chroot = no
  max connections = 4
  syslog facility = local5
  pid file = /var/run/rsyncd.pid
@@ -232,9 +243,10 @@ and we can't honor that request.
  
  [ftp]
          path = /var/ftp/pub
---- old/socket.c
-+++ new/socket.c
-@@ -502,6 +502,16 @@ void start_accept_loop(int port, int (*f
+diff --git a/socket.c b/socket.c
+--- a/socket.c
++++ b/socket.c
+@@ -524,6 +524,16 @@ void start_accept_loop(int port, int (*fn)(int, int))
  {
        fd_set deffds;
        int *sp, maxfd, i;
@@ -251,7 +263,7 @@ and we can't honor that request.
  
  #ifdef HAVE_SIGACTION
        sigact.sa_flags = SA_NOCLDSTOP;
-@@ -530,14 +540,25 @@ void start_accept_loop(int port, int (*f
+@@ -552,14 +562,25 @@ void start_accept_loop(int port, int (*fn)(int, int))
                        maxfd = sp[i];
        }
  
@@ -277,7 +289,7 @@ and we can't honor that request.
  
                /* close log file before the potentially very long select so
                 * file can be trimmed by another process instead of growing
-@@ -549,8 +570,18 @@ void start_accept_loop(int port, int (*f
+@@ -571,8 +592,18 @@ void start_accept_loop(int port, int (*fn)(int, int))
  #else
                fds = deffds;
  #endif
@@ -298,8 +310,10 @@ and we can't honor that request.
                        continue;
  
                for (i = 0, fd = -1; sp[i] >= 0; i++) {
---- old/srvloc.c
-+++ new/srvloc.c
+diff --git a/srvloc.c b/srvloc.c
+new file mode 100644
+--- /dev/null
++++ b/srvloc.c
 @@ -0,0 +1,103 @@
 +/* -*- c-file-style: "linux"; -*-
 +
@@ -404,8 +418,10 @@ and we can't honor that request.
 +
 +      return 0;
 +}
---- old/srvreg.c
-+++ new/srvreg.c
+diff --git a/srvreg.c b/srvreg.c
+new file mode 100644
+--- /dev/null
++++ b/srvreg.c
 @@ -0,0 +1,128 @@
 +/* -*- c-file-style: "linux"; -*-
 +
index d8f9d1d..afc62d9 100644 (file)
@@ -10,9 +10,10 @@ To use this patch, run these commands for a successful build:
     ./configure                           (optional if already run)
     make
 
---- old/syscall.c
-+++ new/syscall.c
-@@ -59,9 +59,14 @@ int do_symlink(const char *fname1, const
+diff --git a/syscall.c b/syscall.c
+--- a/syscall.c
++++ b/syscall.c
+@@ -62,9 +62,14 @@ int do_symlink(const char *fname1, const char *fname2)
  #ifdef HAVE_LINK
  int do_link(const char *fname1, const char *fname2)
  {
index 0080839..82ab782 100644 (file)
@@ -9,9 +9,10 @@ To use this patch, run these commands for a successful build:
 
 -- Matt McCutchen <hashproduct@gmail.com>
 
---- old/options.c
-+++ new/options.c
-@@ -29,6 +29,7 @@ extern struct filter_list_struct filter_
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -31,6 +31,7 @@ extern struct filter_list_struct filter_list;
  extern struct filter_list_struct server_filter_list;
  
  int make_backups = 0;
@@ -19,7 +20,7 @@ To use this patch, run these commands for a successful build:
  
  /**
   * If 1, send the whole file as literal data rather than trying to
-@@ -352,6 +353,7 @@ void usage(enum logcode F)
+@@ -361,6 +362,7 @@ void usage(enum logcode F)
    rprintf(F,"     --existing              skip creating new files on receiver\n");
    rprintf(F,"     --ignore-existing       skip updating files that already exist on receiver\n");
    rprintf(F,"     --remove-source-files   sender removes synchronized files (non-dirs)\n");
@@ -27,7 +28,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F,"     --del                   an alias for --delete-during\n");
    rprintf(F,"     --delete                delete extraneous files from destination dirs\n");
    rprintf(F,"     --delete-before         receiver deletes before transfer, not during\n");
-@@ -573,6 +575,7 @@ static struct poptOption long_options[] 
+@@ -588,6 +590,7 @@ static struct poptOption long_options[] = {
    {"bwlimit",          0,  POPT_ARG_INT,    &bwlimit, 0, 0, 0 },
    {"no-bwlimit",       0,  POPT_ARG_VAL,    &bwlimit, 0, 0, 0 },
    {"backup",          'b', POPT_ARG_VAL,    &make_backups, 1, 0, 0 },
@@ -35,7 +36,7 @@ To use this patch, run these commands for a successful build:
    {"no-backup",        0,  POPT_ARG_VAL,    &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 },
-@@ -1848,6 +1851,8 @@ void server_options(char **args,int *arg
+@@ -1894,6 +1897,8 @@ void server_options(char **args, int *argc_p)
                                goto oom;
                        args[ac++] = arg;
                }
@@ -44,9 +45,10 @@ To use this patch, run these commands for a successful build:
        }
  
        if (modify_window_set) {
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -350,6 +350,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -361,6 +361,7 @@ to the detailed description below for a complete description.  verb(
       --existing              skip creating new files on receiver
       --ignore-existing       skip updating files that exist on receiver
       --remove-source-files   sender removes synchronized files (non-dir)
@@ -54,7 +56,7 @@ To use this patch, run these commands for a successful build:
       --del                   an alias for --delete-during
       --delete                delete extraneous files from dest dirs
       --delete-before         receiver deletes before transfer (default)
-@@ -1012,6 +1013,14 @@ dit(bf(--remove-source-files)) This tell
+@@ -1085,6 +1086,14 @@ dit(bf(--remove-source-files)) This tells rsync to remove from the sending
  side the files (meaning non-directories) that are a part of the transfer
  and have been successfully duplicated on the receiving side.
  
@@ -69,8 +71,9 @@ To use this patch, run these commands for a successful build:
  dit(bf(--delete)) This tells rsync to delete extraneous files from the
  receiving side (ones that aren't on the sending side), but only for the
  directories that are being synchronized.  You must have asked rsync to
---- old/sender.c
-+++ new/sender.c
+diff --git a/sender.c b/sender.c
+--- a/sender.c
++++ b/sender.c
 @@ -39,6 +39,7 @@ extern int protocol_version;
  extern int remove_source_files;
  extern int updating_basis_file;
index 4663fbe..41aed86 100644 (file)
@@ -30,8 +30,9 @@ To use this patch, run these commands for a successful build:
     ./configure                                (optional if already run)
     make
 
---- old/generator.c
-+++ new/generator.c
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
 @@ -61,6 +61,7 @@ extern int append_mode;
  extern int make_backups;
  extern int csum_length;
@@ -40,7 +41,7 @@ To use this patch, run these commands for a successful build:
  extern int size_only;
  extern OFF_T max_size;
  extern OFF_T min_size;
-@@ -624,7 +625,7 @@ void itemize(const char *fnamecmp, struc
+@@ -630,7 +631,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
  /* Perform our quick-check heuristic for determining if a file is unchanged. */
  int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
  {
@@ -49,9 +50,10 @@ To use this patch, run these commands for a successful build:
                return 0;
  
        /* if always checksum is set then we use the checksum instead
---- old/main.c
-+++ new/main.c
-@@ -134,7 +134,7 @@ pid_t wait_process(pid_t pid, int *statu
+diff --git a/main.c b/main.c
+--- a/main.c
++++ b/main.c
+@@ -135,7 +135,7 @@ pid_t wait_process(pid_t pid, int *status_ptr, int flags)
  }
  
  /* Wait for a process to exit, calling io_flush while waiting. */
@@ -60,9 +62,10 @@ To use this patch, run these commands for a successful build:
  {
        pid_t waited_pid;
        int status;
---- old/options.c
-+++ new/options.c
-@@ -103,6 +103,7 @@ int keep_partial = 0;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -104,6 +104,7 @@ int keep_partial = 0;
  int safe_symlinks = 0;
  int copy_unsafe_links = 0;
  int size_only = 0;
@@ -70,7 +73,7 @@ To use this patch, run these commands for a successful build:
  int daemon_bwlimit = 0;
  int bwlimit = 0;
  int fuzzy_basis = 0;
-@@ -160,6 +161,8 @@ char *logfile_name = NULL;
+@@ -161,6 +162,8 @@ char *logfile_name = NULL;
  char *logfile_format = NULL;
  char *stdout_format = NULL;
  char *password_file = NULL;
@@ -79,15 +82,15 @@ To use this patch, run these commands for a successful build:
  char *rsync_path = RSYNC_PATH;
  char *backup_dir = NULL;
  char backup_dir_buf[MAXPATHLEN];
-@@ -380,6 +383,7 @@ void usage(enum logcode F)
-   rprintf(F,"     --timeout=TIME          set I/O timeout in seconds\n");
+@@ -382,6 +385,7 @@ void usage(enum logcode F)
+   rprintf(F,"     --contimeout=SECONDS    set daemon connection 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,"     --times-only            skip files that match in mod-time\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");
-@@ -419,6 +423,8 @@ void usage(enum logcode F)
+@@ -421,6 +425,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");
@@ -95,8 +98,8 @@ To use this patch, run these commands for a successful build:
 +  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 ICONV_OPTION
-   rprintf(F,"     --iconv=CONVERT_SPEC    request charset conversion of filesnames\n");
-@@ -520,6 +526,7 @@ static struct poptOption long_options[] 
+   rprintf(F,"     --iconv=CONVERT_SPEC    request charset conversion of filenames\n");
+@@ -522,6 +528,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 },
@@ -104,7 +107,7 @@ To use this patch, run these commands for a successful build:
    {"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 },
-@@ -619,6 +626,8 @@ static struct poptOption long_options[] 
+@@ -622,6 +629,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 },
@@ -113,7 +116,7 @@ To use this patch, run these commands for a successful build:
    {"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 },
-@@ -1576,6 +1585,16 @@ int parse_arguments(int *argc_p, const c
+@@ -1579,6 +1588,16 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                }
        }
  
@@ -130,7 +133,7 @@ To use this patch, run these commands for a successful build:
        if (files_from) {
                char *h, *p;
                int q;
-@@ -1893,6 +1912,25 @@ void server_options(char **args, int *ar
+@@ -1896,6 +1915,25 @@ void server_options(char **args, int *argc_p)
                }
        }
  
@@ -156,9 +159,10 @@ To use this patch, run these commands for a successful build:
        if (modify_window_set) {
                if (asprintf(&arg, "--modify-window=%d", modify_window) < 0)
                        goto oom;
---- old/pipe.c
-+++ new/pipe.c
-@@ -167,3 +167,77 @@ pid_t local_child(int argc, char **argv,
+diff --git a/pipe.c b/pipe.c
+--- a/pipe.c
++++ b/pipe.c
+@@ -167,3 +167,77 @@ pid_t local_child(int argc, char **argv, int *f_in, int *f_out,
  
        return pid;
  }
@@ -236,8 +240,9 @@ To use this patch, run these commands for a successful build:
 +
 +      return pid;
 +}
---- old/receiver.c
-+++ new/receiver.c
+diff --git a/receiver.c b/receiver.c
+--- a/receiver.c
++++ b/receiver.c
 @@ -52,6 +52,7 @@ extern int delay_updates;
  extern mode_t orig_umask;
  extern struct stats stats;
@@ -246,7 +251,7 @@ To use this patch, run these commands for a successful build:
  extern char *partial_dir;
  extern char *basis_dir[];
  extern struct file_list *cur_flist, *first_flist, *dir_flist;
-@@ -394,6 +395,8 @@ int recv_files(int f_in, char *local_nam
+@@ -394,6 +395,8 @@ int recv_files(int f_in, char *local_name)
        const char *parent_dirname = "";
  #endif
        int ndx, recv_ok;
@@ -255,7 +260,7 @@ To use this patch, run these commands for a successful build:
  
        if (verbose > 2)
                rprintf(FINFO, "recv_files(%d) starting\n", cur_flist->used);
-@@ -401,6 +404,23 @@ int recv_files(int f_in, char *local_nam
+@@ -401,6 +404,23 @@ int recv_files(int f_in, char *local_name)
        if (delay_updates)
                delayed_bits = bitbag_create(cur_flist->used + 1);
  
@@ -279,7 +284,7 @@ To use this patch, run these commands for a successful build:
        while (1) {
                cleanup_disable();
  
-@@ -665,6 +685,9 @@ int recv_files(int f_in, char *local_nam
+@@ -671,6 +691,9 @@ int recv_files(int f_in, char *local_name)
                else if (!am_server && verbose && do_progress)
                        rprintf(FINFO, "%s\n", fname);
  
@@ -289,7 +294,7 @@ To use this patch, run these commands for a successful build:
                /* recv file data */
                recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
                                       fname, fd2, F_LENGTH(file));
-@@ -679,6 +702,16 @@ int recv_files(int f_in, char *local_nam
+@@ -685,6 +708,16 @@ int recv_files(int f_in, char *local_name)
                        exit_cleanup(RERR_FILEIO);
                }
  
@@ -306,9 +311,10 @@ To use this patch, run these commands for a successful build:
                if ((recv_ok && (!delay_updates || !partialptr)) || inplace) {
                        char *temp_copy_name;
                        if (partialptr == fname)
---- old/rsync.h
-+++ new/rsync.h
-@@ -129,6 +129,7 @@
+diff --git a/rsync.h b/rsync.h
+--- a/rsync.h
++++ b/rsync.h
+@@ -132,6 +132,7 @@
  #define IOERR_DEL_LIMIT (1<<2)
  
  #define MAX_ARGS 1000
@@ -316,26 +322,27 @@ To use this patch, run these commands for a successful build:
  #define MAX_BASIS_DIRS 20
  #define MAX_SERVER_ARGS (MAX_BASIS_DIRS*2 + 100)
  
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -381,6 +381,7 @@ to the detailed description below for a 
-      --timeout=TIME          set I/O timeout in seconds
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -382,6 +382,7 @@ to the detailed description below for a complete description.  verb(
+      --contimeout=SECONDS    set daemon connection timeout in seconds
   -I, --ignore-times          don't skip files that match size and time
       --size-only             skip files that match in size
 +     --times-only            skip files that match in mod-time
       --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
-@@ -420,6 +421,8 @@ to the detailed description below for a 
+@@ -421,6 +422,8 @@ to the detailed description below for a complete description.  verb(
       --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
+      --iconv=CONVERT_SPEC    request charset conversion of filenames
       --checksum-seed=NUM     set block/file checksum seed (advanced)
-@@ -1986,6 +1989,33 @@ file previously generated by bf(--write-
+@@ -2003,6 +2006,33 @@ file previously generated by bf(--write-batch).
  If em(FILE) is bf(-), the batch data will be read from standard input.
  See the "BATCH MODE" section for details.
  
@@ -369,8 +376,9 @@ To use this patch, run these commands for a successful build:
  dit(bf(--protocol=NUM)) Force an older protocol version to be used.  This
  is useful for creating a batch file that is compatible with an older
  version of rsync.  For instance, if rsync 2.6.4 is being used with the
---- old/sender.c
-+++ new/sender.c
+diff --git a/sender.c b/sender.c
+--- a/sender.c
++++ b/sender.c
 @@ -43,6 +43,7 @@ extern int do_progress;
  extern int inplace;
  extern int batch_fd;
index 81c1e2d..aefee12 100644 (file)
@@ -9,8 +9,9 @@ To use this patch, run these commands for a successful build:
     ./configure                              (optional if already run)
     make
 
---- old/io.c
-+++ new/io.c
+diff --git a/io.c b/io.c
+--- a/io.c
++++ b/io.c
 @@ -53,6 +53,7 @@ extern int protocol_version;
  extern int remove_source_files;
  extern int preserve_hard_links;
@@ -19,7 +20,7 @@ To use this patch, run these commands for a successful build:
  extern struct file_list *cur_flist;
  #ifdef ICONV_OPTION
  extern int filesfrom_convert;
-@@ -215,16 +216,24 @@ static void check_timeout(void)
+@@ -216,16 +217,24 @@ static void check_timeout(void)
  {
        time_t t;
  
@@ -47,9 +48,10 @@ To use this patch, run these commands for a successful build:
        if (t - last_io_in >= io_timeout) {
                if (!am_server && !am_daemon) {
                        rprintf(FERROR, "io timeout after %d seconds -- exiting\n",
---- old/options.c
-+++ new/options.c
-@@ -110,6 +110,7 @@ size_t bwlimit_writemax = 0;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -111,6 +111,7 @@ size_t bwlimit_writemax = 0;
  int ignore_existing = 0;
  int ignore_non_existing = 0;
  int need_messages_from_generator = 0;
@@ -57,7 +59,7 @@ To use this patch, run these commands for a successful build:
  int max_delete = INT_MIN;
  OFF_T max_size = 0;
  OFF_T min_size = 0;
-@@ -416,6 +417,8 @@ void usage(enum logcode F)
+@@ -418,6 +419,8 @@ 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");
@@ -66,7 +68,7 @@ To use this patch, run these commands for a successful build:
    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");
-@@ -438,7 +441,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -440,7 +443,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
        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,
@@ -75,16 +77,16 @@ To use this patch, run these commands for a successful build:
        OPT_SERVER, OPT_REFUSED_BASE = 9000};
  
  static struct poptOption long_options[] = {
-@@ -603,6 +606,8 @@ static struct poptOption long_options[] 
-   {"no-numeric-ids",   0,  POPT_ARG_VAL,    &numeric_ids, 0, 0, 0 },
+@@ -606,6 +609,8 @@ static struct poptOption long_options[] = {
    {"timeout",          0,  POPT_ARG_INT,    &io_timeout, 0, 0, 0 },
    {"no-timeout",       0,  POPT_ARG_VAL,    &io_timeout, 0, 0, 0 },
+   {"contimeout",       0,  POPT_ARG_INT,    &connect_timeout, 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 },
    {"rsh",             'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
    {"rsync-path",       0,  POPT_ARG_STRING, &rsync_path, 0, 0, 0 },
    {"temp-dir",        'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
-@@ -1221,6 +1226,36 @@ int parse_arguments(int *argc_p, const c
+@@ -1224,6 +1229,36 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                        return 0;
  #endif
  
@@ -121,7 +123,7 @@ To use this patch, run these commands for a successful build:
                default:
                        /* A large opt value means that set_refuse_options()
                         * turned this option off. */
-@@ -1841,6 +1876,15 @@ void server_options(char **args, int *ar
+@@ -1840,6 +1875,15 @@ void server_options(char **args, int *argc_p)
                args[ac++] = arg;
        }
  
@@ -137,9 +139,10 @@ To use this patch, run these commands for a successful build:
        if (backup_dir) {
                args[ac++] = "--backup-dir";
                args[ac++] = backup_dir;
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -422,6 +422,8 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -418,6 +418,8 @@ to the detailed description below for a complete description.  verb(
       --password-file=FILE    read daemon-access password from FILE
       --list-only             list the files instead of copying them
       --bwlimit=KBPS          limit I/O bandwidth; KBytes per second
@@ -148,7 +151,7 @@ To use this patch, run these commands for a successful build:
       --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
-@@ -1933,6 +1935,19 @@ transfer was too fast, it will wait befo
+@@ -1977,6 +1979,19 @@ transfer was too fast, it will wait before sending the next data block. The
  result is an average transfer rate equaling the specified limit. A value
  of zero specifies no limit.
  
@@ -168,9 +171,10 @@ To use this patch, run these commands for a successful build:
  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.
---- old/util.c
-+++ new/util.c
-@@ -122,6 +122,133 @@ NORETURN void overflow_exit(const char *
+diff --git a/util.c b/util.c
+--- a/util.c
++++ b/util.c
+@@ -122,6 +122,133 @@ NORETURN void overflow_exit(const char *str)
        exit_cleanup(RERR_MALLOC);
  }
  
index 89043c7..993b641 100644 (file)
@@ -13,9 +13,10 @@ To use this patch, run these commands for a successful build:
     ./configure                                 (optional if already run)
     make
 
---- old/flist.c
-+++ new/flist.c
-@@ -80,6 +80,9 @@ extern int filesfrom_convert;
+diff --git a/flist.c b/flist.c
+--- a/flist.c
++++ b/flist.c
+@@ -81,6 +81,9 @@ extern int filesfrom_convert;
  extern iconv_t ic_send, ic_recv;
  #endif
  
@@ -25,7 +26,7 @@ To use this patch, run these commands for a successful build:
  #define PTR_SIZE (sizeof (struct file_struct *))
  
  int io_error;
-@@ -600,6 +603,24 @@ static void send_file_entry(int f, struc
+@@ -606,6 +609,24 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_
                stats.total_size += F_LENGTH(file);
  }
  
@@ -50,7 +51,7 @@ To use this patch, run these commands for a successful build:
  static struct file_struct *recv_file_entry(struct file_list *flist,
                                           int xflags, int f)
  {
-@@ -668,6 +689,9 @@ static struct file_struct *recv_file_ent
+@@ -674,6 +695,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
        }
  #endif
  
@@ -60,9 +61,10 @@ To use this patch, run these commands for a successful build:
        clean_fname(thisname, 0);
  
        if (sanitize_paths)
---- old/options.c
-+++ new/options.c
-@@ -181,6 +181,8 @@ int logfile_format_has_i = 0;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -182,6 +182,8 @@ int logfile_format_has_i = 0;
  int logfile_format_has_o_or_i = 0;
  int always_checksum = 0;
  int list_only = 0;
@@ -71,7 +73,7 @@ To use this patch, run these commands for a successful build:
  
  #define MAX_BATCH_NAME_LEN 256        /* Must be less than MAXPATHLEN-13 */
  char *batch_name = NULL;
-@@ -423,6 +425,7 @@ void usage(enum logcode F)
+@@ -425,6 +427,7 @@ void usage(enum logcode F)
  #ifdef ICONV_OPTION
    rprintf(F,"     --iconv=CONVERT_SPEC    request charset conversion of filenames\n");
  #endif
@@ -79,7 +81,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F," -4, --ipv4                  prefer IPv4\n");
    rprintf(F," -6, --ipv6                  prefer IPv6\n");
    rprintf(F,"     --version               print version number\n");
-@@ -609,6 +612,7 @@ static struct poptOption long_options[] 
+@@ -612,6 +615,7 @@ static struct poptOption long_options[] = {
  #ifdef ICONV_OPTION
    {"iconv",            0,  POPT_ARG_STRING, &iconv_opt, 0, 0, 0 },
  #endif
@@ -87,7 +89,7 @@ To use this patch, run these commands for a successful build:
    {"ipv4",            '4', POPT_ARG_VAL,    &default_af_hint, AF_INET, 0, 0 },
    {"ipv6",            '6', POPT_ARG_VAL,    &default_af_hint, AF_INET6, 0, 0 },
    {"8-bit-output",    '8', POPT_ARG_NONE,   &allow_8bit_chars, 0, 0, 0 },
-@@ -1620,6 +1624,31 @@ int parse_arguments(int *argc_p, const c
+@@ -1623,6 +1627,31 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
                }
        }
  
@@ -119,7 +121,7 @@ To use this patch, run these commands for a successful build:
        am_starting_up = 0;
  
        return 1;
-@@ -1988,6 +2017,12 @@ void server_options(char **args, int *ar
+@@ -1991,6 +2020,12 @@ void server_options(char **args, int *argc_p)
        else if (remove_source_files)
                args[ac++] = "--remove-sent-files";
  
@@ -132,9 +134,10 @@ To use this patch, run these commands for a successful build:
        *argc_p = ac;
        return;
  
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -422,6 +422,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -423,6 +423,7 @@ to the detailed description below for a complete description.  verb(
       --read-batch=FILE       read a batched update from FILE
       --protocol=NUM          force an older protocol version to be used
       --iconv=CONVERT_SPEC    request charset conversion of filenames
@@ -142,7 +145,7 @@ To use this patch, run these commands for a successful build:
       --checksum-seed=NUM     set block/file checksum seed (advanced)
   -4, --ipv4                  prefer IPv4
   -6, --ipv6                  prefer IPv6
-@@ -2013,6 +2014,22 @@ specifying matching rules that can match
+@@ -2030,6 +2031,22 @@ specifying matching rules that can match on both sides of the transfer.
  For instance, you can specify extra include/exclude rules if there are
  filename differences on the two sides that need to be accounted for.
  
index 7a1455e..431cc6f 100644 (file)
@@ -6,8 +6,9 @@ To use this patch, run these commands for a successful build:
     ./configure                          (optional if already run)
     make
 
---- old/syscall.c
-+++ new/syscall.c
+diff --git a/syscall.c b/syscall.c
+--- a/syscall.c
++++ b/syscall.c
 @@ -23,6 +23,7 @@
  #include "rsync.h"
  
index 515ff48..e40f981 100644 (file)
@@ -7,9 +7,10 @@ To use this patch, run these commands for a successful build:
     ./configure                         (optional if already run)
     make
 
---- old/flist.c
-+++ new/flist.c
-@@ -67,6 +67,7 @@ extern int need_unsorted_flist;
+diff --git a/flist.c b/flist.c
+--- a/flist.c
++++ b/flist.c
+@@ -68,6 +68,7 @@ extern int need_unsorted_flist;
  extern int unsort_ndx;
  extern struct stats stats;
  extern char *filesfrom_host;
@@ -17,7 +18,7 @@ To use this patch, run these commands for a successful build:
  
  extern char curr_dir[MAXPATHLEN];
  
-@@ -747,7 +748,7 @@ static struct file_struct *recv_file_ent
+@@ -753,7 +754,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
                        uid = (uid_t)read_varint(f);
                        if (xflags & XMIT_USER_NAME_FOLLOWS)
                                uid = recv_user_name(f, uid);
@@ -26,7 +27,7 @@ To use this patch, run these commands for a successful build:
                                uid = match_uid(uid);
                }
        }
-@@ -759,7 +760,7 @@ static struct file_struct *recv_file_ent
+@@ -765,7 +766,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
                        gid_flags = 0;
                        if (xflags & XMIT_GROUP_NAME_FOLLOWS)
                                gid = recv_group_name(f, gid, &gid_flags);
@@ -35,7 +36,7 @@ To use this patch, run these commands for a successful build:
                                gid = match_gid(gid, &gid_flags);
                }
        }
-@@ -2076,8 +2077,13 @@ struct file_list *recv_file_list(int f)
+@@ -2090,8 +2091,13 @@ struct file_list *recv_file_list(int f)
        int dstart, flags;
        int64 start_read;
  
@@ -50,9 +51,10 @@ To use this patch, run these commands for a successful build:
        if (show_filelist_p())
                start_filelist_progress("receiving file list");
        else if (inc_recurse && verbose && !am_server && !first_flist)
---- old/options.c
-+++ new/options.c
-@@ -164,6 +164,8 @@ char *rsync_path = RSYNC_PATH;
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -165,6 +165,8 @@ char *rsync_path = RSYNC_PATH;
  char *backup_dir = NULL;
  char backup_dir_buf[MAXPATHLEN];
  char *sockopts = NULL;
@@ -61,16 +63,16 @@ To use this patch, run these commands for a successful build:
  int rsync_port = 0;
  int compare_dest = 0;
  int copy_dest = 0;
-@@ -377,6 +379,8 @@ void usage(enum logcode F)
+@@ -378,6 +380,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,"     --usermap=STRING        custom username mapping\n");
 +  rprintf(F,"     --groupmap=STRING       custom groupname mapping\n");
-   rprintf(F,"     --timeout=TIME          set I/O timeout in seconds\n");
+   rprintf(F,"     --timeout=SECONDS       set I/O timeout in seconds\n");
+   rprintf(F,"     --contimeout=SECONDS    set daemon connection 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");
-@@ -601,6 +605,8 @@ static struct poptOption long_options[] 
+@@ -603,6 +607,8 @@ static struct poptOption long_options[] = {
    {"no-s",             0,  POPT_ARG_VAL,    &protect_args, 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 },
@@ -78,8 +80,8 @@ To use this patch, run these commands for a successful build:
 +  {"groupmap",         0,  POPT_ARG_STRING, &groupmap, 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 },
-@@ -1931,6 +1937,18 @@ void server_options(char **args, int *ar
+   {"contimeout",       0,  POPT_ARG_INT,    &connect_timeout, 0, 0, 0 },
+@@ -1934,6 +1940,18 @@ void server_options(char **args, int *argc_p)
                args[ac++] = "--use-qsort";
  
        if (am_sender) {
@@ -98,18 +100,19 @@ To use this patch, run these commands for a successful build:
                if (ignore_existing)
                        args[ac++] = "--ignore-existing";
  
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -378,6 +378,8 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -378,6 +378,8 @@ to the detailed description below for a complete description.  verb(
       --delay-updates         put all updated files into place at end
   -m, --prune-empty-dirs      prune empty directory chains from file-list
       --numeric-ids           don't map uid/gid values by user/group name
 +     --usermap=STRING        custom username mapping
 +     --groupmap=STRING       custom groupname mapping
-      --timeout=TIME          set I/O timeout in seconds
+      --timeout=SECONDS       set I/O timeout in seconds
+      --contimeout=SECONDS    set daemon connection timeout in seconds
   -I, --ignore-times          don't skip files that match size and time
-      --size-only             skip files that match in size
-@@ -1566,6 +1568,46 @@ from the source system is used instead. 
+@@ -1579,6 +1581,46 @@ from the source system is used instead.  See also the comments on the
  the chroot setting affects rsync's ability to look up the names of the
  users and groups and what you can do about it.
  
@@ -156,8 +159,9 @@ To use this patch, run these commands for a successful build:
  dit(bf(--timeout=TIMEOUT)) This option allows you to set a maximum I/O
  timeout in seconds. If no data is transferred for the specified time
  then rsync will exit. The default is 0, which means no timeout.
---- old/uidlist.c
-+++ new/uidlist.c
+diff --git a/uidlist.c b/uidlist.c
+--- a/uidlist.c
++++ b/uidlist.c
 @@ -24,6 +24,7 @@
   * are special. */
  
@@ -289,7 +293,7 @@ To use this patch, run these commands for a successful build:
        }
  
        return node;
-@@ -195,12 +200,9 @@ static struct idlist *recv_add_gid(gid_t
+@@ -195,12 +200,9 @@ static struct idlist *recv_add_gid(gid_t id, char *name)
  /* this function is a definate candidate for a faster algorithm */
  uid_t match_uid(uid_t uid)
  {
@@ -319,7 +323,7 @@ To use this patch, run these commands for a successful build:
  }
  
  gid_t match_gid(gid_t gid, uint16 *flags_ptr)
-@@ -227,7 +232,7 @@ gid_t match_gid(gid_t gid, uint16 *flags
+@@ -227,7 +232,7 @@ gid_t match_gid(gid_t gid, uint16 *flags_ptr)
                                break;
                }
                if (!list)
@@ -337,7 +341,7 @@ To use this patch, run these commands for a successful build:
        return node->id2;
  }
  
-@@ -328,7 +333,7 @@ gid_t recv_group_name(int f, gid_t gid, 
+@@ -328,7 +333,7 @@ gid_t recv_group_name(int f, gid_t gid, uint16 *flags_ptr)
        if (!name)
                out_of_memory("recv_group_name");
        read_sbuf(f, name, len);
@@ -346,7 +350,7 @@ To use this patch, run these commands for a successful build:
        if (flags_ptr && node->flags & FLAG_SKIP_GROUP)
                *flags_ptr |= FLAG_SKIP_GROUP;
        return node->id2;
-@@ -355,17 +360,96 @@ void recv_id_list(int f, struct file_lis
+@@ -355,17 +360,96 @@ void recv_id_list(int f, struct file_list *flist)
  
        /* Now convert all the uids/gids from sender values to our values. */
  #ifdef SUPPORT_ACLS
diff --git a/verify-patches b/verify-patches
deleted file mode 100755 (executable)
index d6d7c3a..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use Getopt::Long;
-use Cwd;
-
-my @generated_files = qw( proto.h configure config.h.in rsync.1 rsyncd.conf.5 );
-
-my($no_cvs, $failures_only, $minor_updates, $prepare_source);
-my @auto_cmds;
-
-&Getopt::Long::Configure('bundling');
-GetOptions(
-    'no-cvs|n' => \$no_cvs,
-    'failures-only|f' => \$failures_only,
-    'minor-updates|u' => \$minor_updates,
-    'prepare-source|p' => \$prepare_source,
-    'auto-cmd|a=s' => sub { push(@auto_cmds, $_[1]) },
-) or &usage;
-
-$" = '|';
-my $auto_regex = @auto_cmds ? qr/^(@auto_cmds)$/i : qr/^never$/;
-my $interesting_fuzz = $minor_updates ? '\d' : '[2-9]';
-$" = ' ';
-
-chdir('patches') if -d 'patches';
-
-if (!-f 'verify-patches') {
-    die <<EOT;
-Please run this script from the root of the rsync dir or
-from inside the patches subdir.
-EOT
-}
-
-my $patches_dir = Cwd::cwd();
-
-$ENV{'LC_COLLATE'} = 'C';
-$| = 1;
-my $CONF_OPTS = '--cache-file=../config.cache';
-
-my($has_dependencies, @new, @rejects);
-
-END {
-    &restore_cvsdir;
-    system "rsync -a --del cvsdir/ workdir/" if -d 'cvsdir';
-    my $pid = readlink('lock') || 0;
-    unlink('lock') if $pid == $$;
-};
-
-my $root;
-open(IN, '../CVS/Root') or die $!;
-chomp($root = <IN>);
-close IN;
-
-mkdir('tmp', 0777) unless -d 'tmp';
-chdir('tmp') or die "Unable to chdir to 'tmp'";
-unlink('patches');
-symlink($patches_dir, 'patches');
-
-symlink($$, 'lock') or die "Unable to create lock file: $!\n";
-
-mkdir('workdir') unless -d 'workdir';
-open(OUT, '>exclude') or die $!;
-print OUT join("\n", 'CVS', @generated_files), "\n";
-close OUT;
-
-unless ($no_cvs) {
-    print "Using CVS to update the tmp/cvsdir copy of the source.\n";
-    system qq|cvs -qd "$root" co -P -d cvsdir rsync|;
-    @_ = qw( configure configure.in config.h.in configure.in
-            rsync.1 rsync.yo rsyncd.conf.5 rsyncd.conf.yo );
-    while (@_) {
-       my $gen = 'cvsdir/' . shift(@_);
-       my $src = 'cvsdir/' . shift(@_);
-       if ((-M $gen) > (-M $src)) {
-           system "touch $gen";
-       }
-    }
-}
-
-@ARGV = glob('patches/*.diff') unless @ARGV;
-
-DIFF:
-foreach my $diff (@ARGV) {
-    next unless $diff =~ /\.diff$/;
-    next if $diff =~ /gzip-rsyncable[-_a-z]*\.diff$/;
-    $diff =~ s#^(patches|\.\.)/##;
-
-    my $conf_opts;
-    open(IN, "patches/$diff") or die $!;
-    while (<IN>) {
-       last if /^--- /;
-       if (m#^\s+patch -p1 <patches/(\S+.diff)# && $1 ne $diff) {
-           my $dep = $1;
-           $has_dependencies = 1;
-           print "\nApplying dependency patch $dep...\n";
-           if (system("patch -f -d cvsdir -p1 -b -Vt <patches/$dep") != 0) {
-               print "Unable to cleanly apply dependency patch -- skipping $diff\n";
-               system "rm -f cvsdir/*.rej cvsdir/*/*.rej";
-               &restore_cvsdir;
-               next DIFF;
-           }
-           sleep(1); # Ensure later diffs get later times.
-       }
-       if (!defined($conf_opts) && s#^\s+\./configure\s+##) {
-           chomp($conf_opts = $_);
-           $conf_opts =~ s/\s*\(.*?\)//;
-       }
-    }
-    close IN;
-    $conf_opts = '' unless defined $conf_opts;
-
-    my $default = apply_patch($diff);
-
-    if ($prepare_source) {
-       print "\nPreparing the source...\n";
-       chdir('workdir') or die $!;
-       system "./prepare-source";
-       chdir('..') or die $!;
-    }
-
-    if ($default =~ s/^D,// || $default eq 'N') {
-       my $def = generate_new_patch($diff);
-       $default = 'U,N' if $default eq 'N' && $def eq 'E';
-       $default = 'N' if !$minor_updates && $default eq 'U,N';
-    }
-
-    my $first_time = 1;
-    PROMPT:
-    while (1) {
-       print "\n----------- $diff ------------\n",
-           "\nFix rejects, Diff create, Edit both diffs, Update patch,\n",
-           "Apply patch again, !(CMD), Build rsync, Next, Quit: [$default] ";
-       my $ans = $default;
-       if ($first_time && $default =~ /$auto_regex/) {
-           print $default, "\n";
-       } else {
-           my $input = <STDIN>;
-           chomp $input;
-           if ($input =~ s/^(-a|--auto-cmd=?)\s*//) {
-               push(@auto_cmds, $input eq '' ? $default : $input);
-               $" = '|';
-               $auto_regex = qr/^(@auto_cmds)$/i;
-               $" = ' ';
-               next;
-           }
-           $ans = $input if $input ne '';
-       }
-       $first_time = 0;
-       while ($ans =~ s/^\s*(!|\w)((?<!!)[^;,]*|[^;]*)[;,]?//) {
-           my $cmd = "\U$1\E";
-           if ($cmd eq '!') {
-               $cmd = $2 || $ENV{'SHELL'};
-               chdir('workdir') or die $!;
-               system $cmd;
-               chdir('..') or die $!;
-               $default = 'D';
-               next;
-           }
-           if ($cmd eq 'A') {
-               $default = apply_patch($diff);
-               next;
-           }
-           if ($cmd eq 'B') {
-               chdir('workdir') or die $!;
-               my $cmd = "./prepare-source && ./configure $CONF_OPTS $conf_opts && make";
-               print "Running: $cmd\n";
-               system $cmd;
-               chdir('..') or die $!;
-               $default = '!make test';
-               next;
-           }
-           if ($cmd eq 'D') {
-               $default = generate_new_patch($diff);
-               next;
-           }
-           if ($cmd eq 'E') {
-               chdir('workdir') or die $!;
-               system "vim -d ../patches/$diff ../new.patch";
-               chdir('..') or die $!;
-               $default = 'U,A,D';
-               next;
-           }
-           if ($cmd eq 'F') {
-               chdir('workdir') or die $!;
-               system "vim @rejects";
-               chdir('..') or die $!;
-               $default = 'D,E';
-               next;
-           }
-           if ($cmd eq 'N') {
-               last PROMPT;
-           }
-           if ($cmd eq 'Q') {
-               exit;
-           }
-           if ($cmd eq 'U') {
-               system "cp -p new.patch patches/$diff";
-               print "\nUpdated $diff from new.patch\n";
-               $default = 'A';
-               next;
-           }
-       }
-    }
-
-    &restore_cvsdir;
-}
-
-exit;
-
-
-sub apply_patch
-{
-    my($diff) = @_;
-
-    undef @new;
-    system "rsync -a --del --exclude='*~' cvsdir/ workdir/";
-    print "\nApplying patch $diff...\n";
-    undef @rejects;
-    my($saw_offset, $saw_fuzz);
-    open(IN, "patch -f -d workdir -p1 --no-backup-if-mismatch <patches/$diff |") or die $!;
-    while (<IN>) {
-       print $_;
-       chomp;
-       if (s/^patching file //) {
-           push(@new, $_) unless -f "cvsdir/$_";
-       } elsif (s/.* saving rejects to file //) {
-           push(@rejects, $_);
-       } elsif (/No file to patch\.\s+Skipping patch/) {
-           push(@rejects, 'skipped.file');
-       } elsif (/^Hunk #\d+ succeeded at \d+( with fuzz $interesting_fuzz)?/o) {
-           $saw_fuzz ||= defined $1;
-           $saw_offset = 1;
-       }
-    }
-    close IN;
-    return 'F,D,E' if @rejects;
-    return 'D,E' if $saw_fuzz && !$failures_only;
-    return 'D,U,N' if $saw_offset && !$failures_only;
-    'N';
-}
-
-sub filter_diff
-{
-    my($cmd) = @_;
-    open(IN, '-|', $cmd) or die $!;
-    while (<IN>) {
-       next if /^(diff -|Index: |Only in )/;
-       s#^\Q--- cvsdir/\E([^\t]+).*#--- old/$1#;
-       s#^\Q+++ workdir/\E([^\t]+).*#+++ new/$1#;
-       print OUT $_;
-    }
-    close IN;
-}
-
-sub generate_new_patch
-{
-    my($diff) = @_;
-
-    foreach (@new) {
-       system "touch -r workdir/$_ cvsdir/$_";
-    }
-    open(IN, "patches/$diff") or die $!;
-    open(OUT, '>new.patch') or die $!;
-    while (<IN>) {
-       last if /^--- /;
-       print OUT $_;
-    }
-    close IN;
-    &filter_diff('diff --exclude-from=exclude -dupr cvsdir workdir');
-    if ($prepare_source) {
-       # These are not included in the diff above so that patch will give
-       # generated files a later timestamp than the source files.
-       foreach my $fn (@generated_files) {
-           &filter_diff("diff -dupW128 cvsdir/$fn workdir");
-       }
-    }
-    close OUT;
-    foreach (@new) {
-       unlink("cvsdir/$_");
-    }
-    print "\nDiffing... ";
-    if (system("diff patches/$diff new.patch >/dev/null") == 0) {
-       print "new patch is identical to old.\n";
-       return 'N';
-    }
-    print "New patch DIFFERS from old.\n";
-    'E';
-}
-
-sub restore_cvsdir
-{
-    return unless $has_dependencies;
-    $has_dependencies = 0;
-
-    chdir('cvsdir') or die $!;
-    foreach (glob('*.~[1-9]~'), glob('*/*.~[1-9]~')) {
-       my $fn;
-       ($fn = $_) =~ s/\.~1~$//;
-       if ($fn eq $_) {
-           unlink($_);
-       } elsif (-r $_) {
-           rename($_, $fn);
-       } else {
-           unlink($_);
-           unlink($fn);
-       }
-    }
-    chdir('..') or die $!;
-}
-
-sub usage
-{
-    die <<EOT;
-Usage: $0 [OPTS] [DIFF-FILE...]
- -a, --auto-cmd=REGEX  If default_cmd =~ /^(REGEX)\$/, enter it automatically
- -f, --failures-only   Suggest skipping patches that don't have failing hunks
- -n, --no-cvs          Don't update tmp/cvsdir at the start of the run
- -p, --prepare-source  Run ./prepare-source and include generated files in diff
- -u, --minor-updates   Suggest 'U' for even minor changes in the diff
-EOT
-}
index 16548fb..72807f0 100644 (file)
@@ -10,9 +10,10 @@ To use this patch, run these commands for a successful build:
     ./configure                         (optional if already run)
     make
 
---- old/compat.c
-+++ new/compat.c
-@@ -163,13 +163,6 @@ void setup_protocol(int f_out,int f_in)
+diff --git a/compat.c b/compat.c
+--- a/compat.c
++++ b/compat.c
+@@ -175,13 +175,6 @@ void setup_protocol(int f_out,int f_in)
        if (protocol_version < 30) {
                if (append_mode == 1)
                        append_mode = 2;
@@ -26,8 +27,9 @@ To use this patch, run these commands for a successful build:
        }
  
        if (delete_mode && !(delete_before+delete_during+delete_after)) {
---- old/xattrs.c
-+++ new/xattrs.c
+diff --git a/xattrs.c b/xattrs.c
+--- a/xattrs.c
++++ b/xattrs.c
 @@ -21,6 +21,7 @@
  
  #include "rsync.h"
@@ -44,7 +46,7 @@ To use this patch, run these commands for a successful build:
  
  #define RSYNC_XAL_INITIAL 5
  #define RSYNC_XAL_LIST_INITIAL 100
-@@ -233,7 +235,7 @@ static int rsync_xal_get(const char *fna
+@@ -241,7 +243,7 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
                if (!(ptr = get_xattr_data(fname, name, &datum_len, 0)))
                        return -1;
  
@@ -53,7 +55,7 @@ To use this patch, run these commands for a successful build:
                        /* For large datums, we store a flag and a checksum. */
                        name_offset = 1 + MAX_DIGEST_LEN;
                        sum_init(checksum_seed);
-@@ -297,7 +299,7 @@ static int find_matching_xattr(item_list
+@@ -305,7 +307,7 @@ static int find_matching_xattr(item_list *xalp)
                         || rxas1[j].datum_len != rxas2[j].datum_len
                         || strcmp(rxas1[j].name, rxas2[j].name))
                                break;
@@ -62,7 +64,7 @@ To use this patch, run these commands for a successful build:
                                if (memcmp(rxas1[j].datum + 1,
                                           rxas2[j].datum + 1,
                                           MAX_DIGEST_LEN) != 0)
-@@ -334,34 +336,43 @@ int send_xattr(statx *sxp, int f)
+@@ -342,34 +344,43 @@ int send_xattr(stat_x *sxp, int f)
  {
        int ndx = find_matching_xattr(sxp->xattr);
  
@@ -116,7 +118,7 @@ To use this patch, run these commands for a successful build:
                                write_buf(f, rxa->datum + 1, MAX_DIGEST_LEN);
                        else
                                write_buf(f, rxa->datum, rxa->datum_len);
-@@ -411,7 +422,7 @@ int xattr_diff(struct file_struct *file,
+@@ -419,7 +430,7 @@ int xattr_diff(struct file_struct *file, stat_x *sxp, int find_all)
                cmp = rec_cnt ? strcmp(snd_rxa->name, rec_rxa->name) : -1;
                if (cmp > 0)
                        same = 0;
@@ -125,7 +127,7 @@ To use this patch, run these commands for a successful build:
                        same = cmp == 0 && snd_rxa->datum_len == rec_rxa->datum_len
                            && memcmp(snd_rxa->datum + 1, rec_rxa->datum + 1,
                                      MAX_DIGEST_LEN) == 0;
-@@ -454,6 +465,9 @@ void send_xattr_request(const char *fnam
+@@ -462,6 +473,9 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out)
        int j, cnt, prior_req = -1;
        rsync_xa *rxa;
  
@@ -135,17 +137,17 @@ To use this patch, run these commands for a successful build:
        lst += F_XATTR(file);
        cnt = lst->count;
        for (rxa = lst->items, j = 0; j < cnt; rxa++, j++) {
-@@ -525,6 +539,9 @@ void recv_xattr_request(struct file_stru
+@@ -536,6 +550,9 @@ int recv_xattr_request(struct file_struct *file, int f_in)
        rsync_xa *rxa;
-       int rel_pos, cnt;
+       int rel_pos, cnt, got_xattr_data = 0;
  
 +      if (protocol_version < 30)
-+              return;
++              return 0;
 +
        if (F_XATTR(file) < 0) {
                rprintf(FERROR, "recv_xattr_request: internal data error!\n");
                exit_cleanup(RERR_STREAMIO);
-@@ -571,7 +588,22 @@ void receive_xattr(struct file_struct *f
+@@ -585,7 +602,22 @@ void receive_xattr(struct file_struct *file, int f)
  {
        static item_list temp_xattr = EMPTY_ITEM_LIST;
        int count;
@@ -169,7 +171,7 @@ To use this patch, run these commands for a successful build:
  
        if (ndx < 0 || (size_t)ndx > rsync_xal_l.count) {
                rprintf(FERROR, "receive_xattr: xa index %d out of"
-@@ -584,7 +616,7 @@ void receive_xattr(struct file_struct *f
+@@ -598,7 +630,7 @@ void receive_xattr(struct file_struct *file, int f)
                return;
        }
        
@@ -178,7 +180,7 @@ To use this patch, run these commands for a successful build:
                (void)EXPAND_ITEM_LIST(&temp_xattr, rsync_xa, count);
                temp_xattr.count = 0;
        }
-@@ -592,9 +624,10 @@ void receive_xattr(struct file_struct *f
+@@ -606,9 +638,10 @@ void receive_xattr(struct file_struct *file, int f)
        while (count--) {
                char *ptr, *name;
                rsync_xa *rxa;