Fix alignment issue on 64-bit. Solution from Steve Ortiz.
[rsync/rsync-patches.git] / checksum-reading.diff
index 03fed2c..139cc58 100644 (file)
@@ -16,10 +16,11 @@ To use this patch, run these commands for a successful build:
     ./configure                               (optional if already run)
     make
 
     ./configure                               (optional if already run)
     make
 
+based-on: a01e3b490eb36ccf9e704840e1b6683dab867550
 diff --git a/checksum.c b/checksum.c
 --- a/checksum.c
 +++ b/checksum.c
 diff --git a/checksum.c b/checksum.c
 --- a/checksum.c
 +++ b/checksum.c
-@@ -100,7 +100,7 @@ void get_checksum2(char *buf, int32 len, char *sum)
+@@ -98,7 +98,7 @@ void get_checksum2(char *buf, int32 len, char *sum)
        }
  }
  
        }
  }
  
@@ -40,7 +41,7 @@ diff --git a/clientserver.c b/clientserver.c
  extern int io_timeout;
  extern int no_detach;
  extern int write_batch;
  extern int io_timeout;
  extern int no_detach;
  extern int write_batch;
-@@ -779,6 +781,9 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -874,6 +876,9 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
        } else if (am_root < 0) /* Treat --fake-super from client as --super. */
                am_root = 2;
  
        } else if (am_root < 0) /* Treat --fake-super from client as --super. */
                am_root = 2;
  
@@ -53,15 +54,23 @@ diff --git a/clientserver.c b/clientserver.c
 diff --git a/flist.c b/flist.c
 --- a/flist.c
 +++ b/flist.c
 diff --git a/flist.c b/flist.c
 --- a/flist.c
 +++ b/flist.c
-@@ -34,6 +34,7 @@ extern int am_generator;
+@@ -22,6 +22,7 @@
+ #include "rsync.h"
+ #include "ifuncs.h"
++#include "itypes.h"
+ #include "rounding.h"
+ #include "inums.h"
+ #include "io.h"
+@@ -33,6 +34,7 @@ extern int am_sender;
+ extern int am_generator;
  extern int inc_recurse;
  extern int inc_recurse;
- extern int do_progress;
  extern int always_checksum;
 +extern int basis_dir_cnt;
  extern int module_id;
  extern int ignore_errors;
  extern int numeric_ids;
  extern int always_checksum;
 +extern int basis_dir_cnt;
  extern int module_id;
  extern int ignore_errors;
  extern int numeric_ids;
-@@ -61,6 +62,7 @@ extern int file_extra_cnt;
+@@ -61,6 +63,7 @@ extern int file_extra_cnt;
  extern int ignore_perishable;
  extern int non_perishable_cnt;
  extern int prune_empty_dirs;
  extern int ignore_perishable;
  extern int non_perishable_cnt;
  extern int prune_empty_dirs;
@@ -69,16 +78,16 @@ diff --git a/flist.c b/flist.c
  extern int copy_links;
  extern int copy_unsafe_links;
  extern int protocol_version;
  extern int copy_links;
  extern int copy_unsafe_links;
  extern int protocol_version;
-@@ -69,6 +71,7 @@ extern int munge_symlinks;
- extern int need_unsorted_flist;
- extern int sender_symlink_iconv;
+@@ -72,6 +75,7 @@ extern int sender_symlink_iconv;
+ extern int output_needs_newline;
+ extern int sender_keeps_checksum;
  extern int unsort_ndx;
 +extern char *basis_dir[];
  extern struct stats stats;
  extern char *filesfrom_host;
  extern int unsort_ndx;
 +extern char *basis_dir[];
  extern struct stats stats;
  extern char *filesfrom_host;
-@@ -84,6 +87,12 @@ extern int filesfrom_convert;
- extern iconv_t ic_send, ic_recv;
+ extern char *usermap, *groupmap;
+@@ -96,6 +100,12 @@ extern iconv_t ic_send, ic_recv;
+ #endif
  #endif
  
 +#define RSYNCSUMS_FILE ".rsyncsums"
  #endif
  
 +#define RSYNCSUMS_FILE ".rsyncsums"
@@ -90,9 +99,9 @@ diff --git a/flist.c b/flist.c
  #define PTR_SIZE (sizeof (struct file_struct *))
  
  int io_error;
  #define PTR_SIZE (sizeof (struct file_struct *))
  
  int io_error;
-@@ -125,7 +134,11 @@ static char empty_sum[MAX_DIGEST_LEN];
+@@ -137,7 +147,11 @@ static char tmp_sum[MAX_DIGEST_LEN];
+ static char empty_sum[MAX_DIGEST_LEN];
  static int flist_count_offset; /* for --delete --progress */
  static int flist_count_offset; /* for --delete --progress */
- static int dir_count = 0;
  
 -static void flist_sort_and_clean(struct file_list *flist, int strip_root);
 +static struct csum_cache {
  
 -static void flist_sort_and_clean(struct file_list *flist, int strip_root);
 +static struct csum_cache {
@@ -103,7 +112,7 @@ diff --git a/flist.c b/flist.c
  static void output_flist(struct file_list *flist);
  
  void init_flist(void)
  static void output_flist(struct file_list *flist);
  
  void init_flist(void)
-@@ -339,6 +352,238 @@ static void flist_done_allocating(struct file_list *flist)
+@@ -352,6 +366,238 @@ static void flist_done_allocating(struct file_list *flist)
                flist->pool_boundary = ptr;
  }
  
                flist->pool_boundary = ptr;
  }
  
@@ -342,7 +351,7 @@ diff --git a/flist.c b/flist.c
  /* Call this with EITHER (1) "file, NULL, 0" to chdir() to the file's
   * F_PATHNAME(), or (2) "NULL, dir, dirlen" to chdir() to the supplied dir,
   * with dir == NULL taken to be the starting directory, and dirlen < 0
  /* Call this with EITHER (1) "file, NULL, 0" to chdir() to the file's
   * F_PATHNAME(), or (2) "NULL, dir, dirlen" to chdir() to the supplied dir,
   * with dir == NULL taken to be the starting directory, and dirlen < 0
-@@ -1068,7 +1313,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1143,7 +1389,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
                              STRUCT_STAT *stp, int flags, int filter_level)
  {
        static char *lastdir;
                              STRUCT_STAT *stp, int flags, int filter_level)
  {
        static char *lastdir;
@@ -351,7 +360,7 @@ diff --git a/flist.c b/flist.c
        struct file_struct *file;
        char thisname[MAXPATHLEN];
        char linkname[MAXPATHLEN];
        struct file_struct *file;
        char thisname[MAXPATHLEN];
        char linkname[MAXPATHLEN];
-@@ -1207,9 +1452,16 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1289,9 +1535,16 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
                        memcpy(lastdir, thisname, len);
                        lastdir[len] = '\0';
                        lastdir_len = len;
                        memcpy(lastdir, thisname, len);
                        lastdir[len] = '\0';
                        lastdir_len = len;
@@ -369,48 +378,47 @@ diff --git a/flist.c b/flist.c
        basename_len = strlen(basename) + 1; /* count the '\0' */
  
  #ifdef SUPPORT_LINKS
        basename_len = strlen(basename) + 1; /* count the '\0' */
  
  #ifdef SUPPORT_LINKS
-@@ -1286,14 +1538,18 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
-               memcpy(bp + basename_len, linkname, linkname_len);
+@@ -1309,11 +1562,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+               extra_len += EXTRA_LEN;
  #endif
  
  #endif
  
--      if (always_checksum && am_sender && S_ISREG(st.st_mode))
+-      if (always_checksum && am_sender && S_ISREG(st.st_mode)) {
 -              file_checksum(thisname, tmp_sum, st.st_size);
 -              file_checksum(thisname, tmp_sum, st.st_size);
--
-       if (am_sender)
-               F_PATHNAME(file) = pathname;
-       else if (!pool)
-               F_DEPTH(file) = extra_len / EXTRA_LEN;
+-              if (sender_keeps_checksum)
+-                      extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
+-      }
++      if (sender_keeps_checksum && S_ISREG(st.st_mode))
++              extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
+ #if EXTRA_ROUNDING > 0
+       if (extra_len & (EXTRA_ROUNDING * EXTRA_LEN))
+@@ -1396,8 +1646,14 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+               return NULL;
+       }
  
  
+-      if (sender_keeps_checksum && S_ISREG(st.st_mode))
+-              memcpy(F_SUM(file), tmp_sum, checksum_len);
 +      if (always_checksum && am_sender && S_ISREG(st.st_mode)) {
 +              if (flist && checksum_files)
 +                      get_cached_checksum(0, thisname, file, &st, tmp_sum);
 +              else
 +                      file_checksum(thisname, st.st_size, tmp_sum);
 +      if (always_checksum && am_sender && S_ISREG(st.st_mode)) {
 +              if (flist && checksum_files)
 +                      get_cached_checksum(0, thisname, file, &st, tmp_sum);
 +              else
 +                      file_checksum(thisname, st.st_size, tmp_sum);
++              if (sender_keeps_checksum)
++                      memcpy(F_SUM(file), tmp_sum, checksum_len);
 +      }
 +      }
-+
-       if (basename_len == 0+1) {
-               if (!pool)
-                       unmake_file(file);
-@@ -2236,7 +2492,8 @@ 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);
-               }
--      }
-+      } else
-+              flist_eof = 1;
  
  
-       return flist;
- }
-@@ -2342,7 +2599,7 @@ struct file_list *recv_file_list(int f)
-       else if (f >= 0)
-               recv_id_list(f, flist);
+       if (unsort_ndx)
+               F_NDX(file) = stats.num_dirs;
+@@ -2546,7 +2802,7 @@ struct file_list *recv_file_list(int f)
+                       rprintf(FINFO, "[%s] flist_eof=1\n", who_am_i());
+       }
  
 -      flist_sort_and_clean(flist, relative_paths);
 +      flist_sort_and_clean(flist, relative_paths ? CLEAN_STRIP_ROOT : 0);
  
        if (protocol_version < 30) {
                /* Recv the io_error flag */
  
 -      flist_sort_and_clean(flist, relative_paths);
 +      flist_sort_and_clean(flist, relative_paths ? CLEAN_STRIP_ROOT : 0);
  
        if (protocol_version < 30) {
                /* Recv the io_error flag */
-@@ -2562,7 +2819,7 @@ void flist_free(struct file_list *flist)
+@@ -2769,7 +3025,7 @@ void flist_free(struct file_list *flist)
  
  /* This routine ensures we don't have any duplicate names in our file list.
   * duplicate names can cause corruption because of the pipelining. */
  
  /* This routine ensures we don't have any duplicate names in our file list.
   * duplicate names can cause corruption because of the pipelining. */
@@ -419,7 +427,7 @@ diff --git a/flist.c b/flist.c
  {
        char fbuf[MAXPATHLEN];
        int i, prev_i;
  {
        char fbuf[MAXPATHLEN];
        int i, prev_i;
-@@ -2613,7 +2870,7 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root)
+@@ -2820,7 +3076,7 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root)
                        /* If one is a dir and the other is not, we want to
                         * keep the dir because it might have contents in the
                         * list.  Otherwise keep the first one. */
                        /* If one is a dir and the other is not, we want to
                         * keep the dir because it might have contents in the
                         * list.  Otherwise keep the first one. */
@@ -428,18 +436,18 @@ diff --git a/flist.c b/flist.c
                                struct file_struct *fp = flist->sorted[j];
                                if (!S_ISDIR(fp->mode))
                                        keep = i, drop = j;
                                struct file_struct *fp = flist->sorted[j];
                                if (!S_ISDIR(fp->mode))
                                        keep = i, drop = j;
-@@ -2629,8 +2886,8 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root)
+@@ -2836,8 +3092,8 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root)
                        } else
                                keep = j, drop = i;
  
 -                      if (!am_sender) {
                        } else
                                keep = j, drop = i;
  
 -                      if (!am_sender) {
--                              if (verbose > 1) {
+-                              if (DEBUG_GTE(DUP, 1)) {
 +                      if (!am_sender || flags & CLEAN_KEEP_LAST) {
 +                      if (!am_sender || flags & CLEAN_KEEP_LAST) {
-+                              if (verbose > 1 && !(flags & CLEAN_KEEP_LAST)) {
++                              if (DEBUG_GTE(DUP, 1) && !(flags & CLEAN_KEEP_LAST)) {
                                        rprintf(FINFO,
                                            "removing duplicate name %s from file list (%d)\n",
                                            f_name(file, fbuf), drop + flist->ndx_start);
                                        rprintf(FINFO,
                                            "removing duplicate name %s from file list (%d)\n",
                                            f_name(file, fbuf), drop + flist->ndx_start);
-@@ -2652,7 +2909,7 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root)
+@@ -2859,7 +3115,7 @@ static void flist_sort_and_clean(struct file_list *flist, int strip_root)
        }
        flist->high = prev_i;
  
        }
        flist->high = prev_i;
  
@@ -451,15 +459,15 @@ diff --git a/flist.c b/flist.c
 diff --git a/generator.c b/generator.c
 --- a/generator.c
 +++ b/generator.c
 diff --git a/generator.c b/generator.c
 --- a/generator.c
 +++ b/generator.c
-@@ -52,6 +52,7 @@ extern int delete_during;
- extern int delete_after;
+@@ -53,6 +53,7 @@ extern int delete_after;
+ extern int missing_args;
  extern int msgdone_cnt;
  extern int ignore_errors;
 +extern int checksum_files;
  extern int remove_source_files;
  extern int delay_updates;
  extern int update_only;
  extern int msgdone_cnt;
  extern int ignore_errors;
 +extern int checksum_files;
  extern int remove_source_files;
  extern int delay_updates;
  extern int update_only;
-@@ -715,7 +716,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -521,7 +522,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. */
  
  
  /* Perform our quick-check heuristic for determining if a file is unchanged. */
@@ -468,7 +476,7 @@ diff --git a/generator.c b/generator.c
  {
        if (st->st_size != F_LENGTH(file))
                return 0;
  {
        if (st->st_size != F_LENGTH(file))
                return 0;
-@@ -724,7 +725,10 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
+@@ -530,7 +531,10 @@ 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];
           of the file time to determine whether to sync */
        if (always_checksum > 0 && S_ISREG(st->st_mode)) {
                char sum[MAX_DIGEST_LEN];
@@ -480,7 +488,7 @@ diff --git a/generator.c b/generator.c
                return memcmp(sum, F_SUM(file), checksum_len) == 0;
        }
  
                return memcmp(sum, F_SUM(file), checksum_len) == 0;
        }
  
-@@ -988,7 +992,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
+@@ -794,7 +798,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
                        match_level = 1;
                        /* FALL THROUGH */
                case 1:
                        match_level = 1;
                        /* FALL THROUGH */
                case 1:
@@ -489,7 +497,7 @@ diff --git a/generator.c b/generator.c
                                continue;
                        best_match = j;
                        match_level = 2;
                                continue;
                        best_match = j;
                        match_level = 2;
-@@ -1261,7 +1265,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1080,7 +1084,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
         * --ignore-non-existing, daemon exclude, or mkdir failure. */
        static struct file_struct *skip_dir = NULL;
        static struct file_list *fuzzy_dirlist = NULL;
         * --ignore-non-existing, daemon exclude, or mkdir failure. */
        static struct file_struct *skip_dir = NULL;
        static struct file_list *fuzzy_dirlist = NULL;
@@ -498,7 +506,7 @@ diff --git a/generator.c b/generator.c
        struct file_struct *fuzzy_file = NULL;
        int fd = -1, f_copy = -1;
        stat_x sx, real_sx;
        struct file_struct *fuzzy_file = NULL;
        int fd = -1, f_copy = -1;
        stat_x sx, real_sx;
-@@ -1350,8 +1354,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1164,8 +1168,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                                flist_free(fuzzy_dirlist);
                                fuzzy_dirlist = NULL;
                        }
                                flist_free(fuzzy_dirlist);
                                fuzzy_dirlist = NULL;
                        }
@@ -509,7 +517,7 @@ diff --git a/generator.c b/generator.c
  #ifdef SUPPORT_ACLS
                        if (!preserve_perms)
                                dflt_perms = default_perms_for_dir(dn);
  #ifdef SUPPORT_ACLS
                        if (!preserve_perms)
                                dflt_perms = default_perms_for_dir(dn);
-@@ -1359,10 +1363,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1173,10 +1177,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                }
                parent_dirname = dn;
  
                }
                parent_dirname = dn;
  
@@ -529,7 +537,7 @@ diff --git a/generator.c b/generator.c
                }
  
                statret = link_stat(fname, &sx.st, keep_dirlinks && is_dir);
                }
  
                statret = link_stat(fname, &sx.st, keep_dirlinks && is_dir);
-@@ -1796,7 +1805,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1599,7 +1608,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                ;
        else if (fnamecmp_type == FNAMECMP_FUZZY)
                ;
                ;
        else if (fnamecmp_type == FNAMECMP_FUZZY)
                ;
@@ -541,7 +549,7 @@ diff --git a/generator.c b/generator.c
 diff --git a/hlink.c b/hlink.c
 --- a/hlink.c
 +++ b/hlink.c
 diff --git a/hlink.c b/hlink.c
 --- a/hlink.c
 +++ b/hlink.c
-@@ -390,7 +390,7 @@ int hard_link_check(struct file_struct *file, int ndx, const char *fname,
+@@ -409,7 +409,7 @@ int hard_link_check(struct file_struct *file, int ndx, char *fname,
                                }
                                break;
                        }
                                }
                                break;
                        }
@@ -550,10 +558,10 @@ diff --git a/hlink.c b/hlink.c
                                continue;
                        statret = 1;
                        if (unchanged_attrs(cmpbuf, file, &alt_sx))
                                continue;
                        statret = 1;
                        if (unchanged_attrs(cmpbuf, file, &alt_sx))
-diff --git a/ifuncs.h b/ifuncs.h
---- a/ifuncs.h
-+++ b/ifuncs.h
-@@ -74,6 +74,12 @@ isDigit(const char *ptr)
+diff --git a/itypes.h b/itypes.h
+--- a/itypes.h
++++ b/itypes.h
+@@ -23,6 +23,12 @@ isDigit(const char *ptr)
  }
  
  static inline int
  }
  
  static inline int
@@ -569,25 +577,25 @@ diff --git a/ifuncs.h b/ifuncs.h
 diff --git a/loadparm.c b/loadparm.c
 --- a/loadparm.c
 +++ b/loadparm.c
 diff --git a/loadparm.c b/loadparm.c
 --- a/loadparm.c
 +++ b/loadparm.c
-@@ -149,6 +149,7 @@ typedef struct
-       char *temp_dir;
-       char *uid;
+@@ -133,6 +133,7 @@ typedef struct {
+ /* NOTE: update this macro if the last char* variable changes! */
+ #define LOCAL_STRING_COUNT() (offsetof(local_vars, uid) / sizeof (char*) + 1)
  
 +      int checksum_files;
        int max_connections;
        int max_verbosity;
        int syslog_facility;
  
 +      int checksum_files;
        int max_connections;
        int max_verbosity;
        int syslog_facility;
-@@ -200,6 +201,7 @@ static service sDefault =
+@@ -205,6 +206,7 @@ static const all_vars Defaults = {
   /* temp_dir; */              NULL,
   /* temp_dir; */              NULL,
-  /* uid; */                   NOBODY_USER,
+  /* uid; */                   NULL,
  
 + /* checksum_files; */                CSF_IGNORE_FILES,
   /* max_connections; */               0,
   /* max_verbosity; */         1,
   /* syslog_facility; */               LOG_DAEMON,
  
 + /* checksum_files; */                CSF_IGNORE_FILES,
   /* max_connections; */               0,
   /* max_verbosity; */         1,
   /* syslog_facility; */               LOG_DAEMON,
-@@ -294,6 +296,12 @@ static struct enum_list enum_facilities[] = {
- #endif
      { -1, NULL }};
+@@ -306,6 +308,13 @@ static struct enum_list enum_facilities[] = {
+       { -1, NULL }
+ };
  
 +static struct enum_list enum_csum_modes[] = {
 +      { CSF_IGNORE_FILES, "none" },
  
 +static struct enum_list enum_csum_modes[] = {
 +      { CSF_IGNORE_FILES, "none" },
@@ -595,18 +603,19 @@ diff --git a/loadparm.c b/loadparm.c
 +      { CSF_STRICT_MODE, "strict" },
 +      { -1, NULL }
 +};
 +      { CSF_STRICT_MODE, "strict" },
 +      { -1, NULL }
 +};
- /* note that we do not initialise the defaults union - it is not allowed in ANSI C */
++
  static struct parm_struct parm_table[] =
  static struct parm_struct parm_table[] =
-@@ -306,6 +314,7 @@ static struct parm_struct parm_table[] =
-  {"auth users",        P_STRING, P_LOCAL, &sDefault.auth_users,        NULL,0},
-  {"charset",           P_STRING, P_LOCAL, &sDefault.charset,           NULL,0},
-+ {"checksum files",    P_ENUM,   P_LOCAL, &sDefault.checksum_files,    enum_csum_modes,0},
-  {"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},
-@@ -423,6 +432,7 @@ FN_LOCAL_STRING(lp_secrets_file, secrets_file)
+ {
+  {"address",           P_STRING, P_GLOBAL,&Vars.g.bind_address,        NULL,0},
+@@ -316,6 +325,7 @@ static struct parm_struct parm_table[] =
+  {"auth users",        P_STRING, P_LOCAL, &Vars.l.auth_users,          NULL,0},
+  {"charset",           P_STRING, P_LOCAL, &Vars.l.charset,             NULL,0},
++ {"checksum files",    P_ENUM,   P_LOCAL, &Vars.l.checksum_files,      enum_csum_modes,0},
+  {"comment",           P_STRING, P_LOCAL, &Vars.l.comment,             NULL,0},
+  {"dont compress",     P_STRING, P_LOCAL, &Vars.l.dont_compress,       NULL,0},
+  {"exclude from",      P_STRING, P_LOCAL, &Vars.l.exclude_from,        NULL,0},
+@@ -470,6 +480,7 @@ FN_LOCAL_STRING(lp_secrets_file, secrets_file)
  FN_LOCAL_STRING(lp_temp_dir, temp_dir)
  FN_LOCAL_STRING(lp_uid, uid)
  
  FN_LOCAL_STRING(lp_temp_dir, temp_dir)
  FN_LOCAL_STRING(lp_uid, uid)
  
@@ -617,7 +626,7 @@ diff --git a/loadparm.c b/loadparm.c
 diff --git a/options.c b/options.c
 --- a/options.c
 +++ b/options.c
 diff --git a/options.c b/options.c
 --- a/options.c
 +++ b/options.c
-@@ -113,6 +113,7 @@ size_t bwlimit_writemax = 0;
+@@ -112,6 +112,7 @@ size_t bwlimit_writemax = 0;
  int ignore_existing = 0;
  int ignore_non_existing = 0;
  int need_messages_from_generator = 0;
  int ignore_existing = 0;
  int ignore_non_existing = 0;
  int need_messages_from_generator = 0;
@@ -625,7 +634,7 @@ diff --git a/options.c b/options.c
  int max_delete = INT_MIN;
  OFF_T max_size = 0;
  OFF_T min_size = 0;
  int max_delete = INT_MIN;
  OFF_T max_size = 0;
  OFF_T min_size = 0;
-@@ -318,6 +319,7 @@ void usage(enum logcode F)
+@@ -662,6 +663,7 @@ void usage(enum logcode F)
    rprintf(F," -q, --quiet                 suppress non-error messages\n");
    rprintf(F,"     --no-motd               suppress daemon-mode MOTD (see manpage caveat)\n");
    rprintf(F," -c, --checksum              skip based on checksum, not mod-time & size\n");
    rprintf(F," -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");
@@ -633,16 +642,16 @@ diff --git a/options.c b/options.c
    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");
    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");
-@@ -447,7 +449,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+@@ -798,7 +800,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,
        OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
        OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
        OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
--      OPT_NO_D, OPT_APPEND, OPT_NO_ICONV,
-+      OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_SUMFILES,
+-      OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG,
++      OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, OPT_SUMFILES,
+       OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT,
        OPT_SERVER, OPT_REFUSED_BASE = 9000};
  
        OPT_SERVER, OPT_REFUSED_BASE = 9000};
  
- static struct poptOption long_options[] = {
-@@ -575,6 +577,7 @@ static struct poptOption long_options[] = {
+@@ -934,6 +936,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 },
    {"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 },
@@ -650,7 +659,7 @@ diff --git a/options.c b/options.c
    {"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 },
    {"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 },
-@@ -1229,6 +1232,23 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1652,6 +1655,23 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        }
                        break;
  
                        }
                        break;
  
@@ -671,10 +680,10 @@ diff --git a/options.c b/options.c
 +                      }
 +                      break;
 +
 +                      }
 +                      break;
 +
-               case OPT_HELP:
-                       usage(FINFO);
-                       exit_cleanup(0);
-@@ -1333,6 +1353,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+               case OPT_INFO:
+                       arg = poptGetOptArg(pc);
+                       parse_output_words(info_words, info_levels, arg, USER_PRIORITY);
+@@ -1866,6 +1886,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
        }
  #endif
  
        }
  #endif
  
@@ -687,8 +696,8 @@ diff --git a/options.c b/options.c
 diff --git a/rsync.h b/rsync.h
 --- a/rsync.h
 +++ b/rsync.h
 diff --git a/rsync.h b/rsync.h
 --- a/rsync.h
 +++ b/rsync.h
-@@ -692,6 +692,10 @@ extern int xattrs_ndx;
- #define F_SUM(f) ((char*)OPT_EXTRA(f, LEN64_BUMP(f) + HLINK_BUMP(f) \
+@@ -727,6 +727,10 @@ extern int xattrs_ndx;
+ #define F_SUM(f) ((char*)OPT_EXTRA(f, START_BUMP(f) + HLINK_BUMP(f) \
                                    + SUM_EXTRA_CNT - 1))
  
 +/* These are only valid on an entry read from a checksum file. */
                                    + SUM_EXTRA_CNT - 1))
  
 +/* These are only valid on an entry read from a checksum file. */
@@ -698,7 +707,7 @@ diff --git a/rsync.h b/rsync.h
  /* Some utility defines: */
  #define F_IS_ACTIVE(f) (f)->basename[0]
  #define F_IS_HLINKED(f) ((f)->flags & FLAG_HLINKED)
  /* Some utility defines: */
  #define F_IS_ACTIVE(f) (f)->basename[0]
  #define F_IS_HLINKED(f) ((f)->flags & FLAG_HLINKED)
-@@ -879,6 +883,13 @@ typedef struct {
+@@ -923,6 +927,13 @@ typedef struct {
        char fname[1]; /* has variable size */
  } relnamecache;
  
        char fname[1]; /* has variable size */
  } relnamecache;
  
@@ -715,7 +724,7 @@ diff --git a/rsync.h b/rsync.h
 diff --git a/rsync.yo b/rsync.yo
 --- a/rsync.yo
 +++ b/rsync.yo
 diff --git a/rsync.yo b/rsync.yo
 --- a/rsync.yo
 +++ b/rsync.yo
-@@ -321,6 +321,7 @@ to the detailed description below for a complete description.  verb(
+@@ -323,6 +323,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
   -q, --quiet                 suppress non-error messages
       --no-motd               suppress daemon-mode MOTD (see caveat)
   -c, --checksum              skip based on checksum, not mod-time & size
@@ -723,9 +732,9 @@ diff --git a/rsync.yo b/rsync.yo
   -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
   -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
-@@ -520,9 +521,9 @@ uses a "quick check" that (by default) checks if each file's size and time
+@@ -568,9 +569,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
  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
+ changes this to compare a 128-bit checksum for each file that has a
  matching size.  Generating the checksums means that both sides will expend
 -a lot of disk I/O reading all the data in the files in the transfer (and
 -this is prior to any reading that will be done to transfer changed files),
  matching size.  Generating the checksums means that both sides will expend
 -a lot of disk I/O reading all the data in the files in the transfer (and
 -this is prior to any reading that will be done to transfer changed files),
@@ -736,7 +745,7 @@ diff --git a/rsync.yo b/rsync.yo
  
  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
  
  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
-@@ -530,12 +531,44 @@ its checksums when it is scanning for changed files, and will checksum any
+@@ -578,6 +579,8 @@ 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.
  
  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.
  
@@ -745,8 +754,9 @@ diff --git a/rsync.yo b/rsync.yo
  Note that rsync always verifies that each em(transferred) file was
  correctly reconstructed on the receiving side by checking a whole-file
  checksum that is generated as the file is transferred, but that
  Note that rsync always verifies that each em(transferred) file was
  correctly reconstructed on the receiving side by checking a whole-file
  checksum that is generated as the file is transferred, but that
- automatic after-the-transfer verification has nothing to do with this
- option's before-the-transfer "Does this file need to be updated?" check.
+@@ -587,6 +590,36 @@ option's before-the-transfer "Does this file need to be updated?" check.
+ For protocol 30 and beyond (first supported in 3.0.0), the checksum used is
+ MD5.  For older protocols, the checksum used is MD4.
  
 +dit(bf(--sumfiles=MODE)) This option tells rsync to make use of any cached
 +checksum information it finds in per-directory .rsyncsums files when the
  
 +dit(bf(--sumfiles=MODE)) This option tells rsync to make use of any cached
 +checksum information it finds in per-directory .rsyncsums files when the
@@ -784,7 +794,7 @@ diff --git a/rsync.yo b/rsync.yo
 diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
 --- a/rsyncd.conf.yo
 +++ b/rsyncd.conf.yo
 diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
 --- a/rsyncd.conf.yo
 +++ b/rsyncd.conf.yo
-@@ -281,6 +281,17 @@ locking on this file to ensure that the max connections limit is not
+@@ -312,6 +312,17 @@ 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).
  
  exceeded for the modules sharing the lock file.
  The default is tt(/var/run/rsyncd.lock).
  
@@ -806,10 +816,9 @@ diff --git a/support/rsyncsums b/support/rsyncsums
 new file mode 100755
 --- /dev/null
 +++ b/support/rsyncsums
 new file mode 100755
 --- /dev/null
 +++ b/support/rsyncsums
-@@ -0,0 +1,202 @@
-+#!/usr/bin/perl
+@@ -0,0 +1,201 @@
++#!/usr/bin/perl -w
 +use strict;
 +use strict;
-+use warnings;
 +
 +use Getopt::Long;
 +use Cwd qw(abs_path cwd);
 +
 +use Getopt::Long;
 +use Cwd qw(abs_path cwd);