The patches for 3.2.2.
[rsync-patches.git] / filter-attribute-mods.diff
index 58372a6582e987d312aef87ae3688ea5fb4d61c3..5616bb68cf836fa34664a10d1fd613c5eb8692e2 100644 (file)
@@ -9,11 +9,11 @@ To use this patch, run these commands for a successful build:
     ./configure                         (optional if already run)
     make
 
-based-on: d1679358744176d1947668f601328268511716c4
+based-on: 194cee671d5e178f20c4494f41911fa8db942935
 diff --git a/exclude.c b/exclude.c
 --- a/exclude.c
 +++ b/exclude.c
-@@ -44,10 +44,13 @@ filter_rule_list filter_list = { .debug_type = "" };
+@@ -46,10 +46,13 @@ filter_rule_list filter_list = { .debug_type = "" };
  filter_rule_list cvs_filter_list = { .debug_type = " [global CVS]" };
  filter_rule_list daemon_filter_list = { .debug_type = " [daemon]" };
  
@@ -29,7 +29,7 @@ diff --git a/exclude.c b/exclude.c
  
  #define SLASH_WILD3_SUFFIX "/***"
  
-@@ -126,8 +129,27 @@ static void teardown_mergelist(filter_rule *ex)
+@@ -128,8 +131,27 @@ static void teardown_mergelist(filter_rule *ex)
                mergelist_cnt--;
  }
  
@@ -57,7 +57,7 @@ diff --git a/exclude.c b/exclude.c
        if (ex->rflags & FILTRULE_PERDIR_MERGE)
                teardown_mergelist(ex);
        free(ex->pattern);
-@@ -729,7 +751,9 @@ static void report_filter_result(enum logcode code, char const *name,
+@@ -723,7 +745,9 @@ static void report_filter_result(enum logcode code, char const *name,
  
  /* This function is used to check if a file should be included/excluded
   * from the list of files based on its name and type etc.  The value of
@@ -68,7 +68,7 @@ diff --git a/exclude.c b/exclude.c
  int name_is_excluded(const char *fname, int name_flags, int filter_level)
  {
        if (daemon_filter_list.head && check_filter(&daemon_filter_list, FLOG, fname, name_flags) < 0) {
-@@ -738,6 +762,9 @@ int name_is_excluded(const char *fname, int name_flags, int filter_level)
+@@ -732,6 +756,9 @@ int name_is_excluded(const char *fname, int name_flags, int filter_level)
                return 1;
        }
  
@@ -78,7 +78,7 @@ diff --git a/exclude.c b/exclude.c
        if (filter_level != ALL_FILTERS)
                return 0;
  
-@@ -748,7 +775,8 @@ int name_is_excluded(const char *fname, int name_flags, int filter_level)
+@@ -742,7 +769,8 @@ int name_is_excluded(const char *fname, int name_flags, int filter_level)
  }
  
  /* Return -1 if file "name" is defined to be excluded by the specified
@@ -88,7 +88,7 @@ diff --git a/exclude.c b/exclude.c
  int check_filter(filter_rule_list *listp, enum logcode code,
                 const char *name, int name_flags)
  {
-@@ -771,10 +799,12 @@ int check_filter(filter_rule_list *listp, enum logcode code,
+@@ -765,10 +793,12 @@ int check_filter(filter_rule_list *listp, enum logcode code,
                }
                if (rule_matches(name, ent, name_flags)) {
                        report_filter_result(code, name, ent, name_flags, listp->debug_type);
@@ -101,7 +101,7 @@ diff --git a/exclude.c b/exclude.c
        return 0;
  }
  
-@@ -791,9 +821,46 @@ static const uchar *rule_strcmp(const uchar *str, const char *rule, int rule_len
+@@ -785,9 +815,45 @@ static const uchar *rule_strcmp(const uchar *str, const char *rule, int rule_len
        return NULL;
  }
  
@@ -134,8 +134,7 @@ diff --git a/exclude.c b/exclude.c
 +      if (!parse_chmod(modestr, &modes))
 +              return NULL;
 +
-+      if (!(chmod = new(struct filter_chmod_struct)))
-+              out_of_memory("make_chmod_struct");
++      chmod = new(struct filter_chmod_struct);
 +      chmod->ref_cnt = 1;
 +      chmod->modestr = modestr;
 +      chmod->modes = modes;
@@ -149,7 +148,7 @@ diff --git a/exclude.c b/exclude.c
  
  /* Gets the next include/exclude rule from *rulestr_ptr and advances
   * *rulestr_ptr to point beyond it.  Stores the pattern's start (within
-@@ -808,6 +875,7 @@ static filter_rule *parse_rule_tok(const char **rulestr_ptr,
+@@ -802,6 +868,7 @@ static filter_rule *parse_rule_tok(const char **rulestr_ptr,
                                   const char **pat_ptr, unsigned int *pat_len_ptr)
  {
        const uchar *s = (const uchar *)*rulestr_ptr;
@@ -157,7 +156,7 @@ diff --git a/exclude.c b/exclude.c
        filter_rule *rule;
        unsigned int len;
  
-@@ -827,6 +895,12 @@ static filter_rule *parse_rule_tok(const char **rulestr_ptr,
+@@ -820,6 +887,12 @@ static filter_rule *parse_rule_tok(const char **rulestr_ptr,
        /* Inherit from the template.  Don't inherit FILTRULES_SIDES; we check
         * that later. */
        rule->rflags = template->rflags & FILTRULES_FROM_CONTAINER;
@@ -170,7 +169,7 @@ diff --git a/exclude.c b/exclude.c
  
        /* Figure out what kind of a filter rule "s" is pointing at.  Note
         * that if FILTRULE_NO_PREFIXES is set, the rule is either an include
-@@ -972,11 +1046,63 @@ static filter_rule *parse_rule_tok(const char **rulestr_ptr,
+@@ -965,11 +1038,63 @@ static filter_rule *parse_rule_tok(const char **rulestr_ptr,
                                        goto invalid;
                                rule->rflags |= FILTRULE_EXCLUDE_SELF;
                                break;
@@ -234,7 +233,7 @@ diff --git a/exclude.c b/exclude.c
                        case 'p':
                                rule->rflags |= FILTRULE_PERISHABLE;
                                break;
-@@ -1301,6 +1427,23 @@ char *get_rule_prefix(filter_rule *rule, const char *pat, int for_xfer,
+@@ -1283,6 +1408,23 @@ char *get_rule_prefix(filter_rule *rule, const char *pat, int for_xfer,
                else if (am_sender)
                        return NULL;
        }
@@ -269,7 +268,7 @@ diff --git a/flist.c b/flist.c
  
  #ifdef ICONV_OPTION
  extern int filesfrom_convert;
-@@ -1182,7 +1183,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1178,7 +1179,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
        } else if (readlink_stat(thisname, &st, linkname) != 0) {
                int save_errno = errno;
                /* See if file is excluded before reporting an error. */
@@ -278,7 +277,7 @@ diff --git a/flist.c b/flist.c
                 && (is_excluded(thisname, 0, filter_level)
                  || is_excluded(thisname, 1, filter_level))) {
                        if (ignore_perishable && save_errno != ENOENT)
-@@ -1227,6 +1228,12 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1223,6 +1224,12 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
  
        if (filter_level == NO_FILTERS)
                goto skip_filters;
@@ -291,7 +290,7 @@ diff --git a/flist.c b/flist.c
  
        if (S_ISDIR(st.st_mode)) {
                if (!xfer_dirs) {
-@@ -1445,12 +1452,23 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
+@@ -1439,12 +1446,23 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
                                          int flags, int filter_level)
  {
        struct file_struct *file;
@@ -316,7 +315,7 @@ diff --git a/flist.c b/flist.c
                file->mode = tweak_mode(file->mode, chmod_modes);
  
        if (f >= 0) {
-@@ -2355,7 +2373,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
+@@ -2345,7 +2363,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
                        struct file_struct *file;
                        file = send_file_name(f, flist, fbuf, &st,
                                              FLAG_TOP_DIR | FLAG_CONTENT_DIR | flags,
@@ -325,7 +324,7 @@ diff --git a/flist.c b/flist.c
                        if (!file)
                                continue;
                        if (inc_recurse) {
-@@ -2369,7 +2387,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
+@@ -2359,7 +2377,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
                        } else
                                send_if_directory(f, flist, file, fbuf, len, flags);
                } else
@@ -337,7 +336,7 @@ diff --git a/flist.c b/flist.c
 diff --git a/rsync.1.md b/rsync.1.md
 --- a/rsync.1.md
 +++ b/rsync.1.md
-@@ -1244,7 +1244,9 @@ your home directory (remove the '=' for that).
+@@ -1247,7 +1247,9 @@ your home directory (remove the '=' for that).
      >     --chmod=D2775,F664
  
      It is also legal to specify multiple `--chmod` options, as each additional
@@ -348,18 +347,18 @@ diff --git a/rsync.1.md b/rsync.1.md
  
      See the `--perms` and `--executability` options for how the resulting
      permission value can be applied to the files in the transfer.
-@@ -2444,6 +2446,10 @@ your home directory (remove the '=' for that).
-     If you specify "--chown=foo:bar, this is exactly the same as specifying
+@@ -2548,6 +2550,10 @@ your home directory (remove the '=' for that).
+     If you specify "`--chown=foo:bar`", this is exactly the same as specifying
      "`--usermap=*:foo --groupmap=*:bar`", only easier.
  
 +    To change ownership of files matching a pattern, use an include filter with
 +    the `o` and `g` modifiers, which take effect before uid/gid mapping and
 +    therefore em(can) be mixed with `--usermap` and `--groupmap`.
 +
- 0.  `--timeout=TIMEOUT`
+ 0.  `--timeout=SECONDS`
  
      This option allows you to set a maximum I/O timeout in seconds.  If no data
-@@ -3367,6 +3373,15 @@ The following modifiers are accepted after a "`+`" or "`-`":
+@@ -3499,6 +3505,15 @@ The following modifiers are accepted after a "`+`" or "`-`":
    rules that exclude things like "CVS" and "`*.o`" are marked as perishable,
    and will not prevent a directory that was removed on the source from being
    deleted on the destination.
@@ -375,7 +374,7 @@ diff --git a/rsync.1.md b/rsync.1.md
  - An `x` indicates that a rule affects xattr names in xattr copy/delete
    operations (and is thus ignored when matching file/dir names).  If no
    xattr-matching rules are specified, a default xattr filtering rule is used
-@@ -3424,6 +3439,12 @@ The following modifiers are accepted after a merge or dir-merge rule:
+@@ -3556,6 +3571,12 @@ The following modifiers are accepted after a merge or dir-merge rule:
    rules in the file must not specify sides (via a modifier or a rule prefix
    such as `hide`).
  
@@ -391,7 +390,7 @@ diff --git a/rsync.1.md b/rsync.1.md
 diff --git a/rsync.h b/rsync.h
 --- a/rsync.h
 +++ b/rsync.h
-@@ -166,6 +166,9 @@
+@@ -171,6 +171,9 @@
  #define NO_FILTERS    0
  #define SERVER_FILTERS        1
  #define ALL_FILTERS   2
@@ -401,7 +400,7 @@ diff --git a/rsync.h b/rsync.h
  
  #define XFLG_FATAL_ERRORS     (1<<0)
  #define XFLG_OLD_PREFIXES     (1<<1)
-@@ -914,6 +917,8 @@ struct map_struct {
+@@ -920,6 +923,8 @@ struct map_struct {
        int status;             /* first errno from read errors         */
  };
  
@@ -410,7 +409,7 @@ diff --git a/rsync.h b/rsync.h
  #define NAME_IS_FILE          (0)    /* filter name as a file */
  #define NAME_IS_DIR           (1<<0) /* filter name as a dir */
  #define NAME_IS_XATTR         (1<<2) /* filter name as an xattr */
-@@ -939,8 +944,18 @@ struct map_struct {
+@@ -945,8 +950,18 @@ struct map_struct {
  #define FILTRULE_CLEAR_LIST   (1<<18)/* this item is the "!" token */
  #define FILTRULE_PERISHABLE   (1<<19)/* perishable if parent dir goes away */
  #define FILTRULE_XATTR                (1<<20)/* rule only applies to xattr names */
@@ -429,7 +428,7 @@ diff --git a/rsync.h b/rsync.h
  
  typedef struct filter_struct {
        struct filter_struct *next;
-@@ -950,6 +965,11 @@ typedef struct filter_struct {
+@@ -956,6 +971,11 @@ typedef struct filter_struct {
                int slash_cnt;
                struct filter_list_struct *mergelist;
        } u;
@@ -444,7 +443,7 @@ diff --git a/rsync.h b/rsync.h
 diff --git a/util.c b/util.c
 --- a/util.c
 +++ b/util.c
-@@ -891,6 +891,25 @@ size_t stringjoin(char *dest, size_t destsize, ...)
+@@ -884,6 +884,25 @@ size_t stringjoin(char *dest, size_t destsize, ...)
        return ret;
  }