Fixed failing hunks.
[rsync/rsync-patches.git] / acls.diff
index 7e832a2..6d40ba3 100644 (file)
--- a/acls.diff
+++ b/acls.diff
@@ -1138,7 +1138,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern int preserve_devices;
  extern int preserve_specials;
  extern int preserve_links;
-@@ -95,7 +96,8 @@ path
+@@ -93,7 +94,8 @@ path
  ****************************************************************************/
  static int make_bak_dir(char *fullpath)
  {
@@ -1148,7 +1148,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        char *rel = fullpath + backup_dir_len;
        char *end = rel + strlen(rel);
        char *p = end;
-@@ -127,15 +129,24 @@ static int make_bak_dir(char *fullpath)
+@@ -125,15 +127,24 @@ static int make_bak_dir(char *fullpath)
                if (p >= rel) {
                        /* Try to transfer the directory settings of the
                         * actual dir that the files are coming from. */
@@ -1177,7 +1177,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        }
                }
                *p = '/';
-@@ -173,15 +184,18 @@ static int robust_move(const char *src, 
+@@ -171,15 +182,18 @@ static int robust_move(const char *src, 
   * We will move the file to be deleted into a parallel directory tree. */
  static int keep_backup(const char *fname)
  {
@@ -1198,7 +1198,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
        if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
                return 1; /* the file could have disappeared */
-@@ -191,6 +205,13 @@ static int keep_backup(const char *fname
+@@ -189,6 +203,13 @@ static int keep_backup(const char *fname
                return 0;
        }
  
@@ -1212,7 +1212,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        /* Check to see if this is a device file, or link */
        if ((am_root && preserve_devices && IS_DEVICE(file->mode))
         || (preserve_specials && IS_SPECIAL(file->mode))) {
-@@ -261,7 +282,7 @@ static int keep_backup(const char *fname
+@@ -259,7 +280,7 @@ static int keep_backup(const char *fname
                if (robust_move(fname, buf) != 0) {
                        rsyserr(FERROR, errno, "keep_backup failed: %s -> \"%s\"",
                                full_fname(fname), buf);
@@ -1324,9 +1324,9 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern int preserve_links;
  extern int preserve_hard_links;
  extern int preserve_devices;
-@@ -143,6 +144,8 @@ static void list_file_entry(struct file_
+@@ -144,6 +145,8 @@ static void list_file_entry(struct file_
        permstring(permbuf, f->mode);
+       len = F_LENGTH(f);
  
 +      /* TODO: indicate '+' if the entry has an ACL. */
 +
@@ -1343,10 +1343,10 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +              extra_len += (S_ISDIR(mode) ? 2 : 1) * sizeof (union flist_extras);
 +#endif
 +
-       sum_len = always_checksum && S_ISREG(mode) ? MD4_SUM_LENGTH : 0;
+       if (always_checksum && S_ISREG(mode))
+               extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
  
-       alloc_len = file_struct_len + dirname_len + basename_len
-@@ -725,6 +734,11 @@ static struct file_struct *recv_file_ent
+@@ -732,6 +741,11 @@ static struct file_struct *recv_file_ent
                read_buf(f, bp, checksum_len);
        }
  
@@ -1358,16 +1358,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        return file;
  }
  
-@@ -969,6 +983,8 @@ void unmake_file(struct file_struct *fil
- {
-       union flist_extras *start = (union flist_extras *)file
-                                 - (flist_extra_ndx - 1);
-+      if (preserve_acls && S_ISDIR(file->mode))
-+              start--;
-       free(start);
- }
-@@ -977,6 +993,9 @@ static struct file_struct *send_file_nam
+@@ -992,6 +1006,9 @@ static struct file_struct *send_file_nam
                                          unsigned short flags)
  {
        struct file_struct *file;
@@ -1377,7 +1368,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
        file = make_file(fname, flist, stp, flags,
                         f == -2 ? SERVER_FILTERS : ALL_FILTERS);
-@@ -986,11 +1005,24 @@ static struct file_struct *send_file_nam
+@@ -1001,11 +1018,24 @@ static struct file_struct *send_file_nam
        if (chmod_modes && !S_ISLNK(file->mode))
                file->mode = tweak_mode(file->mode, chmod_modes);
  
@@ -1412,15 +1403,15 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern int preserve_links;
  extern int preserve_devices;
  extern int preserve_specials;
-@@ -89,6 +90,7 @@ extern int one_file_system;
- extern int file_struct_len;
+@@ -87,6 +88,7 @@ extern int force_delete;
+ extern int one_file_system;
  extern struct stats stats;
  extern dev_t filesystem_dev;
 +extern mode_t orig_umask;
  extern char *backup_dir;
  extern char *backup_suffix;
  extern int backup_suffix_len;
-@@ -447,22 +449,27 @@ static void do_delete_pass(struct file_l
+@@ -445,22 +447,27 @@ static void do_delete_pass(struct file_l
                rprintf(FINFO, "                    \r");
  }
  
@@ -1453,12 +1444,12 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
             int32 iflags, uchar fnamecmp_type, const char *xname)
  {
        if (statret >= 0) { /* A from-dest-dir statret can == 1! */
-@@ -470,20 +477,24 @@ void itemize(struct file_struct *file, i
+@@ -468,20 +475,24 @@ void itemize(struct file_struct *file, i
                    : S_ISDIR(file->mode) ? !omit_dir_times
                    : !S_ISLNK(file->mode);
  
--              if (S_ISREG(file->mode) && file->length != st->st_size)
-+              if (S_ISREG(file->mode) && file->length != sxp->st.st_size)
+-              if (S_ISREG(file->mode) && F_LENGTH(file) != st->st_size)
++              if (S_ISREG(file->mode) && F_LENGTH(file) != sxp->st.st_size)
                        iflags |= ITEM_REPORT_SIZE;
                if ((iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !keep_time
                  && !(iflags & ITEM_MATCHED)
@@ -1483,7 +1474,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        } else
                iflags |= ITEM_IS_NEW;
  
-@@ -735,7 +746,7 @@ void check_for_finished_hlinks(int itemi
+@@ -733,7 +744,7 @@ void check_for_finished_hlinks(int itemi
   * handling the file, -1 if no dest-linking occurred, or a non-negative
   * value if we found an alternate basis file. */
  static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
@@ -1492,7 +1483,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                         int maybe_ATTRS_REPORT, enum logcode code)
  {
        int best_match = -1;
-@@ -744,7 +755,7 @@ static int try_dests_reg(struct file_str
+@@ -742,7 +753,7 @@ static int try_dests_reg(struct file_str
  
        do {
                pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
@@ -1501,7 +1492,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        continue;
                switch (match_level) {
                case 0:
-@@ -752,16 +763,20 @@ static int try_dests_reg(struct file_str
+@@ -750,16 +761,20 @@ static int try_dests_reg(struct file_str
                        match_level = 1;
                        /* FALL THROUGH */
                case 1:
@@ -1525,7 +1516,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                continue;
                        best_match = j;
                        match_level = 3;
-@@ -776,7 +791,7 @@ static int try_dests_reg(struct file_str
+@@ -774,7 +789,7 @@ static int try_dests_reg(struct file_str
        if (j != best_match) {
                j = best_match;
                pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
@@ -1534,7 +1525,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        return -1;
        }
  
-@@ -784,15 +799,20 @@ static int try_dests_reg(struct file_str
+@@ -782,15 +797,20 @@ static int try_dests_reg(struct file_str
  #ifdef SUPPORT_HARD_LINKS
                if (link_dest) {
                        int i = itemizing && (verbose > 1 || stdout_format_has_i > 1);
@@ -1542,7 +1533,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +                      if (hard_link_one(file, ndx, fname, 0, sxp,
                                          cmpbuf, 1, i, code) < 0)
                                goto try_a_copy;
-                       if (preserve_hard_links && IS_HLINKED(file))
+                       if (preserve_hard_links && F_IS_HLINKED(file))
                                hard_link_cluster(file, ndx, itemizing, code, j);
                } else
  #endif
@@ -1558,7 +1549,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                if (verbose > 1 && maybe_ATTRS_REPORT) {
                        rprintf(FCLIENT, "%s is uptodate\n", fname);
                }
-@@ -808,8 +828,13 @@ static int try_dests_reg(struct file_str
+@@ -806,8 +826,13 @@ static int try_dests_reg(struct file_str
                        }
                        return -1;
                }
@@ -1574,7 +1565,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                set_file_attrs(fname, file, NULL, 0);
                if (maybe_ATTRS_REPORT
                 && ((!itemizing && verbose && match_level == 2)
-@@ -830,7 +855,7 @@ static int try_dests_reg(struct file_str
+@@ -828,7 +853,7 @@ static int try_dests_reg(struct file_str
   * handling the file, or -1 if no dest-linking occurred, or a non-negative
   * value if we found an alternate basis file. */
  static int try_dests_non(struct file_struct *file, char *fname, int ndx,
@@ -1583,7 +1574,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                         int maybe_ATTRS_REPORT, enum logcode code)
  {
        char lnk[MAXPATHLEN];
-@@ -862,24 +887,24 @@ static int try_dests_non(struct file_str
+@@ -860,24 +885,24 @@ static int try_dests_non(struct file_str
  
        do {
                pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
@@ -1613,7 +1604,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                continue;
                        break;
  #endif
-@@ -893,7 +918,7 @@ static int try_dests_non(struct file_str
+@@ -891,7 +916,7 @@ static int try_dests_non(struct file_str
                        break;
                case TYPE_SPECIAL:
                case TYPE_DEVICE:
@@ -1622,7 +1613,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                continue;
                        break;
  #ifdef SUPPORT_LINKS
-@@ -910,7 +935,11 @@ static int try_dests_non(struct file_str
+@@ -908,7 +933,11 @@ static int try_dests_non(struct file_str
                        match_level = 2;
                        best_match = j;
                }
@@ -1635,7 +1626,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        match_level = 3;
                        best_match = j;
                        break;
-@@ -923,7 +952,7 @@ static int try_dests_non(struct file_str
+@@ -921,7 +950,7 @@ static int try_dests_non(struct file_str
        if (j != best_match) {
                j = best_match;
                pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
@@ -1644,7 +1635,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        return -1;
        }
  
-@@ -954,7 +983,15 @@ static int try_dests_non(struct file_str
+@@ -952,7 +981,15 @@ static int try_dests_non(struct file_str
                            : ITEM_LOCAL_CHANGE
                             + (match_level == 3 ? ITEM_XNAME_FOLLOWS : 0);
                        char *lp = match_level == 3 ? "" : NULL;
@@ -1661,7 +1652,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
                if (verbose > 1 && maybe_ATTRS_REPORT) {
                        rprintf(FCLIENT, "%s%s is uptodate\n",
-@@ -967,6 +1004,7 @@ static int try_dests_non(struct file_str
+@@ -965,6 +1002,7 @@ static int try_dests_non(struct file_str
  }
  
  static int phase = 0;
@@ -1669,7 +1660,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
  /* Acts on the_file_list->file's ndx'th item, whose name is fname.  If a dir,
   * make sure it exists, and has the right permissions/timestamp info.  For
-@@ -988,7 +1026,8 @@ static void recv_generator(char *fname, 
+@@ -986,7 +1024,8 @@ static void recv_generator(char *fname, 
        static int need_fuzzy_dirlist = 0;
        struct file_struct *fuzzy_file = NULL;
        int fd = -1, f_copy = -1;
@@ -1679,7 +1670,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        struct file_struct *back_file = NULL;
        int statret, real_ret, stat_errno;
        char *fnamecmp, *partialptr, *backupptr = NULL;
-@@ -1044,6 +1083,9 @@ static void recv_generator(char *fname, 
+@@ -1042,6 +1081,9 @@ static void recv_generator(char *fname, 
                } else if (!dry_run)
                        return;
        }
@@ -1689,7 +1680,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        if (dry_run > 1) {
                statret = -1;
                stat_errno = ENOENT;
-@@ -1051,7 +1093,7 @@ static void recv_generator(char *fname, 
+@@ -1049,7 +1091,7 @@ static void recv_generator(char *fname, 
                const char *dn = file->dirname ? file->dirname : ".";
                if (parent_dirname != dn && strcmp(parent_dirname, dn) != 0) {
                        if (relative_paths && !implied_dirs
@@ -1698,7 +1689,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                         && create_directory_path(fname) < 0) {
                                rsyserr(FERROR, errno,
                                        "recv_generator: mkdir %s failed",
-@@ -1063,6 +1105,10 @@ static void recv_generator(char *fname, 
+@@ -1061,6 +1103,10 @@ static void recv_generator(char *fname, 
                        }
                        if (fuzzy_basis)
                                need_fuzzy_dirlist = 1;
@@ -1709,7 +1700,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
                parent_dirname = dn;
  
-@@ -1072,7 +1118,7 @@ static void recv_generator(char *fname, 
+@@ -1070,7 +1116,7 @@ static void recv_generator(char *fname, 
                        need_fuzzy_dirlist = 0;
                }
  
@@ -1718,7 +1709,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                    keep_dirlinks && S_ISDIR(file->mode));
                stat_errno = errno;
        }
-@@ -1090,8 +1136,9 @@ static void recv_generator(char *fname, 
+@@ -1088,8 +1134,9 @@ static void recv_generator(char *fname, 
         * mode based on the local permissions and some heuristics. */
        if (!preserve_perms) {
                int exists = statret == 0
@@ -1730,7 +1721,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        }
  
        if (S_ISDIR(file->mode)) {
-@@ -1100,8 +1147,8 @@ static void recv_generator(char *fname, 
+@@ -1098,8 +1145,8 @@ static void recv_generator(char *fname, 
                 * file of that name and it is *not* a directory, then
                 * we need to delete it.  If it doesn't exist, then
                 * (perhaps recursively) create it. */
@@ -1741,7 +1732,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                return;
                        statret = -1;
                }
-@@ -1110,14 +1157,14 @@ static void recv_generator(char *fname, 
+@@ -1108,14 +1155,14 @@ static void recv_generator(char *fname, 
                        dry_run++;
                }
                real_ret = statret;
@@ -1758,7 +1749,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                              itemizing, maybe_ATTRS_REPORT, code);
                        if (j == -2) {
                                itemizing = 0;
-@@ -1126,7 +1173,11 @@ static void recv_generator(char *fname, 
+@@ -1124,7 +1171,11 @@ static void recv_generator(char *fname, 
                                statret = 1;
                }
                if (itemizing && f_out != -1) {
@@ -1771,7 +1762,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
                }
                if (real_ret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) {
-@@ -1146,21 +1197,21 @@ static void recv_generator(char *fname, 
+@@ -1144,21 +1195,21 @@ static void recv_generator(char *fname, 
                                return;
                        }
                }
@@ -1790,7 +1781,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +              goto cleanup;
        }
  
-       if (preserve_hard_links && IS_HLINKED(file)
+       if (preserve_hard_links && F_IS_HLINKED(file)
 -          && hard_link_check(file, ndx, fname, statret, &st,
 +          && hard_link_check(file, ndx, fname, statret, &sx,
                               itemizing, code, HL_CHECK_MASTER))
@@ -1799,7 +1790,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
        if (preserve_links && S_ISLNK(file->mode)) {
  #ifdef SUPPORT_LINKS
-@@ -1179,14 +1230,14 @@ static void recv_generator(char *fname, 
+@@ -1177,14 +1228,14 @@ static void recv_generator(char *fname, 
                        char lnk[MAXPATHLEN];
                        int len;
  
@@ -1814,10 +1805,10 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 -                              set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
 +                                      itemize(file, ndx, 0, &sx, 0, 0, NULL);
 +                              set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
-                               if (preserve_hard_links && IS_HLINKED(file))
+                               if (preserve_hard_links && F_IS_HLINKED(file))
                                        hard_link_cluster(file, ndx, itemizing, code, -1);
                                if (remove_source_files == 1)
-@@ -1195,10 +1246,10 @@ static void recv_generator(char *fname, 
+@@ -1193,10 +1244,10 @@ static void recv_generator(char *fname, 
                        }
                        /* Not the right symlink (or not a symlink), so
                         * delete it. */
@@ -1830,16 +1821,16 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                              itemizing, maybe_ATTRS_REPORT, code);
                        if (j == -2) {
  #ifndef CAN_HARDLINK_SYMLINK
-@@ -1214,7 +1265,7 @@ static void recv_generator(char *fname, 
+@@ -1212,7 +1263,7 @@ static void recv_generator(char *fname, 
                                statret = 1;
                }
-               if (preserve_hard_links && IS_HLINKED(file)
+               if (preserve_hard_links && F_IS_HLINKED(file)
 -                  && hard_link_check(file, ndx, fname, -1, &st,
 +                  && hard_link_check(file, ndx, fname, -1, &sx,
                                       itemizing, code, HL_SKIP))
                        return;
                if (do_symlink(sl, fname) != 0) {
-@@ -1223,7 +1274,7 @@ static void recv_generator(char *fname, 
+@@ -1221,7 +1272,7 @@ static void recv_generator(char *fname, 
                } else {
                        set_file_attrs(fname, file, NULL, 0);
                        if (itemizing) {
@@ -1848,7 +1839,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                        ITEM_LOCAL_CHANGE, 0, NULL);
                        }
                        if (code != FNONE && verbose)
-@@ -1246,31 +1297,36 @@ static void recv_generator(char *fname, 
+@@ -1244,31 +1295,36 @@ static void recv_generator(char *fname, 
                if (statret == 0) {
                        char *t;
                        if (IS_DEVICE(file->mode)) {
@@ -1879,7 +1870,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +                                      itemize(file, ndx, 0, &sx, 0, 0, NULL);
 +                              }
 +                              set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
-                               if (preserve_hard_links && IS_HLINKED(file))
+                               if (preserve_hard_links && F_IS_HLINKED(file))
                                        hard_link_cluster(file, ndx, itemizing, code, -1);
                                if (remove_source_files == 1)
                                        goto return_with_success;
@@ -1895,16 +1886,16 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                              itemizing, maybe_ATTRS_REPORT, code);
                        if (j == -2) {
  #ifndef CAN_HARDLINK_SPECIAL
-@@ -1286,7 +1342,7 @@ static void recv_generator(char *fname, 
+@@ -1284,7 +1340,7 @@ static void recv_generator(char *fname, 
                                statret = 1;
                }
-               if (preserve_hard_links && IS_HLINKED(file)
+               if (preserve_hard_links && F_IS_HLINKED(file)
 -                  && hard_link_check(file, ndx, fname, -1, &st,
 +                  && hard_link_check(file, ndx, fname, -1, &sx,
                                       itemizing, code, HL_SKIP))
                        return;
                if (verbose > 2) {
-@@ -1299,7 +1355,11 @@ static void recv_generator(char *fname, 
+@@ -1297,7 +1353,11 @@ static void recv_generator(char *fname, 
                } else {
                        set_file_attrs(fname, file, NULL, 0);
                        if (itemizing) {
@@ -1917,7 +1908,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                        ITEM_LOCAL_CHANGE, 0, NULL);
                        }
                        if (code != FNONE && verbose)
-@@ -1309,7 +1369,7 @@ static void recv_generator(char *fname, 
+@@ -1307,7 +1367,7 @@ static void recv_generator(char *fname, 
                        if (remove_source_files == 1)
                                goto return_with_success;
                }
@@ -1926,7 +1917,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        }
  
        if (!S_ISREG(file->mode)) {
-@@ -1343,7 +1403,7 @@ static void recv_generator(char *fname, 
+@@ -1341,7 +1401,7 @@ static void recv_generator(char *fname, 
        }
  
        if (update_only && statret == 0
@@ -1935,7 +1926,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                if (verbose > 1)
                        rprintf(FINFO, "%s is newer\n", fname);
                return;
-@@ -1352,20 +1412,20 @@ static void recv_generator(char *fname, 
+@@ -1350,20 +1410,20 @@ static void recv_generator(char *fname, 
        fnamecmp = fname;
        fnamecmp_type = FNAMECMP_FNAME;
  
@@ -1960,7 +1951,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
                if (j >= 0) {
                        fnamecmp = fnamecmpbuf;
-@@ -1375,7 +1435,7 @@ static void recv_generator(char *fname, 
+@@ -1373,7 +1433,7 @@ static void recv_generator(char *fname, 
        }
  
        real_ret = statret;
@@ -1969,30 +1960,30 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
        if (partial_dir && (partialptr = partial_dir_fname(fname)) != NULL
            && link_stat(partialptr, &partial_st, 0) == 0
-@@ -1394,7 +1454,7 @@ static void recv_generator(char *fname, 
+@@ -1392,7 +1452,7 @@ static void recv_generator(char *fname, 
                                rprintf(FINFO, "fuzzy basis selected for %s: %s\n",
                                        fname, fnamecmpbuf);
                        }
--                      st.st_size = fuzzy_file->length;
-+                      sx.st.st_size = fuzzy_file->length;
+-                      st.st_size = F_LENGTH(fuzzy_file);
++                      sx.st.st_size = F_LENGTH(fuzzy_file);
                        statret = 0;
                        fnamecmp = fnamecmpbuf;
                        fnamecmp_type = FNAMECMP_FUZZY;
-@@ -1403,7 +1463,7 @@ static void recv_generator(char *fname, 
+@@ -1401,7 +1461,7 @@ static void recv_generator(char *fname, 
  
        if (statret != 0) {
-               if (preserve_hard_links && IS_HLINKED(file)
+               if (preserve_hard_links && F_IS_HLINKED(file)
 -                  && hard_link_check(file, ndx, fname, statret, &st,
 +                  && hard_link_check(file, ndx, fname, statret, &sx,
                                       itemizing, code, HL_SKIP))
                        return;
                if (stat_errno == ENOENT)
-@@ -1413,36 +1473,49 @@ static void recv_generator(char *fname, 
+@@ -1411,36 +1471,49 @@ static void recv_generator(char *fname, 
                return;
        }
  
--      if (append_mode && st.st_size > file->length)
-+      if (append_mode && sx.st.st_size > file->length)
+-      if (append_mode && st.st_size > F_LENGTH(file))
++      if (append_mode && sx.st.st_size > F_LENGTH(file))
                return;
  
        if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
@@ -2025,7 +2016,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
 -              set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
 +              set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
-               if (preserve_hard_links && IS_HLINKED(file))
+               if (preserve_hard_links && F_IS_HLINKED(file))
                        hard_link_cluster(file, ndx, itemizing, code, -1);
                if (remove_source_files != 1)
 -                      return;
@@ -2044,10 +2035,10 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                fnamecmp = partialptr;
                fnamecmp_type = FNAMECMP_PARTIAL_DIR;
                statret = 0;
-@@ -1466,17 +1539,21 @@ static void recv_generator(char *fname, 
+@@ -1464,17 +1537,21 @@ static void recv_generator(char *fname, 
          pretend_missing:
                /* pretend the file didn't exist */
-               if (preserve_hard_links && IS_HLINKED(file)
+               if (preserve_hard_links && F_IS_HLINKED(file)
 -                  && hard_link_check(file, ndx, fname, statret, &st,
 +                  && hard_link_check(file, ndx, fname, statret, &sx,
                                       itemizing, code, HL_SKIP))
@@ -2069,7 +2060,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
                if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) {
                        close(fd);
-@@ -1487,7 +1564,7 @@ static void recv_generator(char *fname, 
+@@ -1485,7 +1562,7 @@ static void recv_generator(char *fname, 
                                full_fname(backupptr));
                        unmake_file(back_file);
                        close(fd);
@@ -2078,7 +2069,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
                if ((f_copy = do_open(backupptr,
                    O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0) {
-@@ -1495,14 +1572,14 @@ static void recv_generator(char *fname, 
+@@ -1493,14 +1570,14 @@ static void recv_generator(char *fname, 
                                full_fname(backupptr));
                        unmake_file(back_file);
                        close(fd);
@@ -2095,7 +2086,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        }
  
        if (verbose > 2)
-@@ -1520,24 +1597,32 @@ static void recv_generator(char *fname, 
+@@ -1518,24 +1595,32 @@ static void recv_generator(char *fname, 
                        iflags |= ITEM_BASIS_TYPE_FOLLOWS;
                if (fnamecmp_type == FNAMECMP_FUZZY)
                        iflags |= ITEM_XNAME_FOLLOWS;
@@ -2105,7 +2096,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +                      get_acl(fnamecmp, &real_sx);
 +#endif
 +              itemize(file, -1, real_ret, &real_sx, iflags, fnamecmp_type,
-                       fuzzy_file ? fuzzy_file->basename : NULL);
+                       fuzzy_file ? F_BASENAME(fuzzy_file) : NULL);
 +#ifdef SUPPORT_ACLS
 +              if (preserve_acls)
 +                      free_acl(&real_sx);
@@ -2113,7 +2104,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        }
  
        if (!do_xfers) {
-               if (preserve_hard_links && IS_HLINKED(file))
+               if (preserve_hard_links && F_IS_HLINKED(file))
                        hard_link_cluster(file, ndx, itemizing, code, -1);
 -              return;
 +              goto cleanup;
@@ -2133,7 +2124,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
        if (f_copy >= 0) {
                close(f_copy);
-@@ -1550,6 +1635,13 @@ static void recv_generator(char *fname, 
+@@ -1548,6 +1633,13 @@ static void recv_generator(char *fname, 
        }
  
        close(fd);
@@ -2147,7 +2138,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  }
  
  void generate_files(int f_out, struct file_list *flist, char *local_name)
-@@ -1611,6 +1703,8 @@ void generate_files(int f_out, struct fi
+@@ -1609,6 +1701,8 @@ void generate_files(int f_out, struct fi
         * notice that and let us know via the redo pipe (or its closing). */
        ignore_timeout = 1;
  
@@ -2164,9 +2155,9 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern int link_dest;
 +extern int preserve_acls;
  extern int make_backups;
- extern int flist_extra_ndx;
  extern int remove_source_files;
-@@ -155,15 +156,19 @@ void init_hard_links(void)
+ extern int stdout_format_has_i;
+@@ -154,15 +155,19 @@ void init_hard_links(void)
  
  #ifdef SUPPORT_HARD_LINKS
  static int maybe_hard_link(struct file_struct *file, int ndx,
@@ -2190,7 +2181,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                        ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
                                        0, "");
                        }
-@@ -178,13 +183,13 @@ static int maybe_hard_link(struct file_s
+@@ -177,13 +182,13 @@ static int maybe_hard_link(struct file_s
                        return -1;
                }
        }
@@ -2206,7 +2197,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                    enum logcode code, int skip)
  {
  #ifdef SUPPORT_HARD_LINKS
-@@ -228,7 +233,7 @@ int hard_link_check(struct file_struct *
+@@ -227,7 +232,7 @@ int hard_link_check(struct file_struct *
                                                 || st2.st_ino != st3.st_ino)
                                                        continue;
                                                statret = 1;
@@ -2215,7 +2206,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                                if (verbose < 2 || !stdout_format_has_i) {
                                                        itemizing = 0;
                                                        code = FNONE;
-@@ -238,12 +243,16 @@ int hard_link_check(struct file_struct *
+@@ -237,12 +242,16 @@ int hard_link_check(struct file_struct *
                                        if (!unchanged_file(cmpbuf, file, &st3))
                                                continue;
                                        statret = 1;
@@ -2235,7 +2226,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                        toname, &st2, itemizing, code);
                        if (remove_source_files == 1 && do_xfers)
                                send_msg_int(MSG_SUCCESS, ndx);
-@@ -258,7 +267,7 @@ int hard_link_check(struct file_struct *
+@@ -257,7 +266,7 @@ int hard_link_check(struct file_struct *
  
  #ifdef SUPPORT_HARD_LINKS
  int hard_link_one(struct file_struct *file, int ndx, char *fname,
@@ -2244,7 +2235,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                  int itemizing, enum logcode code)
  {
        if (do_link(toname, fname)) {
-@@ -274,7 +283,11 @@ int hard_link_one(struct file_struct *fi
+@@ -273,7 +282,11 @@ int hard_link_one(struct file_struct *fi
        }
  
        if (itemizing) {
@@ -2257,7 +2248,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
                        terse ? "" : toname);
        }
-@@ -291,14 +304,15 @@ void hard_link_cluster(struct file_struc
+@@ -290,14 +303,15 @@ void hard_link_cluster(struct file_struc
  #ifdef SUPPORT_HARD_LINKS
        char hlink1[MAXPATHLEN];
        char *hlink2;
@@ -2275,7 +2266,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                return;
        if (!(file->flags & FLAG_HLINK_FIRST)) {
                while (!(file->flags & FLAG_HLINK_LAST)) {
-@@ -314,9 +328,13 @@ void hard_link_cluster(struct file_struc
+@@ -313,9 +327,13 @@ void hard_link_cluster(struct file_struc
                if (hl->hlindex != SKIPPED_LINK)
                        continue;
                hlink2 = f_name(file, NULL);
@@ -5591,7 +5582,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +#endif /* SUPPORT_ACLS */
 --- old/log.c
 +++ new/log.c
-@@ -618,8 +618,10 @@ static void log_formatted(enum logcode c
+@@ -625,8 +625,10 @@ static void log_formatted(enum logcode c
                        c[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
                        c[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
                        c[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
@@ -5699,11 +5690,11 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        /* A large opt value means that set_refuse_options()
                         * turned this option off. */
 @@ -1223,6 +1253,8 @@ int parse_arguments(int *argc, const cha
-               preserve_uid = flist_extra_ndx++;
+               preserve_uid = ++flist_extra_cnt;
        if (preserve_gid)
-               preserve_gid = flist_extra_ndx++;
+               preserve_gid = ++flist_extra_cnt;
 +      if (preserve_acls)
-+              preserve_acls = flist_extra_ndx++;
++              preserve_acls = ++flist_extra_cnt;
  
        *argv = poptGetArgs(pc);
        *argc = count_args(*argv);
@@ -5720,7 +5711,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        if (preserve_gid)
 --- old/receiver.c
 +++ new/receiver.c
-@@ -48,6 +48,7 @@ extern int keep_partial;
+@@ -47,6 +47,7 @@ extern int keep_partial;
  extern int checksum_seed;
  extern int inplace;
  extern int delay_updates;
@@ -5728,7 +5719,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern struct stats stats;
  extern char *stdout_format;
  extern char *tmpdir;
-@@ -348,6 +349,10 @@ int recv_files(int f_in, struct file_lis
+@@ -347,6 +348,10 @@ int recv_files(int f_in, struct file_lis
        int itemizing = am_server ? logfile_format_has_i : stdout_format_has_i;
        enum logcode log_code = log_before_transfer ? FLOG : FINFO;
        int max_phase = protocol_version >= 29 ? 2 : 1;
@@ -5739,7 +5730,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        int i, recv_ok;
  
        if (verbose > 2)
-@@ -551,7 +556,16 @@ int recv_files(int f_in, struct file_lis
+@@ -550,7 +555,16 @@ int recv_files(int f_in, struct file_lis
                 * mode based on the local permissions and some heuristics. */
                if (!preserve_perms) {
                        int exists = fd1 != -1;
@@ -5948,7 +5939,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
 --- old/rsync.h
 +++ new/rsync.h
-@@ -495,6 +495,14 @@ struct idev {
+@@ -496,6 +496,14 @@ struct idev {
  #define IN_LOOPBACKNET 127
  #endif
  
@@ -5963,20 +5954,20 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #define GID_NONE ((gid_t)-1)
  
  #define HL_CHECK_MASTER       0
-@@ -540,10 +548,12 @@ union flist_extras {
- /* When enabled, all entries have these: */
- #define F_UID(f) FLIST_EXTRA(f, preserve_uid).uid
- #define F_GID(f) FLIST_EXTRA(f, preserve_gid).gid
-+#define F_ACL(f) FLIST_EXTRA(f, preserve_acls).num
+@@ -551,10 +559,12 @@ extern int preserve_gid;
+ /* When the associated option is on, all entries will have these present: */
+ #define F_UID(f) REQ_EXTRA(f, preserve_uid)->uid
+ #define F_GID(f) REQ_EXTRA(f, preserve_gid)->gid
++#define F_ACL(f) REQ_EXTRA(f, preserve_acls)->unum
  
  /* These are per-entry optional and mutally exclusive: */
- #define F_IDEV(f) FLIST_EXTRA(f, flist_extra_ndx).idev
- #define F_HLIST(f) FLIST_EXTRA(f, flist_extra_ndx).hlist
-+#define F_DEFACL(f) FLIST_EXTRA(f, flist_extra_ndx).num
+ #define F_IDEV(f)  OPT_EXTRA(f, LEN64_BUMP(f))->idev
+ #define F_HLIST(f) OPT_EXTRA(f, LEN64_BUMP(f))->hlist
++#define F_DEFACL(f) OPT_EXTRA(f, LEN64_BUMP(f))->unum
  
- /* These are per-entry optional, but always both or neither: */
- #define F_DMAJOR(f) FLIST_EXTRA(f, flist_extra_ndx + (IS_HLINKED(f)? 1 : 0)).num
-@@ -667,6 +677,17 @@ struct stats {
+ /* These are per-entry optional, but always both or neither:
+  * (Note: a device doesn't need to use LEN64_BUMP(f).) */
+@@ -689,6 +699,17 @@ struct stats {
  
  struct chmod_mode_struct;
  
@@ -5994,7 +5985,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #include "byteorder.h"
  #include "lib/mdfour.h"
  #include "lib/wildmatch.h"
-@@ -685,6 +706,16 @@ struct chmod_mode_struct;
+@@ -707,6 +728,16 @@ struct chmod_mode_struct;
  #define NORETURN __attribute__((__noreturn__))
  #endif