Adding filter-attribute-mods patch; updating patches.
[rsync/rsync-patches.git] / fileflags.diff
index 39a3895..561e17e 100644 (file)
@@ -8,8 +8,8 @@ To use this patch, run these commands for a successful build:
     ./configure
     make
 
+based-on: 181c9faf928faad08ef095f4667afe460ec3bef6
 diff --git a/Makefile.in b/Makefile.in
-index feacb90..cd4cf2d 100644
 --- a/Makefile.in
 +++ b/Makefile.in
 @@ -43,7 +43,7 @@ popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
@@ -31,7 +31,6 @@ index feacb90..cd4cf2d 100644
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
  
 diff --git a/compat.c b/compat.c
-index 6e00072..ef1882d 100644
 --- a/compat.c
 +++ b/compat.c
 @@ -40,9 +40,11 @@ extern int checksum_seed;
@@ -65,7 +64,6 @@ index 6e00072..ef1882d 100644
                acls_ndx = ++file_extra_cnt;
        if (preserve_xattrs)
 diff --git a/configure.in b/configure.in
-index bc7d4a7..8709fa4 100644
 --- a/configure.in
 +++ b/configure.in
 @@ -553,7 +553,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
@@ -78,7 +76,6 @@ index bc7d4a7..8709fa4 100644
  dnl cygwin iconv.h defines iconv_open as libiconv_open
  if test x"$ac_cv_func_iconv_open" != x"yes"; then
 diff --git a/delete.c b/delete.c
-index 33fdd0e..1c0df57 100644
 --- a/delete.c
 +++ b/delete.c
 @@ -25,6 +25,7 @@
@@ -127,7 +124,6 @@ index 33fdd0e..1c0df57 100644
                /* If DEL_RECURSE is not set, this just reports emptiness. */
                ret = delete_dir_contents(fbuf, flags);
 diff --git a/flist.c b/flist.c
-index 09b4fc5..e1d01be 100644
 --- a/flist.c
 +++ b/flist.c
 @@ -51,6 +51,7 @@ extern int preserve_links;
@@ -161,9 +157,9 @@ index 09b4fc5..e1d01be 100644
 +      }
 +#endif
  
-       if ((preserve_devices && IS_DEVICE(mode))
-        || (preserve_specials && IS_SPECIAL(mode))) {
-@@ -568,6 +580,10 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
+       if (preserve_devices && IS_DEVICE(mode)) {
+               if (protocol_version < 28) {
+@@ -578,6 +590,10 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
        }
        if (!(xflags & XMIT_SAME_MODE))
                write_int(f, to_wire_mode(mode));
@@ -174,7 +170,7 @@ index 09b4fc5..e1d01be 100644
        if (preserve_uid && !(xflags & XMIT_SAME_UID)) {
                if (protocol_version < 30)
                        write_int(f, uid);
-@@ -656,6 +672,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
+@@ -666,6 +682,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
  {
        static int64 modtime;
        static mode_t mode;
@@ -184,7 +180,7 @@ index 09b4fc5..e1d01be 100644
  #ifdef SUPPORT_HARD_LINKS
        static int64 dev;
  #endif
-@@ -796,6 +815,10 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
+@@ -805,6 +824,10 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
  
        if (chmod_modes && !S_ISLNK(mode) && mode)
                mode = tweak_mode(mode, chmod_modes);
@@ -195,7 +191,7 @@ index 09b4fc5..e1d01be 100644
  
        if (preserve_uid && !(xflags & XMIT_SAME_UID)) {
                if (protocol_version < 30)
-@@ -936,6 +959,10 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
+@@ -946,6 +969,10 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
        }
  #endif
        file->mode = mode;
@@ -206,7 +202,7 @@ index 09b4fc5..e1d01be 100644
        if (preserve_uid)
                F_OWNER(file) = uid;
        if (preserve_gid) {
-@@ -1323,6 +1350,10 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1333,6 +1360,10 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
        }
  #endif
        file->mode = st.st_mode;
@@ -217,7 +213,7 @@ index 09b4fc5..e1d01be 100644
        if (uid_ndx) /* Check uid_ndx instead of preserve_uid for del support */
                F_OWNER(file) = st.st_uid;
        if (gid_ndx) /* Check gid_ndx instead of preserve_gid for del support */
-@@ -1466,6 +1497,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
+@@ -1476,6 +1507,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
  #endif
  #ifdef SUPPORT_XATTRS
                if (preserve_xattrs) {
@@ -226,7 +222,6 @@ index 09b4fc5..e1d01be 100644
                                io_error |= IOERR_GENERAL;
                                return NULL;
 diff --git a/generator.c b/generator.c
-index 12007a1..eee42e8 100644
 --- a/generator.c
 +++ b/generator.c
 @@ -42,8 +42,10 @@ extern int preserve_devices;
@@ -303,7 +298,7 @@ index 12007a1..eee42e8 100644
  
  #ifdef SUPPORT_HARD_LINKS
        if (preserve_hard_links && F_HLINK_NOT_FIRST(file)
-@@ -1870,13 +1895,17 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
+@@ -1865,13 +1890,17 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
                        continue;
                fname = f_name(file, NULL);
                if (!(file->mode & S_IWUSR))
@@ -324,7 +319,6 @@ index 12007a1..eee42e8 100644
                        if (allowed_lull)
                                maybe_send_keepalive();
 diff --git a/log.c b/log.c
-index a687375..83948b1 100644
 --- a/log.c
 +++ b/log.c
 @@ -715,7 +715,7 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
@@ -337,7 +331,6 @@ index a687375..83948b1 100644
                        c[10] = !(iflags & ITEM_REPORT_XATTR) ? '.' : 'x';
                        c[11] = '\0';
 diff --git a/options.c b/options.c
-index e7c6c61..ae3d2d0 100644
 --- a/options.c
 +++ b/options.c
 @@ -53,6 +53,7 @@ int preserve_hard_links = 0;
@@ -435,7 +428,7 @@ index e7c6c61..ae3d2d0 100644
    {"ignore-errors",    0,  POPT_ARG_VAL,    &ignore_errors, 1, 0, 0 },
    {"no-ignore-errors", 0,  POPT_ARG_VAL,    &ignore_errors, 0, 0, 0 },
    {"max-delete",       0,  POPT_ARG_INT,    &max_delete, 0, 0, 0 },
-@@ -2383,6 +2409,9 @@ void server_options(char **args, int *argc_p)
+@@ -2400,6 +2426,9 @@ void server_options(char **args, int *argc_p)
        if (xfer_dirs && !recurse && delete_mode && am_sender)
                args[ac++] = "--no-r";
  
@@ -445,7 +438,7 @@ index e7c6c61..ae3d2d0 100644
        if (do_compression && def_compress_level != Z_DEFAULT_COMPRESSION) {
                if (asprintf(&arg, "--compress-level=%d", def_compress_level) < 0)
                        goto oom;
-@@ -2470,6 +2499,16 @@ void server_options(char **args, int *argc_p)
+@@ -2487,6 +2516,16 @@ void server_options(char **args, int *argc_p)
                        args[ac++] = "--delete-excluded";
                if (force_delete)
                        args[ac++] = "--force";
@@ -463,7 +456,6 @@ index e7c6c61..ae3d2d0 100644
                        args[ac++] = "--only-write-batch=X";
                if (am_root > 1)
 diff --git a/rsync.c b/rsync.c
-index 2c026a2..3188535 100644
 --- a/rsync.c
 +++ b/rsync.c
 @@ -31,6 +31,7 @@ extern int dry_run;
@@ -584,7 +576,6 @@ index 2c026a2..3188535 100644
        }
        /* The file was copied, so tweak the perms of the copied file.  If it
 diff --git a/rsync.h b/rsync.h
-index be7cf8a..16820fd 100644
 --- a/rsync.h
 +++ b/rsync.h
 @@ -61,6 +61,7 @@
@@ -611,7 +602,7 @@ index be7cf8a..16820fd 100644
  #define ITEM_BASIS_TYPE_FOLLOWS (1<<11)
  #define ITEM_XNAME_FOLLOWS (1<<12)
  #define ITEM_IS_NEW (1<<13)
-@@ -482,6 +485,28 @@ typedef unsigned int size_t;
+@@ -486,6 +489,28 @@ typedef unsigned int size_t;
  #endif
  #endif
  
@@ -640,7 +631,7 @@ index be7cf8a..16820fd 100644
  /* 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. */
-@@ -652,6 +677,7 @@ extern int file_extra_cnt;
+@@ -656,6 +681,7 @@ extern int file_extra_cnt;
  extern int inc_recurse;
  extern int uid_ndx;
  extern int gid_ndx;
@@ -648,7 +639,7 @@ index be7cf8a..16820fd 100644
  extern int acls_ndx;
  extern int xattrs_ndx;
  
-@@ -689,6 +715,11 @@ extern int xattrs_ndx;
+@@ -693,6 +719,11 @@ extern int xattrs_ndx;
  /* When the associated option is on, all entries will have these present: */
  #define F_OWNER(f) REQ_EXTRA(f, uid_ndx)->unum
  #define F_GROUP(f) REQ_EXTRA(f, gid_ndx)->unum
@@ -661,7 +652,6 @@ index be7cf8a..16820fd 100644
  #define F_XATTR(f) REQ_EXTRA(f, xattrs_ndx)->num
  #define F_NDX(f) REQ_EXTRA(f, unsort_ndx)->num
 diff --git a/rsync.yo b/rsync.yo
-index 941f7a5..7b41d5f 100644
 --- a/rsync.yo
 +++ b/rsync.yo
 @@ -345,6 +345,7 @@ to the detailed description below for a complete description.  verb(
@@ -684,7 +674,7 @@ index 941f7a5..7b41d5f 100644
       --max-delete=NUM        don't delete more than NUM files
       --max-size=SIZE         don't transfer any file larger than SIZE
       --min-size=SIZE         don't transfer any file smaller than SIZE
-@@ -592,7 +596,8 @@ specified, in which case bf(-r) is not implied.
+@@ -595,7 +599,8 @@ specified, in which case bf(-r) is not implied.
  
  Note that bf(-a) bf(does not preserve hardlinks), because
  finding multiply-linked files is expensive.  You must separately
@@ -694,7 +684,7 @@ index 941f7a5..7b41d5f 100644
  
  dit(--no-OPTION) You may turn off one or more implied options by prefixing
  the option name with "no-".  Not all options may be prefixed with a "no-":
-@@ -869,7 +874,7 @@ they would be using bf(--copy-links).
+@@ -876,7 +881,7 @@ they would be using bf(--copy-links).
  Without this option, if the sending side has replaced a directory with a
  symlink to a directory, the receiving side will delete anything that is in
  the way of the new symlink, including a directory hierarchy (as long as
@@ -703,7 +693,7 @@ index 941f7a5..7b41d5f 100644
  
  See also bf(--keep-dirlinks) for an analogous option for the receiving
  side.
-@@ -1006,6 +1011,29 @@ super-user copies all namespaces except system.*.  A normal user only copies
+@@ -1013,6 +1018,29 @@ super-user copies all namespaces except system.*.  A normal user only copies
  the user.* namespace.  To be able to backup and restore non-user namespaces as
  a normal user, see the bf(--fake-super) option.
  
@@ -733,7 +723,7 @@ index 941f7a5..7b41d5f 100644
  dit(bf(--chmod)) This option tells rsync to apply one or more
  comma-separated "chmod" strings to the permission of the files in the
  transfer.  The resulting value is treated as though it was the permissions
-@@ -1285,12 +1313,13 @@ display as a "*missing" entry in the bf(--list-only) output.
+@@ -1300,12 +1328,13 @@ display as a "*missing" entry in the bf(--list-only) output.
  dit(bf(--ignore-errors)) Tells bf(--delete) to go ahead and delete files
  even when there are I/O errors.
  
@@ -750,7 +740,7 @@ index 941f7a5..7b41d5f 100644
  bf(--recursive) option was also enabled.
  
  dit(bf(--max-delete=NUM)) This tells rsync not to delete more than NUM
-@@ -1832,7 +1861,7 @@ with older versions of rsync, but that also turns on the output of other
+@@ -1851,7 +1880,7 @@ with older versions of rsync, but that also turns on the output of other
  verbose messages).
  
  The "%i" escape has a cryptic output that is 11 letters long.  The general
@@ -759,7 +749,7 @@ index 941f7a5..7b41d5f 100644
  type of update being done, bf(X) is replaced by the file-type, and the
  other letters represent attributes that may be output if they are being
  modified.
-@@ -1888,7 +1917,7 @@ quote(itemization(
+@@ -1907,7 +1936,7 @@ quote(itemization(
    sender's value (requires bf(--owner) and super-user privileges).
    it() A bf(g) means the group is different and is being updated to the
    sender's value (requires bf(--group) and the authority to set the group).
@@ -769,7 +759,6 @@ index 941f7a5..7b41d5f 100644
    it() The bf(x) means that the extended attribute information changed.
  ))
 diff --git a/syscall.c b/syscall.c
-index cfabc3e..45604b1 100644
 --- a/syscall.c
 +++ b/syscall.c
 @@ -33,6 +33,7 @@ extern int dry_run;
@@ -964,7 +953,6 @@ index cfabc3e..45604b1 100644
  
  void trim_trailing_slashes(char *name)
 diff --git a/t_stub.c b/t_stub.c
-index 02cfa69..9228d0c 100644
 --- a/t_stub.c
 +++ b/t_stub.c
 @@ -25,6 +25,7 @@ int modify_window = 0;
@@ -975,7 +963,7 @@ index 02cfa69..9228d0c 100644
  int preserve_xattrs = 0;
  mode_t orig_umask = 002;
  char number_separator = ',';
-@@ -89,3 +90,23 @@ struct filter_list_struct daemon_filter_list;
+@@ -84,3 +85,23 @@ filter_rule_list daemon_filter_list;
  {
        return "tester";
  }
@@ -1000,7 +988,6 @@ index 02cfa69..9228d0c 100644
 +}
 +#endif
 diff --git a/util.c b/util.c
-index 0cafed6..ed26a05 100644
 --- a/util.c
 +++ b/util.c
 @@ -30,6 +30,7 @@ extern int module_id;
@@ -1072,10 +1059,9 @@ index 0cafed6..ed26a05 100644
  }
  
 diff --git a/xattrs.c b/xattrs.c
-index 2d0e050..5d04599 100644
 --- a/xattrs.c
 +++ b/xattrs.c
-@@ -282,6 +282,10 @@ int get_xattr(const char *fname, stat_x *sxp)
+@@ -284,6 +284,10 @@ int get_xattr(const char *fname, stat_x *sxp)
  {
        sxp->xattr = new(item_list);
        *sxp->xattr = empty_xattr;
@@ -1086,7 +1072,7 @@ index 2d0e050..5d04599 100644
        if (rsync_xal_get(fname, sxp->xattr) < 0) {
                free_xattr(sxp);
                return -1;
-@@ -865,6 +869,11 @@ int set_xattr(const char *fname, const struct file_struct *file,
+@@ -884,6 +888,11 @@ int set_xattr(const char *fname, const struct file_struct *file,
                return -1;
        }
  
@@ -1098,12 +1084,12 @@ index 2d0e050..5d04599 100644
        ndx = F_XATTR(file);
        return rsync_xal_set(fname, lst + ndx, fnamecmp, sxp);
  }
-@@ -981,7 +990,7 @@ int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode)
+@@ -1000,7 +1009,7 @@ int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode)
        mode = (fst.st_mode & _S_IFMT) | (fmode & ACCESSPERMS)
             | (S_ISDIR(fst.st_mode) ? 0700 : 0600);
        if (fst.st_mode != mode)
 -              do_chmod(fname, mode);
 +              do_chmod(fname, mode, ST_FLAGS(fst));
-       if (!IS_DEVICE(fst.st_mode) && !IS_SPECIAL(fst.st_mode))
+       if (!IS_DEVICE(fst.st_mode))
                fst.st_rdev = 0; /* just in case */