Fixed failing hunks.
authorWayne Davison <wayned@samba.org>
Sun, 8 Jul 2007 06:41:06 +0000 (06:41 +0000)
committerWayne Davison <wayned@samba.org>
Sun, 8 Jul 2007 06:41:06 +0000 (06:41 +0000)
checksum-updating.diff
detect-renamed.diff
early-checksum.diff
slow-down.diff
source-filter_dest-filter.diff
usermap.diff

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