The patches for 3.2.3pre1.
[rsync-patches.git] / ignore-case.diff
index 3273b66d2b22c62e65d5c75cf565100bc8fa70b9..cc04d4ca16bf5dea7db953b94540806efc3b05f9 100644 (file)
@@ -12,19 +12,11 @@ TODO:
  - Make this code handle multibyte character encodings, and honor the
    --iconv setting when converting case.
 
-based-on: 5b19cf787515fc2388dd070a85e86ced5d80510b
+based-on: 8695bcc2b140b2518254234659a03b96f04055fc
 diff --git a/exclude.c b/exclude.c
 --- a/exclude.c
 +++ b/exclude.c
-@@ -21,6 +21,7 @@
-  */
- #include "rsync.h"
-+#include "ifuncs.h"
- extern int am_server;
- extern int am_sender;
-@@ -690,16 +691,15 @@ static int rule_matches(const char *fname, filter_rule *ex, int name_flags)
+@@ -684,16 +684,15 @@ static int rule_matches(const char *fname, filter_rule *ex, int name_flags)
                if (litmatch_array(pattern, strings, slash_handling))
                        return ret_match;
        } else if (anchored_match) {
@@ -56,7 +48,17 @@ diff --git a/flist.c b/flist.c
  extern int ignore_errors;
  extern int numeric_ids;
  extern int quiet;
-@@ -3110,6 +3111,7 @@ int f_name_cmp(const struct file_struct *f1, const struct file_struct *f2)
+@@ -2591,7 +2592,8 @@ struct file_list *recv_file_list(int f, int dir_ndx)
+                               cur_dir++;
+                       if (cur_dir != good_dirname) {
+                               const char *d = dir_ndx >= 0 ? f_name(dir_flist->files[dir_ndx], NULL) : empty_dir;
+-                              if (strcmp(cur_dir, d) != 0) {
++                              int dir_differs = ignore_case ? strcasecmp(cur_dir, d) : strcmp(cur_dir, d);
++                              if (dir_differs) {
+                                       rprintf(FERROR,
+                                               "ABORTING due to invalid path from sender: %s/%s\n",
+                                               cur_dir, file->basename);
+@@ -3158,6 +3160,7 @@ int f_name_cmp(const struct file_struct *f1, const struct file_struct *f2)
  {
        int dif;
        const uchar *c1, *c2;
@@ -64,7 +66,7 @@ diff --git a/flist.c b/flist.c
        enum fnc_state state1, state2;
        enum fnc_type type1, type2;
        enum fnc_type t_path = protocol_version >= 29 ? t_PATH : t_ITEM;
-@@ -3220,7 +3222,15 @@ int f_name_cmp(const struct file_struct *f1, const struct file_struct *f2)
+@@ -3268,7 +3271,15 @@ int f_name_cmp(const struct file_struct *f1, const struct file_struct *f2)
                        if (type1 != type2)
                                return type1 == t_PATH ? 1 : -1;
                }
@@ -84,9 +86,9 @@ diff --git a/flist.c b/flist.c
 diff --git a/ifuncs.h b/ifuncs.h
 --- a/ifuncs.h
 +++ b/ifuncs.h
-@@ -104,3 +104,38 @@ free_stat_x(stat_x *sx_p)
-     }
- #endif
+@@ -109,3 +109,38 @@ static inline char *my_strdup(const char *str, const char *file, int line)
+     memcpy(buf, str, len);
+     return buf;
  }
 +
 +static inline int
@@ -212,7 +214,7 @@ diff --git a/lib/wildmatch.c b/lib/wildmatch.c
 diff --git a/options.c b/options.c
 --- a/options.c
 +++ b/options.c
-@@ -123,6 +123,7 @@ OFF_T max_size = -1;
+@@ -125,6 +125,7 @@ OFF_T max_size = -1;
  OFF_T min_size = -1;
  int ignore_errors = 0;
  int modify_window = 0;
@@ -220,15 +222,7 @@ diff --git a/options.c b/options.c
  int blocking_io = -1;
  int checksum_seed = 0;
  int inplace = 0;
-@@ -844,6 +845,7 @@ void usage(enum logcode F)
-   rprintf(F," -0, --from0                 all *-from/filter files are delimited by 0s\n");
-   rprintf(F," -s, --protect-args          no space-splitting; only wildcard special-chars\n");
-   rprintf(F,"     --copy-as=USER[:GROUP]  specify user & optional group for the copy\n");
-+  rprintf(F,"     --ignore-case           ignore case when comparing filenames\n");
-   rprintf(F,"     --address=ADDRESS       bind address for outgoing socket to daemon\n");
-   rprintf(F,"     --port=PORT             specify double-colon alternate port number\n");
-   rprintf(F,"     --sockopts=OPTIONS      specify custom TCP options\n");
-@@ -1081,6 +1083,8 @@ static struct poptOption long_options[] = {
+@@ -995,6 +996,8 @@ static struct poptOption long_options[] = {
    {"read-batch",       0,  POPT_ARG_STRING, &batch_name, OPT_READ_BATCH, 0, 0 },
    {"write-batch",      0,  POPT_ARG_STRING, &batch_name, OPT_WRITE_BATCH, 0, 0 },
    {"only-write-batch", 0,  POPT_ARG_STRING, &batch_name, OPT_ONLY_WRITE_BATCH, 0, 0 },
@@ -237,7 +231,7 @@ diff --git a/options.c b/options.c
    {"files-from",       0,  POPT_ARG_STRING, &files_from, 0, 0, 0 },
    {"from0",           '0', POPT_ARG_VAL,    &eol_nulls, 1, 0, 0},
    {"no-from0",         0,  POPT_ARG_VAL,    &eol_nulls, 0, 0, 0},
-@@ -2881,6 +2885,9 @@ void server_options(char **args, int *argc_p)
+@@ -3028,6 +3031,9 @@ void server_options(char **args, int *argc_p)
                args[ac++] = arg;
        }
  
@@ -250,15 +244,15 @@ diff --git a/options.c b/options.c
 diff --git a/rsync.1.md b/rsync.1.md
 --- a/rsync.1.md
 +++ b/rsync.1.md
-@@ -433,6 +433,7 @@ detailed description below for a complete description.
- --from0, -0                 all *from/filter files are delimited by 0s
- --protect-args, -s          no space-splitting; wildcard chars only
- --copy-as=USER[:GROUP]      specify user & optional group for the copy
-+--ignore-case               ignore case when comparing filenames
- --address=ADDRESS           bind address for outgoing socket to daemon
- --port=PORT                 specify double-colon alternate port number
- --sockopts=OPTIONS          specify custom TCP options
-@@ -2098,6 +2099,12 @@ your home directory (remove the '=' for that).
+@@ -440,6 +440,7 @@ detailed description below for a complete description.
+ --from0, -0              all *-from/filter files are delimited by 0s
+ --protect-args, -s       no space-splitting; wildcard chars only
+ --copy-as=USER[:GROUP]   specify user & optional group for the copy
++--ignore-case            ignore case when comparing filenames
+ --address=ADDRESS        bind address for outgoing socket to daemon
+ --port=PORT              specify double-colon alternate port number
+ --sockopts=OPTIONS       specify custom TCP options
+@@ -2195,6 +2196,12 @@ your home directory (remove the '=' for that).
  
      >     sudo rsync -aive lsh -M--copy-as=joe src/ lh:dest/
  
@@ -271,6 +265,17 @@ diff --git a/rsync.1.md b/rsync.1.md
  0.  `--temp-dir=DIR`, `-T`
  
      This option instructs rsync to use DIR as a scratch directory when creating
+diff --git a/t_stub.c b/t_stub.c
+--- a/t_stub.c
++++ b/t_stub.c
+@@ -33,6 +33,7 @@ int preserve_xattrs = 0;
+ int preserve_perms = 0;
+ int preserve_executability = 0;
+ int open_noatime = 0;
++int ignore_case = 0;
+ size_t max_alloc = 0; /* max_alloc is needed when combined with util2.o */
+ char *partial_dir;
+ char *module_dir;
 diff --git a/wildtest.c b/wildtest.c
 --- a/wildtest.c
 +++ b/wildtest.c