diff options
author | Wayne Davison <wayne@opencoder.net> | 2022-08-01 07:00:51 -0700 |
---|---|---|
committer | Wayne Davison <wayne@opencoder.net> | 2022-08-01 07:00:51 -0700 |
commit | 7e5424b806e8eea053016268ad186276e9083b77 (patch) | |
tree | 7ca920d04f772d67f6f5f98bce3f2c96961c95cc | |
parent | 43f70b961e92d88387fecd3c7f6dbefc044ce4a3 (diff) | |
download | rsync-7e5424b806e8eea053016268ad186276e9083b77.tar.gz |
More improvements to file-list checking
- Avoid implied rules on generator and (with extra certainty) on server
- Add -R implied-directory path elements as directory includes
- Log about extra file-list checking using a new --debug=FILTER3 level
-rw-r--r-- | exclude.c | 21 | ||||
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | options.c | 2 |
3 files changed, 18 insertions, 6 deletions
@@ -25,6 +25,7 @@ extern int am_server; extern int am_sender; +extern int am_generator; extern int eol_nulls; extern int io_error; extern int xfer_dirs; @@ -309,7 +310,7 @@ void add_implied_include(const char *arg) int slash_cnt = 1; /* We know we're adding a leading slash. */ const char *cp; char *p; - if (old_style_args || list_only || filesfrom_host != NULL) + if (am_server || old_style_args || list_only || filesfrom_host != NULL) return; if (relative_paths) { cp = strstr(arg, "/./"); @@ -363,11 +364,16 @@ void add_implied_include(const char *arg) } if (!found) { filter_rule *R_rule = new0(filter_rule); - R_rule->rflags = FILTRULE_INCLUDE + (saw_wild ? FILTRULE_WILD : 0); + R_rule->rflags = FILTRULE_INCLUDE | FILTRULE_DIRECTORY + | (saw_wild ? FILTRULE_WILD : 0); R_rule->pattern = strdup(rule->pattern); R_rule->u.slash_cnt = slash_cnt; R_rule->next = implied_filter_list.head; implied_filter_list.head = R_rule; + if (DEBUG_GTE(FILTER, 3)) { + rprintf(FINFO, "[%s] add_implied_include(%s/)\n", + who_am_i(), rule->pattern); + } } } slash_cnt++; @@ -381,6 +387,8 @@ void add_implied_include(const char *arg) *p = '\0'; rule->u.slash_cnt = slash_cnt; arg = (const char *)rule->pattern; + if (DEBUG_GTE(FILTER, 3)) + rprintf(FINFO, "[%s] add_implied_include(%s)\n", who_am_i(), rule->pattern); } if (recurse || xfer_dirs) { @@ -416,6 +424,8 @@ void add_implied_include(const char *arg) rule->u.slash_cnt = slash_cnt + 1; rule->next = implied_filter_list.head; implied_filter_list.head = rule; + if (DEBUG_GTE(FILTER, 3)) + rprintf(FINFO, "[%s] add_implied_include(%s)\n", who_am_i(), rule->pattern); } } @@ -833,11 +843,12 @@ static void report_filter_result(enum logcode code, char const *name, filter_rule const *ent, int name_flags, const char *type) { + int log_level = am_sender || am_generator ? 1 : 3; + /* If a trailing slash is present to match only directories, * then it is stripped out by add_rule(). So as a special - * case we add it back in here. */ - - if (DEBUG_GTE(FILTER, 1)) { + * case we add it back in the log output. */ + if (DEBUG_GTE(FILTER, log_level)) { static char *actions[2][2] = { {"show", "hid"}, {"risk", "protect"} }; const char *w = who_am_i(); @@ -1078,6 +1078,7 @@ static int do_recv(int f_in, int f_out, char *local_name) } am_generator = 1; + implied_filter_list.head = implied_filter_list.tail = NULL; flist_receiving_enabled = True; io_end_multiplex_in(MPLX_SWITCHING); @@ -293,7 +293,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = { DEBUG_WORD(DELTASUM, W_SND|W_REC, "Debug delta-transfer checksumming (levels 1-4)"), DEBUG_WORD(DUP, W_REC, "Debug weeding of duplicate names"), DEBUG_WORD(EXIT, W_CLI|W_SRV, "Debug exit events (levels 1-3)"), - DEBUG_WORD(FILTER, W_SND|W_REC, "Debug filter actions (levels 1-2)"), + DEBUG_WORD(FILTER, W_SND|W_REC, "Debug filter actions (levels 1-3)"), DEBUG_WORD(FLIST, W_SND|W_REC, "Debug file-list operations (levels 1-4)"), DEBUG_WORD(FUZZY, W_REC, "Debug fuzzy scoring (levels 1-2)"), DEBUG_WORD(GENR, W_REC, "Debug generator functions"), |