./configure (optional if already run)
make
-based-on: c225330aaf9d6032a79317bda1bf669e90ac7212
+based-on: 194cee671d5e178f20c4494f41911fa8db942935
diff --git a/exclude.c b/exclude.c
--- a/exclude.c
+++ b/exclude.c
-@@ -45,10 +45,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]" };
#define SLASH_WILD3_SUFFIX "/***"
-@@ -127,8 +130,27 @@ static void teardown_mergelist(filter_rule *ex)
+@@ -128,8 +131,27 @@ static void teardown_mergelist(filter_rule *ex)
mergelist_cnt--;
}
if (ex->rflags & FILTRULE_PERDIR_MERGE)
teardown_mergelist(ex);
free(ex->pattern);
-@@ -730,7 +752,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
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) {
-@@ -739,6 +763,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;
}
if (filter_level != ALL_FILTERS)
return 0;
-@@ -749,7 +776,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
int check_filter(filter_rule_list *listp, enum logcode code,
const char *name, int name_flags)
{
-@@ -772,10 +800,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);
return 0;
}
-@@ -792,9 +822,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;
}
+ 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;
/* Gets the next include/exclude rule from *rulestr_ptr and advances
* *rulestr_ptr to point beyond it. Stores the pattern's start (within
-@@ -809,6 +876,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;
filter_rule *rule;
unsigned int len;
-@@ -828,6 +896,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;
/* 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
-@@ -973,11 +1047,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;
case 'p':
rule->rflags |= FILTRULE_PERISHABLE;
break;
-@@ -1292,6 +1418,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;
}
#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. */
&& (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;
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;
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,
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
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
See the `--perms` and `--executability` options for how the resulting
permission value can be applied to the files in the transfer.
-@@ -2476,6 +2478,10 @@ your home directory (remove the '=' for that).
+@@ -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.
+ 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
-@@ -3413,6 +3419,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.
- 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
-@@ -3470,6 +3485,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`).
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -170,6 +170,9 @@
+@@ -171,6 +171,9 @@
#define NO_FILTERS 0
#define SERVER_FILTERS 1
#define ALL_FILTERS 2
#define XFLG_FATAL_ERRORS (1<<0)
#define XFLG_OLD_PREFIXES (1<<1)
-@@ -918,6 +921,8 @@ struct map_struct {
+@@ -920,6 +923,8 @@ struct map_struct {
int status; /* first errno from read errors */
};
#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 */
-@@ -943,8 +948,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 */
typedef struct filter_struct {
struct filter_struct *next;
-@@ -954,6 +969,11 @@ typedef struct filter_struct {
+@@ -956,6 +971,11 @@ typedef struct filter_struct {
int slash_cnt;
struct filter_list_struct *mergelist;
} u;
diff --git a/util.c b/util.c
--- a/util.c
+++ b/util.c
-@@ -889,6 +889,25 @@ size_t stringjoin(char *dest, size_t destsize, ...)
+@@ -884,6 +884,25 @@ size_t stringjoin(char *dest, size_t destsize, ...)
return ret;
}