Fixed failing hunks.
authorWayne Davison <wayned@samba.org>
Sun, 17 Dec 2006 01:04:09 +0000 (01:04 +0000)
committerWayne Davison <wayned@samba.org>
Sun, 17 Dec 2006 01:04:09 +0000 (01:04 +0000)
acls.diff
atimes.diff
flags.diff
xattrs.diff

index 698da2c..5bd3571 100644 (file)
--- a/acls.diff
+++ b/acls.diff
@@ -1221,6 +1221,17 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                        /* If someone has hard-linked the file into the backup
                         * dir, rename() might return success but do nothing! */
                        robust_unlink(fname); /* Just in case... */
+--- old/compat.c
++++ new/compat.c
+@@ -48,6 +48,8 @@ void setup_protocol(int f_out,int f_in)
+               preserve_uid = ++flist_extra_cnt;
+       if (preserve_gid)
+               preserve_gid = ++flist_extra_cnt;
++      if (preserve_acls && !am_sender)
++              preserve_acls = ++flist_extra_cnt;
+       if (remote_protocol == 0) {
+               if (!read_batch)
 --- old/configure.in
 +++ new/configure.in
 @@ -537,6 +537,11 @@ if test x"$ac_cv_func_strcasecmp" = x"no
@@ -1324,7 +1335,7 @@ 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;
-@@ -148,6 +149,8 @@ static void list_file_entry(struct file_
+@@ -147,6 +148,8 @@ static void list_file_entry(struct file_
        permstring(permbuf, f->mode);
        len = F_LENGTH(f);
  
@@ -1333,7 +1344,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #ifdef SUPPORT_LINKS
        if (preserve_links && S_ISLNK(f->mode)) {
                rprintf(FINFO, "%s %11.0f %s %s -> %s\n",
-@@ -663,6 +666,12 @@ static struct file_struct *recv_file_ent
+@@ -662,6 +665,12 @@ static struct file_struct *recv_file_ent
        }
  #endif
  
@@ -1346,7 +1357,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        if (always_checksum && S_ISREG(mode))
                extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
  
-@@ -793,6 +802,11 @@ static struct file_struct *recv_file_ent
+@@ -799,6 +808,11 @@ static struct file_struct *recv_file_ent
                        read_buf(f, bp, checksum_len);
        }
  
@@ -1358,7 +1369,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        return file;
  }
  
-@@ -1062,6 +1076,9 @@ static struct file_struct *send_file_nam
+@@ -1068,6 +1082,9 @@ static struct file_struct *send_file_nam
                                          unsigned short flags)
  {
        struct file_struct *file;
@@ -1368,7 +1379,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);
-@@ -1071,12 +1088,26 @@ static struct file_struct *send_file_nam
+@@ -1077,12 +1094,26 @@ static struct file_struct *send_file_nam
        if (chmod_modes && !S_ISLNK(file->mode))
                file->mode = tweak_mode(file->mode, chmod_modes);
  
@@ -2149,7 +2160,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  extern int make_backups;
  extern int protocol_version;
  extern int remove_source_files;
-@@ -334,15 +335,19 @@ void match_hard_links(void)
+@@ -269,15 +270,19 @@ void match_hard_links(void)
  }
  
  static int maybe_hard_link(struct file_struct *file, int ndx,
@@ -2173,7 +2184,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                        ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
                                        0, "");
                        }
-@@ -363,7 +368,11 @@ static int maybe_hard_link(struct file_s
+@@ -298,7 +303,11 @@ static int maybe_hard_link(struct file_s
  
        if (hard_link_one(file, fname, oldname, 0)) {
                if (itemizing) {
@@ -2186,7 +2197,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                                ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
                                realname);
                }
-@@ -377,7 +386,7 @@ static int maybe_hard_link(struct file_s
+@@ -312,7 +321,7 @@ static int maybe_hard_link(struct file_s
  /* Only called if FLAG_HLINKED is set and FLAG_HLINK_FIRST is not.  Returns:
   * 0 = process the file, 1 = skip the file, -1 = error occurred. */
  int hard_link_check(struct file_struct *file, int ndx, const char *fname,
@@ -2195,7 +2206,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                    enum logcode code)
  {
        STRUCT_STAT prev_st;
-@@ -428,18 +437,20 @@ int hard_link_check(struct file_struct *
+@@ -363,18 +372,20 @@ int hard_link_check(struct file_struct *
        if (statret < 0 && basis_dir[0] != NULL) {
                /* If we match an alt-dest item, we don't output this as a change. */
                char cmpbuf[MAXPATHLEN];
@@ -2221,7 +2232,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;
-@@ -448,16 +459,36 @@ int hard_link_check(struct file_struct *
+@@ -383,16 +394,36 @@ int hard_link_check(struct file_struct *
                                }
                                break;
                        }
@@ -2262,7 +2273,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                            realname, itemizing, code) < 0)
                return -1;
  
-@@ -492,7 +523,8 @@ void finish_hard_link(struct file_struct
+@@ -427,7 +458,8 @@ void finish_hard_link(struct file_struct
                      STRUCT_STAT *stp, int itemizing, enum logcode code,
                      int alt_dest)
  {
@@ -2272,7 +2283,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        char alt_name[MAXPATHLEN], *prev_name;
        const char *our_name;
        int prev_statret, ndx, prev_ndx = F_HL_PREV(file);
-@@ -516,14 +548,24 @@ void finish_hard_link(struct file_struct
+@@ -451,14 +483,24 @@ void finish_hard_link(struct file_struct
        } else
                our_name = fname;
  
@@ -5622,7 +5633,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  int preserve_perms = 0;
  int preserve_executability = 0;
  int preserve_devices = 0;
-@@ -199,6 +200,7 @@ static void print_rsync_version(enum log
+@@ -198,6 +199,7 @@ static void print_rsync_version(enum log
        char const *got_socketpair = "no ";
        char const *have_inplace = "no ";
        char const *hardlinks = "no ";
@@ -5630,7 +5641,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        char const *links = "no ";
        char const *ipv6 = "no ";
        STRUCT_STAT *dumstat;
-@@ -215,6 +217,10 @@ static void print_rsync_version(enum log
+@@ -214,6 +216,10 @@ static void print_rsync_version(enum log
        hardlinks = "";
  #endif
  
@@ -5641,7 +5652,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #ifdef SUPPORT_LINKS
        links = "";
  #endif
-@@ -233,8 +239,8 @@ static void print_rsync_version(enum log
+@@ -232,8 +238,8 @@ static void print_rsync_version(enum log
                (int)(sizeof (int64) * 8));
        rprintf(f, "    %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
                got_socketpair, hardlinks, links, ipv6, have_inplace);
@@ -5652,7 +5663,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
  #ifdef MAINTAINER_MODE
        rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -280,7 +286,7 @@ void usage(enum logcode F)
+@@ -279,7 +285,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");
@@ -5661,7 +5672,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
    rprintf(F,"     --no-OPTION             turn off an implied OPTION (e.g. --no-D)\n");
    rprintf(F," -r, --recursive             recurse into directories\n");
    rprintf(F," -R, --relative              use relative path names\n");
-@@ -302,6 +308,9 @@ void usage(enum logcode F)
+@@ -301,6 +307,9 @@ void usage(enum logcode F)
    rprintf(F," -p, --perms                 preserve permissions\n");
    rprintf(F," -E, --executability         preserve the file's executability\n");
    rprintf(F,"     --chmod=CHMOD           affect file and/or directory permissions\n");
@@ -5671,7 +5682,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
    rprintf(F," -o, --owner                 preserve owner (super-user only)\n");
    rprintf(F," -g, --group                 preserve group\n");
    rprintf(F,"     --devices               preserve device files (super-user only)\n");
-@@ -422,6 +431,9 @@ static struct poptOption long_options[] 
+@@ -421,6 +430,9 @@ static struct poptOption long_options[] 
    {"no-perms",         0,  POPT_ARG_VAL,    &preserve_perms, 0, 0, 0 },
    {"no-p",             0,  POPT_ARG_VAL,    &preserve_perms, 0, 0, 0 },
    {"executability",   'E', POPT_ARG_NONE,   &preserve_executability, 0, 0, 0 },
@@ -5681,7 +5692,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
    {"times",           't', POPT_ARG_VAL,    &preserve_times, 1, 0, 0 },
    {"no-times",         0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
    {"no-t",             0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
-@@ -1087,6 +1099,24 @@ int parse_arguments(int *argc, const cha
+@@ -1086,6 +1098,24 @@ int parse_arguments(int *argc, const cha
                        usage(FINFO);
                        exit_cleanup(0);
  
@@ -5706,16 +5717,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                default:
                        /* 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_cnt;
-       if (preserve_gid)
-               preserve_gid = ++flist_extra_cnt;
-+      if (preserve_acls)
-+              preserve_acls = ++flist_extra_cnt;
-       *argv = poptGetArgs(pc);
-       *argc = count_args(*argv);
-@@ -1534,6 +1566,10 @@ void server_options(char **args,int *arg
+@@ -1528,6 +1558,10 @@ void server_options(char **args,int *arg
  
        if (preserve_hard_links)
                argstr[x++] = 'H';
@@ -5956,7 +5958,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
 --- old/rsync.h
 +++ new/rsync.h
-@@ -508,6 +508,14 @@ struct idev_node {
+@@ -503,6 +503,14 @@ struct idev_node {
  #define IN_LOOPBACKNET 127
  #endif
  
@@ -5971,21 +5973,20 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  #define GID_NONE ((gid_t)-1)
  
  union file_extras {
-@@ -559,11 +567,13 @@ extern int preserve_gid;
+@@ -554,10 +562,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_UID(f) REQ_EXTRA(f, preserve_uid)->unum
+ #define F_GID(f) REQ_EXTRA(f, preserve_gid)->unum
 +#define F_ACL(f) REQ_EXTRA(f, preserve_acls)->unum
  
  /* These items are per-entry optional and mutally exclusive: */
- #define F_HL_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev
  #define F_HL_GNUM(f) OPT_EXTRA(f, LEN64_BUMP(f))->num
  #define F_HL_PREV(f) OPT_EXTRA(f, LEN64_BUMP(f))->num
 +#define F_DEF_ACL(f) OPT_EXTRA(f, LEN64_BUMP(f))->unum
  
  /* This optional item might follow an F_HL_*() item.
   * (Note: a device doesn't need to check LEN64_BUMP(f).) */
-@@ -699,6 +709,17 @@ struct stats {
+@@ -693,6 +703,17 @@ struct stats {
  
  struct chmod_mode_struct;
  
@@ -6003,7 +6004,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"
-@@ -717,6 +738,16 @@ struct chmod_mode_struct;
+@@ -711,6 +732,16 @@ struct chmod_mode_struct;
  #define NORETURN __attribute__((__noreturn__))
  #endif
  
index 79adc3a..377fc0f 100644 (file)
@@ -6,6 +6,17 @@ To use this patch, run these commands for a successful build:
     make
 
 
+--- old/compat.c
++++ new/compat.c
+@@ -48,6 +48,8 @@ void setup_protocol(int f_out,int f_in)
+               preserve_uid = ++flist_extra_cnt;
+       if (preserve_gid)
+               preserve_gid = ++flist_extra_cnt;
++      if (preserve_atimes)
++              preserve_atimes = ++flist_extra_cnt;
+       if (remote_protocol == 0) {
+               if (!read_batch)
 --- old/flist.c
 +++ new/flist.c
 @@ -47,6 +47,7 @@ extern int preserve_devices;
@@ -16,7 +27,7 @@ To use this patch, run these commands for a successful build:
  extern int relative_paths;
  extern int implied_dirs;
  extern int flist_extra_cnt;
-@@ -138,6 +139,7 @@ void show_flist_stats(void)
+@@ -137,6 +138,7 @@ void show_flist_stats(void)
  static void list_file_entry(struct file_struct *f)
  {
        char permbuf[PERMSTRING_SIZE];
@@ -24,7 +35,7 @@ To use this patch, run these commands for a successful build:
        double len;
  
        if (!F_IS_ACTIVE(f)) {
-@@ -150,14 +152,16 @@ static void list_file_entry(struct file_
+@@ -149,14 +151,16 @@ static void list_file_entry(struct file_
  
  #ifdef SUPPORT_LINKS
        if (preserve_links && S_ISLNK(f->mode)) {
@@ -43,7 +54,7 @@ To use this patch, run these commands for a successful build:
                        f_name(f, NULL));
        }
  }
-@@ -315,6 +319,7 @@ static void send_file_entry(struct file_
+@@ -314,6 +318,7 @@ static void send_file_entry(struct file_
  {
        unsigned short flags;
        static time_t modtime;
@@ -51,7 +62,7 @@ To use this patch, run these commands for a successful build:
        static mode_t mode;
        static int64 dev;
        static dev_t rdev;
-@@ -368,6 +373,13 @@ static void send_file_entry(struct file_
+@@ -367,6 +372,13 @@ static void send_file_entry(struct file_
                flags |= XMIT_SAME_TIME;
        else
                modtime = file->modtime;
@@ -64,8 +75,8 @@ To use this patch, run these commands for a successful build:
 +      }
  
  #ifdef SUPPORT_HARD_LINKS
-       if (tmp_idev.dev != 0) {
-@@ -435,6 +447,8 @@ static void send_file_entry(struct file_
+       if (tmp_dev != 0) {
+@@ -434,6 +446,8 @@ static void send_file_entry(struct file_
                write_int(f, modtime);
        if (!(flags & XMIT_SAME_MODE))
                write_int(f, to_wire_mode(mode));
@@ -74,7 +85,7 @@ To use this patch, run these commands for a successful build:
        if (preserve_uid && !(flags & XMIT_SAME_UID)) {
                if (!numeric_ids)
                        add_uid(uid);
-@@ -502,7 +516,7 @@ static void send_file_entry(struct file_
+@@ -501,7 +515,7 @@ static void send_file_entry(struct file_
  static struct file_struct *recv_file_entry(struct file_list *flist,
                                           unsigned short flags, int f)
  {
@@ -83,7 +94,7 @@ To use this patch, run these commands for a successful build:
        static mode_t mode;
        static int64 dev;
        static dev_t rdev;
-@@ -523,7 +537,7 @@ static struct file_struct *recv_file_ent
+@@ -522,7 +536,7 @@ static struct file_struct *recv_file_ent
        struct file_struct *file;
  
        if (!flist) {
@@ -92,7 +103,7 @@ To use this patch, run these commands for a successful build:
                dev = 0, rdev = MAKEDEV(0, 0);
                rdev_major = 0;
                uid = 0, gid = 0;
-@@ -611,6 +625,8 @@ static struct file_struct *recv_file_ent
+@@ -610,6 +624,8 @@ static struct file_struct *recv_file_ent
                modtime = (time_t)read_int(f);
        if (!(flags & XMIT_SAME_MODE))
                mode = from_wire_mode(read_int(f));
@@ -101,7 +112,7 @@ To use this patch, run these commands for a successful build:
  
        if (chmod_modes && !S_ISLNK(mode))
                mode = tweak_mode(mode, chmod_modes);
-@@ -701,6 +717,8 @@ static struct file_struct *recv_file_ent
+@@ -700,6 +716,8 @@ static struct file_struct *recv_file_ent
                F_UID(file) = uid;
        if (preserve_gid)
                F_GID(file) = gid;
@@ -110,7 +121,7 @@ To use this patch, run these commands for a successful build:
  
        if (dirname_len) {
                file->dirname = lastdir = bp;
-@@ -996,6 +1014,8 @@ struct file_struct *make_file(const char
+@@ -1002,6 +1020,8 @@ struct file_struct *make_file(const char
                F_UID(file) = st.st_uid;
        if (preserve_gid)
                F_GID(file) = st.st_gid;
@@ -178,7 +189,7 @@ To use this patch, run these commands for a successful build:
  int update_only = 0;
  int cvs_exclude = 0;
  int dry_run = 0;
-@@ -307,8 +308,9 @@ void usage(enum logcode F)
+@@ -306,8 +307,9 @@ void usage(enum logcode F)
    rprintf(F,"     --devices               preserve device files (super-user only)\n");
    rprintf(F,"     --specials              preserve special files\n");
    rprintf(F," -D                          same as --devices --specials\n");
@@ -190,7 +201,7 @@ To use this patch, run these commands for a successful build:
    rprintf(F,"     --super                 receiver attempts super-user activities\n");
    rprintf(F," -S, --sparse                handle sparse files efficiently\n");
    rprintf(F," -n, --dry-run               show what would have been transferred\n");
-@@ -425,6 +427,9 @@ static struct poptOption long_options[] 
+@@ -424,6 +426,9 @@ static struct poptOption long_options[] 
    {"times",           't', POPT_ARG_VAL,    &preserve_times, 1, 0, 0 },
    {"no-times",         0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
    {"no-t",             0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
@@ -200,16 +211,7 @@ To use this patch, run these commands for a successful build:
    {"omit-dir-times",  'O', POPT_ARG_VAL,    &omit_dir_times, 2, 0, 0 },
    {"modify-window",    0,  POPT_ARG_INT,    &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
    {"super",            0,  POPT_ARG_VAL,    &am_root, 2, 0, 0 },
-@@ -1223,6 +1228,8 @@ int parse_arguments(int *argc, const cha
-               preserve_uid = ++flist_extra_cnt;
-       if (preserve_gid)
-               preserve_gid = ++flist_extra_cnt;
-+      if (preserve_atimes)
-+              preserve_atimes = ++flist_extra_cnt;
-       *argv = poptGetArgs(pc);
-       *argc = count_args(*argv);
-@@ -1542,6 +1549,8 @@ void server_options(char **args,int *arg
+@@ -1536,6 +1541,8 @@ void server_options(char **args,int *arg
                argstr[x++] = 'D';
        if (preserve_times)
                argstr[x++] = 't';
@@ -294,22 +296,22 @@ To use this patch, run these commands for a successful build:
  
  #define FULL_FLUSH    1
  #define NORMAL_FLUSH  0
-@@ -513,6 +515,7 @@ struct idev_node {
- union file_extras {
-       uid_t uid;              /* The user ID number */
-       uid_t gid;              /* The group ID number or GID_NONE */
-+      time_t utime;           /* A unix-time value */
-       struct idev *idev;      /* The hard-link info during matching */
-       int32 num;              /* A signed number */
-       uint32 unum;            /* An unsigned number */
-@@ -559,6 +562,7 @@ extern int preserve_gid;
+@@ -522,6 +524,7 @@ struct file_struct {
+ extern int flist_extra_cnt;
+ extern int preserve_uid;
+ extern int preserve_gid;
++extern int preserve_atimes;
+ #define FILE_STRUCT_LEN (offsetof(struct file_struct, basename))
+ #define EXTRA_LEN (sizeof (union file_extras))
+@@ -554,6 +557,7 @@ 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_ATIME(f) REQ_EXTRA(f, preserve_atimes)->utime
+ #define F_UID(f) REQ_EXTRA(f, preserve_uid)->unum
+ #define F_GID(f) REQ_EXTRA(f, preserve_gid)->unum
++#define F_ATIME(f) REQ_EXTRA(f, preserve_atimes)->unum
  
  /* These items are per-entry optional and mutally exclusive: */
- #define F_HL_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev
+ #define F_HL_GNUM(f) OPT_EXTRA(f, LEN64_BUMP(f))->num
 --- old/rsync.yo
 +++ new/rsync.yo
 @@ -328,8 +328,9 @@ to the detailed description below for a 
index ab0df10..05d4b14 100644 (file)
@@ -10,6 +10,17 @@ To use this patch, run these commands for a successful build:
 
 TODO: fix --delete-delay to work with --flags option.
 
+--- old/compat.c
++++ new/compat.c
+@@ -48,6 +48,8 @@ void setup_protocol(int f_out,int f_in)
+               preserve_uid = ++flist_extra_cnt;
+       if (preserve_gid)
+               preserve_gid = ++flist_extra_cnt;
++      if (preserve_fileflags)
++              preserve_fileflags = ++flist_extra_cnt;
+       if (remote_protocol == 0) {
+               if (!read_batch)
 --- old/configure.in
 +++ new/configure.in
 @@ -549,7 +549,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
@@ -23,7 +34,7 @@ TODO: fix --delete-delay to work with --flags option.
  AC_CHECK_FUNCS(getpgrp tcgetpgrp)
 --- old/flist.c
 +++ new/flist.c
-@@ -44,6 +44,7 @@ extern int preserve_links;
+@@ -45,6 +45,7 @@ extern int preserve_links;
  extern int preserve_hard_links;
  extern int preserve_devices;
  extern int preserve_specials;
@@ -31,7 +42,7 @@ TODO: fix --delete-delay to work with --flags option.
  extern int preserve_uid;
  extern int preserve_gid;
  extern int relative_paths;
-@@ -312,6 +313,9 @@ static void send_file_entry(struct file_
+@@ -315,6 +316,9 @@ static void send_file_entry(struct file_
        unsigned short flags;
        static time_t modtime;
        static mode_t mode;
@@ -41,7 +52,7 @@ TODO: fix --delete-delay to work with --flags option.
        static int64 dev;
        static dev_t rdev;
        static uint32 rdev_major;
-@@ -342,6 +346,12 @@ static void send_file_entry(struct file_
+@@ -333,6 +337,12 @@ static void send_file_entry(struct file_
                flags |= XMIT_SAME_MODE;
        else
                mode = file->mode;
@@ -54,7 +65,7 @@ TODO: fix --delete-delay to work with --flags option.
        if ((preserve_devices && IS_DEVICE(mode))
         || (preserve_specials && IS_SPECIAL(mode))) {
                if (protocol_version < 28) {
-@@ -428,6 +438,10 @@ static void send_file_entry(struct file_
+@@ -434,6 +444,10 @@ static void send_file_entry(struct file_
                write_int(f, modtime);
        if (!(flags & XMIT_SAME_MODE))
                write_int(f, to_wire_mode(mode));
@@ -65,7 +76,7 @@ TODO: fix --delete-delay to work with --flags option.
        if (preserve_uid && !(flags & XMIT_SAME_UID)) {
                if (!numeric_ids)
                        add_uid(uid);
-@@ -496,6 +510,9 @@ static struct file_struct *recv_file_ent
+@@ -503,6 +517,9 @@ static struct file_struct *recv_file_ent
  {
        static time_t modtime;
        static mode_t mode;
@@ -75,7 +86,7 @@ TODO: fix --delete-delay to work with --flags option.
        static int64 dev;
        static dev_t rdev;
        static uint32 rdev_major;
-@@ -570,9 +587,12 @@ static struct file_struct *recv_file_ent
+@@ -610,9 +627,12 @@ static struct file_struct *recv_file_ent
                modtime = (time_t)read_int(f);
        if (!(flags & XMIT_SAME_MODE))
                mode = from_wire_mode(read_int(f));
@@ -89,7 +100,7 @@ TODO: fix --delete-delay to work with --flags option.
  
        if (preserve_uid && !(flags & XMIT_SAME_UID))
                uid = (uid_t)read_int(f);
-@@ -650,6 +670,10 @@ static struct file_struct *recv_file_ent
+@@ -696,6 +716,10 @@ static struct file_struct *recv_file_ent
                OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32);
        }
        file->mode = mode;
@@ -100,7 +111,7 @@ TODO: fix --delete-delay to work with --flags option.
        if (preserve_uid)
                F_UID(file) = uid;
        if (preserve_gid)
-@@ -927,6 +951,10 @@ struct file_struct *make_file(const char
+@@ -998,6 +1022,10 @@ struct file_struct *make_file(const char
                OPT_EXTRA(file, 0)->unum = (uint32)(st.st_size >> 32);
        }
        file->mode = st.st_mode;
@@ -113,7 +124,7 @@ TODO: fix --delete-delay to work with --flags option.
        if (preserve_gid)
 --- old/generator.c
 +++ new/generator.c
-@@ -102,6 +102,12 @@ static char *deldelay_buf = NULL;
+@@ -103,6 +103,12 @@ static char *deldelay_buf = NULL;
  static int deldelay_fd = -1;
  static BOOL solo_file = 0;
  
@@ -126,7 +137,7 @@ TODO: fix --delete-delay to work with --flags option.
  /* For calling delete_item() and delete_dir_contents(). */
  #define DEL_RECURSE           (1<<1) /* recurse */
  #define DEL_DIR_IS_EMPTY      (1<<2) /* internal delete_FUNCTIONS use only */
-@@ -117,7 +123,6 @@ enum delret {
+@@ -118,7 +124,6 @@ enum delret {
  /* Forward declaration for delete_item(). */
  static enum delret delete_dir_contents(char *fname, int flags);
  
@@ -134,7 +145,7 @@ TODO: fix --delete-delay to work with --flags option.
  static int is_backup_file(char *fn)
  {
        int k = strlen(fn) - backup_suffix_len;
-@@ -130,17 +135,20 @@ static int is_backup_file(char *fn)
+@@ -131,17 +136,20 @@ static int is_backup_file(char *fn)
   * Note that fbuf must point to a MAXPATHLEN buffer if the mode indicates it's
   * a directory! (The buffer is used for recursion, but returned unchanged.)
   */
@@ -158,7 +169,7 @@ TODO: fix --delete-delay to work with --flags option.
        if (S_ISDIR(mode) && !(flags & DEL_DIR_IS_EMPTY)) {
                ignore_perishable = 1;
                /* If DEL_RECURSE is not set, this just reports emptiness. */
-@@ -252,7 +260,7 @@ static enum delret delete_dir_contents(c
+@@ -253,7 +261,7 @@ static enum delret delete_dir_contents(c
                if (S_ISDIR(fp->mode)
                 && delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS)
                        ret = DR_NOT_EMPTY;
@@ -167,7 +178,7 @@ TODO: fix --delete-delay to work with --flags option.
                        ret = DR_NOT_EMPTY;
        }
  
-@@ -308,8 +316,9 @@ static int remember_delete(struct file_s
+@@ -309,8 +317,9 @@ static int remember_delete(struct file_s
        
        while (1) {
                len = snprintf(deldelay_buf + deldelay_cnt,
@@ -179,7 +190,7 @@ TODO: fix --delete-delay to work with --flags option.
                if ((deldelay_cnt += len) <= deldelay_size)
                        break;
                if (deldelay_fd < 0 && !start_delete_delay_temp())
-@@ -322,7 +331,7 @@ static int remember_delete(struct file_s
+@@ -323,7 +332,7 @@ static int remember_delete(struct file_s
        return 1;
  }
  
@@ -188,7 +199,7 @@ TODO: fix --delete-delay to work with --flags option.
  {
        static int read_pos = 0;
        int j, len, mode;
-@@ -364,7 +373,7 @@ static int read_delay_line(char *buf)
+@@ -365,7 +374,7 @@ static int read_delay_line(char *buf)
  
        bp = deldelay_buf + read_pos;
  
@@ -197,7 +208,7 @@ TODO: fix --delete-delay to work with --flags option.
          invalid_data:
                rprintf(FERROR, "ERROR: invalid data in delete-delay file.\n");
                return -1;
-@@ -387,15 +396,15 @@ static int read_delay_line(char *buf)
+@@ -388,15 +397,15 @@ static int read_delay_line(char *buf)
  
  static void do_delayed_deletions(char *delbuf)
  {
@@ -216,7 +227,7 @@ TODO: fix --delete-delay to work with --flags option.
        if (deldelay_fd >= 0)
                close(deldelay_fd);
  }
-@@ -476,7 +485,7 @@ static void delete_in_dir(struct file_li
+@@ -477,7 +486,7 @@ static void delete_in_dir(struct file_li
                                if (!remember_delete(fp, delbuf))
                                        break;
                        } else
@@ -225,7 +236,7 @@ TODO: fix --delete-delay to work with --flags option.
                }
        }
  
-@@ -1177,7 +1186,7 @@ static void recv_generator(char *fname, 
+@@ -1181,7 +1190,7 @@ static void recv_generator(char *fname, 
                 * we need to delete it.  If it doesn't exist, then
                 * (perhaps recursively) create it. */
                if (statret == 0 && !S_ISDIR(st.st_mode)) {
@@ -234,7 +245,7 @@ TODO: fix --delete-delay to work with --flags option.
                                return;
                        statret = -1;
                }
-@@ -1275,7 +1284,7 @@ static void recv_generator(char *fname, 
+@@ -1278,7 +1287,7 @@ static void recv_generator(char *fname, 
                        }
                        /* Not the right symlink (or not a symlink), so
                         * delete it. */
@@ -243,7 +254,7 @@ TODO: fix --delete-delay to work with --flags option.
                                return;
                } else if (basis_dir[0] != NULL) {
                        int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
-@@ -1354,7 +1363,7 @@ static void recv_generator(char *fname, 
+@@ -1355,7 +1364,7 @@ static void recv_generator(char *fname, 
                                        goto return_with_success;
                                return;
                        }
@@ -252,7 +263,7 @@ TODO: fix --delete-delay to work with --flags option.
                                return;
                } else if (basis_dir[0] != NULL) {
                        int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
-@@ -1445,7 +1454,7 @@ static void recv_generator(char *fname, 
+@@ -1444,7 +1453,7 @@ static void recv_generator(char *fname, 
        fnamecmp_type = FNAMECMP_FNAME;
  
        if (statret == 0 && !S_ISREG(st.st_mode)) {
@@ -271,7 +282,7 @@ TODO: fix --delete-delay to work with --flags option.
  int preserve_executability = 0;
  int preserve_devices = 0;
  int preserve_specials = 0;
-@@ -201,6 +202,7 @@ static void print_rsync_version(enum log
+@@ -200,6 +201,7 @@ static void print_rsync_version(enum log
        char const *hardlinks = "no ";
        char const *links = "no ";
        char const *ipv6 = "no ";
@@ -279,7 +290,7 @@ TODO: fix --delete-delay to work with --flags option.
        STRUCT_STAT *dumstat;
  
  #ifdef HAVE_SOCKETPAIR
-@@ -223,6 +225,10 @@ static void print_rsync_version(enum log
+@@ -222,6 +224,10 @@ static void print_rsync_version(enum log
        ipv6 = "";
  #endif
  
@@ -290,7 +301,7 @@ TODO: fix --delete-delay to work with --flags option.
        rprintf(f, "%s  version %s  protocol version %d\n",
                RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION);
        rprintf(f, "Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.\n");
-@@ -233,8 +239,8 @@ static void print_rsync_version(enum log
+@@ -232,8 +238,8 @@ static void print_rsync_version(enum log
                (int)(sizeof (int64) * 8));
        rprintf(f, "    %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
                got_socketpair, hardlinks, links, ipv6, have_inplace);
@@ -301,7 +312,7 @@ TODO: fix --delete-delay to work with --flags option.
  
  #ifdef MAINTAINER_MODE
        rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -300,6 +306,7 @@ void usage(enum logcode F)
+@@ -299,6 +305,7 @@ void usage(enum logcode F)
    rprintf(F," -K, --keep-dirlinks         treat symlinked dir on receiver as dir\n");
    rprintf(F," -H, --hard-links            preserve hard links\n");
    rprintf(F," -p, --perms                 preserve permissions\n");
@@ -309,7 +320,7 @@ TODO: fix --delete-delay to work with --flags option.
    rprintf(F," -E, --executability         preserve the file's executability\n");
    rprintf(F,"     --chmod=CHMOD           affect file and/or directory permissions\n");
    rprintf(F," -o, --owner                 preserve owner (super-user only)\n");
-@@ -421,6 +428,8 @@ static struct poptOption long_options[] 
+@@ -420,6 +427,8 @@ static struct poptOption long_options[] 
    {"perms",           'p', POPT_ARG_VAL,    &preserve_perms, 1, 0, 0 },
    {"no-perms",         0,  POPT_ARG_VAL,    &preserve_perms, 0, 0, 0 },
    {"no-p",             0,  POPT_ARG_VAL,    &preserve_perms, 0, 0, 0 },
@@ -318,7 +329,7 @@ TODO: fix --delete-delay to work with --flags option.
    {"executability",   'E', POPT_ARG_NONE,   &preserve_executability, 0, 0, 0 },
    {"times",           't', POPT_ARG_VAL,    &preserve_times, 1, 0, 0 },
    {"no-times",         0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
-@@ -1126,6 +1135,15 @@ int parse_arguments(int *argc, const cha
+@@ -1125,6 +1134,15 @@ int parse_arguments(int *argc, const cha
        }
  #endif
  
@@ -334,16 +345,7 @@ TODO: fix --delete-delay to work with --flags option.
        if (write_batch && read_batch) {
                snprintf(err_buf, sizeof err_buf,
                        "--write-batch and --read-batch can not be used together\n");
-@@ -1223,6 +1241,8 @@ int parse_arguments(int *argc, const cha
-               preserve_uid = ++flist_extra_cnt;
-       if (preserve_gid)
-               preserve_gid = ++flist_extra_cnt;
-+      if (preserve_fileflags)
-+              preserve_fileflags = ++flist_extra_cnt;
-       *argv = poptGetArgs(pc);
-       *argc = count_args(*argv);
-@@ -1585,6 +1605,9 @@ void server_options(char **args,int *arg
+@@ -1579,6 +1597,9 @@ void server_options(char **args,int *arg
        if (xfer_dirs && !recurse && delete_mode && am_sender)
                args[ac++] = "--no-r";
  
@@ -448,15 +450,15 @@ TODO: fix --delete-delay to work with --flags option.
        /* The file was copied, so tweak the perms of the copied file.  If it
 --- old/rsync.h
 +++ new/rsync.h
-@@ -54,6 +54,7 @@
- #define XMIT_HAS_IDEV_DATA (1<<9)
- #define XMIT_SAME_DEV (1<<10)
+@@ -55,6 +55,7 @@
+ #define XMIT_SAME_DEV_pre30 (1<<10)   /* protocols < 30 */
+ #define XMIT_HLINK_FIRST (1<<10)      /* protocols >= 30 */
  #define XMIT_RDEV_MINOR_IS_SMALL (1<<11)
 +#define XMIT_SAME_FLAGS (1<<12)
  
  /* These flags are used in the live flist data. */
  
-@@ -348,6 +349,10 @@ enum msgcode {
+@@ -355,6 +356,10 @@ enum msgcode {
  #define schar char
  #endif
  
@@ -467,14 +469,22 @@ TODO: fix --delete-delay to work with --flags option.
  /* Find a variable that is either exactly 32-bits or longer.
   * If some code depends on 32-bit truncation, it will need to
   * take special action in a "#if SIZEOF_INT32 > 4" section. */
-@@ -553,6 +558,7 @@ extern int preserve_gid;
+@@ -522,6 +527,7 @@ struct file_struct {
+ extern int flist_extra_cnt;
+ extern int preserve_uid;
+ extern int preserve_gid;
++extern int preserve_fileflags;
+ #define FILE_STRUCT_LEN (offsetof(struct file_struct, basename))
+ #define EXTRA_LEN (sizeof (union file_extras))
+@@ -554,6 +560,7 @@ 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_UID(f) REQ_EXTRA(f, preserve_uid)->unum
+ #define F_GID(f) REQ_EXTRA(f, preserve_gid)->unum
 +#define F_FFLAGS(f) REQ_EXTRA(f, preserve_fileflags).num
  
  /* These items are per-entry optional and mutally exclusive: */
- #define F_HL_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev
+ #define F_HL_GNUM(f) OPT_EXTRA(f, LEN64_BUMP(f))->num
 --- old/rsync.yo
 +++ new/rsync.yo
 @@ -321,6 +321,7 @@ to the detailed description below for a 
index 9d474e1..39239b0 100644 (file)
@@ -100,6 +100,17 @@ TODO:
  
        /* Check to see if this is a device file, or link */
        if ((am_root && preserve_devices && IS_DEVICE(file->mode))
+--- old/compat.c
++++ new/compat.c
+@@ -50,6 +50,8 @@ void setup_protocol(int f_out,int f_in)
+               preserve_gid = ++flist_extra_cnt;
+       if (preserve_acls && !am_sender)
+               preserve_acls = ++flist_extra_cnt;
++      if (preserve_xattrs && !am_sender)
++              preserve_xattrs = ++flist_extra_cnt;
+       if (remote_protocol == 0) {
+               if (!read_batch)
 --- old/configure.in
 +++ new/configure.in
 @@ -878,6 +878,40 @@ samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_
@@ -153,7 +164,7 @@ TODO:
  extern int preserve_links;
  extern int preserve_hard_links;
  extern int preserve_devices;
-@@ -806,6 +807,10 @@ static struct file_struct *recv_file_ent
+@@ -812,6 +813,10 @@ static struct file_struct *recv_file_ent
        if (preserve_acls)
                receive_acl(file, f);
  #endif
@@ -164,7 +175,7 @@ TODO:
  
        return file;
  }
-@@ -1076,7 +1081,7 @@ static struct file_struct *send_file_nam
+@@ -1082,7 +1087,7 @@ static struct file_struct *send_file_nam
                                          unsigned short flags)
  {
        struct file_struct *file;
@@ -173,7 +184,7 @@ TODO:
        statx sx;
  #endif
  
-@@ -1096,6 +1101,13 @@ static struct file_struct *send_file_nam
+@@ -1102,6 +1107,13 @@ static struct file_struct *send_file_nam
                        return NULL;
        }
  #endif
@@ -187,7 +198,7 @@ TODO:
  
        maybe_emit_filelist_progress(flist->count + flist_count_offset);
  
-@@ -1107,6 +1119,10 @@ static struct file_struct *send_file_nam
+@@ -1113,6 +1125,10 @@ static struct file_struct *send_file_nam
                if (preserve_acls)
                        send_acl(&sx, f);
  #endif
@@ -375,7 +386,7 @@ TODO:
  int preserve_perms = 0;
  int preserve_executability = 0;
  int preserve_devices = 0;
-@@ -201,6 +202,7 @@ static void print_rsync_version(enum log
+@@ -200,6 +201,7 @@ static void print_rsync_version(enum log
        char const *have_inplace = "no ";
        char const *hardlinks = "no ";
        char const *acls = "no ";
@@ -383,7 +394,7 @@ TODO:
        char const *links = "no ";
        char const *ipv6 = "no ";
        STRUCT_STAT *dumstat;
-@@ -220,7 +222,9 @@ static void print_rsync_version(enum log
+@@ -219,7 +221,9 @@ static void print_rsync_version(enum log
  #ifdef SUPPORT_ACLS
        acls = "";
  #endif
@@ -394,7 +405,7 @@ TODO:
  #ifdef SUPPORT_LINKS
        links = "";
  #endif
-@@ -239,8 +243,8 @@ static void print_rsync_version(enum log
+@@ -238,8 +242,8 @@ static void print_rsync_version(enum log
                (int)(sizeof (int64) * 8));
        rprintf(f, "    %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
                got_socketpair, hardlinks, links, ipv6, have_inplace);
@@ -405,7 +416,7 @@ TODO:
  
  #ifdef MAINTAINER_MODE
        rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -286,7 +290,7 @@ void usage(enum logcode F)
+@@ -285,7 +289,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");
@@ -414,7 +425,7 @@ TODO:
    rprintf(F,"     --no-OPTION             turn off an implied OPTION (e.g. --no-D)\n");
    rprintf(F," -r, --recursive             recurse into directories\n");
    rprintf(F," -R, --relative              use relative path names\n");
-@@ -311,6 +315,9 @@ void usage(enum logcode F)
+@@ -310,6 +314,9 @@ void usage(enum logcode F)
  #ifdef SUPPORT_ACLS
    rprintf(F," -A, --acls                  preserve ACLs (implies --perms)\n");
  #endif
@@ -424,7 +435,7 @@ TODO:
    rprintf(F," -o, --owner                 preserve owner (super-user only)\n");
    rprintf(F," -g, --group                 preserve group\n");
    rprintf(F,"     --devices               preserve device files (super-user only)\n");
-@@ -434,6 +441,9 @@ static struct poptOption long_options[] 
+@@ -433,6 +440,9 @@ static struct poptOption long_options[] 
    {"acls",            'A', POPT_ARG_NONE,   0, 'A', 0, 0 },
    {"no-acls",          0,  POPT_ARG_VAL,    &preserve_acls, 0, 0, 0 },
    {"no-A",             0,  POPT_ARG_VAL,    &preserve_acls, 0, 0, 0 },
@@ -434,7 +445,7 @@ TODO:
    {"times",           't', POPT_ARG_VAL,    &preserve_times, 1, 0, 0 },
    {"no-times",         0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
    {"no-t",             0,  POPT_ARG_VAL,    &preserve_times, 0, 0, 0 },
-@@ -1116,6 +1126,17 @@ int parse_arguments(int *argc, const cha
+@@ -1115,6 +1125,17 @@ int parse_arguments(int *argc, const cha
                        return 0;
  #endif
  
@@ -452,16 +463,7 @@ TODO:
  
                default:
                        /* A large opt value means that set_refuse_options()
-@@ -1255,6 +1276,8 @@ int parse_arguments(int *argc, const cha
-               preserve_gid = ++flist_extra_cnt;
-       if (preserve_acls)
-               preserve_acls = ++flist_extra_cnt;
-+      if (preserve_xattrs)
-+              preserve_xattrs = ++flist_extra_cnt;
-       *argv = poptGetArgs(pc);
-       *argc = count_args(*argv);
-@@ -1570,6 +1593,10 @@ void server_options(char **args,int *arg
+@@ -1562,6 +1583,10 @@ void server_options(char **args,int *arg
        if (preserve_acls)
                argstr[x++] = 'A';
  #endif
@@ -495,7 +497,7 @@ TODO:
         * will enable owner-writability using chmod, if necessary.
 --- old/rsync.h
 +++ new/rsync.h
-@@ -516,6 +516,10 @@ struct idev_node {
+@@ -511,6 +511,10 @@ struct idev_node {
  #define ACLS_NEED_MASK 1
  #endif
  
@@ -506,15 +508,15 @@ TODO:
  #define GID_NONE ((gid_t)-1)
  
  union file_extras {
-@@ -568,6 +572,7 @@ extern int preserve_gid;
- #define F_UID(f) REQ_EXTRA(f, preserve_uid)->uid
- #define F_GID(f) REQ_EXTRA(f, preserve_gid)->gid
+@@ -563,6 +567,7 @@ extern int preserve_gid;
+ #define F_UID(f) REQ_EXTRA(f, preserve_uid)->unum
+ #define F_GID(f) REQ_EXTRA(f, preserve_gid)->unum
  #define F_ACL(f) REQ_EXTRA(f, preserve_acls)->unum
 +#define F_XATTR(f) REQ_EXTRA(f, preserve_xattrs)->unum
  
  /* These items are per-entry optional and mutally exclusive: */
- #define F_HL_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev
-@@ -744,6 +749,9 @@ typedef struct {
+ #define F_HL_GNUM(f) OPT_EXTRA(f, LEN64_BUMP(f))->num
+@@ -738,6 +743,9 @@ typedef struct {
      struct rsync_acl *acc_acl; /* access ACL */
      struct rsync_acl *def_acl; /* default ACL */
  #endif