Fix alignment issue on 64-bit. Solution from Steve Ortiz.
[rsync/rsync-patches.git] / checksum-reading.diff
index ff96510..139cc58 100644 (file)
@@ -16,10 +16,11 @@ To use this patch, run these commands for a successful build:
     ./configure                               (optional if already run)
     make
 
+based-on: a01e3b490eb36ccf9e704840e1b6683dab867550
 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)
        }
  }
  
@@ -31,7 +32,7 @@ diff --git a/checksum.c b/checksum.c
 diff --git a/clientserver.c b/clientserver.c
 --- a/clientserver.c
 +++ b/clientserver.c
-@@ -39,6 +39,8 @@ extern int numeric_ids;
+@@ -42,6 +42,8 @@ extern int numeric_ids;
  extern int filesfrom_fd;
  extern int remote_protocol;
  extern int protocol_version;
@@ -40,8 +41,8 @@ diff --git a/clientserver.c b/clientserver.c
  extern int io_timeout;
  extern int no_detach;
  extern int write_batch;
-@@ -750,6 +752,9 @@ 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. */
+@@ -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;
  
 +      checksum_files = always_checksum ? lp_checksum_files(i)
@@ -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
-@@ -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 do_progress;
  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;
@@ -69,19 +78,20 @@ diff --git a/flist.c b/flist.c
  extern int copy_links;
  extern int copy_unsafe_links;
  extern int protocol_version;
-@@ -68,6 +70,7 @@ extern int sanitize_paths;
- extern int munge_symlinks;
- extern int need_unsorted_flist;
+@@ -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;
-@@ -83,6 +86,11 @@ 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"
++#define RSYNCSUMS_LEN (sizeof RSYNCSUMS_FILE-1)
 +
 +#define CLEAN_STRIP_ROOT (1<<0)
 +#define CLEAN_KEEP_LAST (1<<1)
@@ -89,9 +99,9 @@ diff --git a/flist.c b/flist.c
  #define PTR_SIZE (sizeof (struct file_struct *))
  
  int io_error;
-@@ -124,7 +132,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 dir_count = 0;
  
 -static void flist_sort_and_clean(struct file_list *flist, int strip_root);
 +static struct csum_cache {
@@ -102,7 +112,7 @@ diff --git a/flist.c b/flist.c
  static void output_flist(struct file_list *flist);
  
  void init_flist(void)
-@@ -315,6 +327,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;
  }
  
@@ -133,8 +143,7 @@ diff --git a/flist.c b/flist.c
 +      }
 +}
 +
-+
-+/* The basename_len count is the length of the basename + 1 for the null. */
++/* The basename_len count is the length of the basename + 1 for the '\0'. */
 +static int add_checksum(struct file_list *flist, const char *dirname,
 +                      const char *basename, int basename_len, OFF_T file_length,
 +                      time_t mtime, uint32 ctime, uint32 inode,
@@ -144,7 +153,8 @@ diff --git a/flist.c b/flist.c
 +      int alloc_len, extra_len;
 +      char *bp;
 +
-+      if (basename_len == 10+1 && *basename == '.' && strcmp(basename, RSYNCSUMS_FILE) == 0)
++      if (basename_len == RSYNCSUMS_LEN+1 && *basename == '.'
++       && strcmp(basename, RSYNCSUMS_FILE) == 0)
 +              return 0;
 +
 +      /* "2" is for a 32-bit ctime num and an 32-bit inode num. */
@@ -198,7 +208,7 @@ diff --git a/flist.c b/flist.c
 +      uint32 ctime, inode;
 +      int dlen = dirname ? strlcpy(fbuf, dirname, sizeof fbuf) : 0;
 +
-+      if (dlen >= (int)(sizeof fbuf - sizeof RSYNCSUMS_FILE))
++      if (dlen >= (int)(sizeof fbuf - 1 - RSYNCSUMS_LEN))
 +              return;
 +      if (dlen)
 +              fbuf[dlen++] = '/';
@@ -338,10 +348,10 @@ diff --git a/flist.c b/flist.c
 +      file_checksum(fname, stp->st_size, sum_buf);
 +}
 +
- int push_pathname(const char *dir, int len)
- {
-       if (dir == pathname)
-@@ -1005,7 +1249,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+ /* 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
+@@ -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;
@@ -350,7 +360,7 @@ diff --git a/flist.c b/flist.c
        struct file_struct *file;
        char thisname[MAXPATHLEN];
        char linkname[MAXPATHLEN];
-@@ -1138,9 +1382,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;
@@ -368,45 +378,47 @@ diff --git a/flist.c b/flist.c
        basename_len = strlen(basename) + 1; /* count the '\0' */
  
  #ifdef SUPPORT_LINKS
-@@ -1216,11 +1467,15 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
-       }
+@@ -1309,11 +1562,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+               extra_len += EXTRA_LEN;
  #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);
--
-       F_PATHNAME(file) = pathname;
+-              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 (sender_keeps_checksum)
++                      memcpy(F_SUM(file), tmp_sum, checksum_len);
 +      }
-+
-       /* 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) {
-@@ -2076,7 +2331,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;
- }
-@@ -2178,7 +2434,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 */
-@@ -2376,7 +2632,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. */
@@ -415,7 +427,7 @@ diff --git a/flist.c b/flist.c
  {
        char fbuf[MAXPATHLEN];
        int i, prev_i;
-@@ -2427,7 +2683,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. */
@@ -424,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;
-@@ -2443,8 +2699,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) {
--                              if (verbose > 1) {
+-                              if (DEBUG_GTE(DUP, 1)) {
 +                      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);
-@@ -2466,7 +2722,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;
  
@@ -447,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
-@@ -53,6 +53,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;
-@@ -694,7 +695,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. */
@@ -464,7 +476,7 @@ diff --git a/generator.c b/generator.c
  {
        if (st->st_size != F_LENGTH(file))
                return 0;
-@@ -703,7 +704,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];
@@ -476,7 +488,7 @@ diff --git a/generator.c b/generator.c
                return memcmp(sum, F_SUM(file), checksum_len) == 0;
        }
  
-@@ -957,7 +961,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:
@@ -485,16 +497,16 @@ diff --git a/generator.c b/generator.c
                                continue;
                        best_match = j;
                        match_level = 2;
-@@ -1219,7 +1223,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
-       static const char *parent_dirname = "";
-       static struct file_struct *missing_dir = NULL, *excluded_dir = NULL;
+@@ -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;
 -      static int need_fuzzy_dirlist = 0;
 +      static int need_new_dirscan = 0;
        struct file_struct *fuzzy_file = NULL;
        int fd = -1, f_copy = -1;
        stat_x sx, real_sx;
-@@ -1309,8 +1313,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;
                        }
@@ -505,7 +517,7 @@ diff --git a/generator.c b/generator.c
  #ifdef SUPPORT_ACLS
                        if (!preserve_perms)
                                dflt_perms = default_perms_for_dir(dn);
-@@ -1318,10 +1322,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;
  
@@ -525,7 +537,7 @@ diff --git a/generator.c b/generator.c
                }
  
                statret = link_stat(fname, &sx.st, keep_dirlinks && is_dir);
-@@ -1742,7 +1751,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)
                ;
@@ -537,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
-@@ -351,7 +351,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;
                        }
@@ -546,10 +558,10 @@ diff --git a/hlink.c b/hlink.c
                                continue;
                        statret = 1;
                        if (unchanged_attrs(cmpbuf, file, &alt_sx))
-diff --git a/ifuncs.h b/ifuncs.h
---- a/ifuncs.h
-+++ b/ifuncs.h
-@@ -64,6 +64,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
@@ -565,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
-@@ -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;
-@@ -200,6 +201,7 @@ static service sDefault =
+@@ -205,6 +206,7 @@ static const all_vars Defaults = {
   /* temp_dir; */              NULL,
-  /* uid; */                   NOBODY_USER,
+  /* uid; */                   NULL,
  
 + /* 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" },
@@ -591,18 +603,19 @@ diff --git a/loadparm.c b/loadparm.c
 +      { 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[] =
-@@ -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)
  
@@ -621,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;
-@@ -316,6 +317,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");
@@ -629,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");
-@@ -445,7 +447,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_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};
  
- static struct poptOption long_options[] = {
-@@ -566,6 +568,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 },
@@ -646,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 },
-@@ -1212,6 +1215,23 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
+@@ -1652,6 +1655,23 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        }
                        break;
  
@@ -667,14 +680,14 @@ diff --git a/options.c b/options.c
 +                      }
 +                      break;
 +
-               case OPT_HELP:
-                       usage(FINFO);
-                       exit_cleanup(0);
-@@ -1311,6 +1331,9 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
+               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
  
-+      if (checksum_files && !always_checksum)
++      if (!always_checksum)
 +              checksum_files = CSF_IGNORE_FILES;
 +
        if (write_batch && read_batch) {
@@ -683,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
-@@ -680,6 +680,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. */
@@ -694,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)
-@@ -858,6 +862,13 @@ typedef struct {
+@@ -923,6 +927,13 @@ typedef struct {
        char fname[1]; /* has variable size */
  } relnamecache;
  
@@ -711,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
-@@ -317,6 +317,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
@@ -719,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
-@@ -516,9 +517,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
- 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),
@@ -732,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
-@@ -526,12 +527,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.
  
@@ -741,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
- 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
@@ -780,11 +794,11 @@ 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
-@@ -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).
  
-+dit(bf(checksum files)) This option tells rsync to make use of any cached
++dit(bf(checksum files)) This parameter tells rsync to make use of any cached
 +checksum information it finds in per-directory .rsyncsums files when the
 +current transfer is using the bf(--checksum) option.  The value can be set
 +to either "lax", "strict", or "none" -- see the client's bf(--sumfiles)
@@ -795,7 +809,7 @@ diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
 +config option tells it to.  See also the bf(exclude) directive for a way
 +to hide the .rsyncsums files from the user.
 +
- dit(bf(read only)) The "read only" option determines whether clients
+ dit(bf(read only)) This parameter determines whether clients
  will be able to upload files or not. If "read only" is true then any
  attempted uploads will fail. If "read only" is false then uploads will
 diff --git a/support/rsyncsums b/support/rsyncsums