Blame SOURCES/rsync-3.1.3-ignore-missing.patch

e7be50
commit af6118d98b3482cbcfc223bf2a0777bc19eccb02
e7be50
Author: Wayne Davison <wayne@opencoder.net>
e7be50
Date:   Sun Apr 26 18:02:17 2020 -0700
e7be50
e7be50
    Allow a missing parent dir when --delete-missing-args was specified.
e7be50
e7be50
diff --git a/generator.c b/generator.c
e7be50
index 3c50f63f..b90c7ccd 100644
e7be50
--- a/generator.c
e7be50
+++ b/generator.c
e7be50
@@ -1277,10 +1277,16 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
e7be50
 			 && (*dn != '.' || dn[1]) /* Avoid an issue with --relative and the "." dir. */
e7be50
 			 && (!prior_dir_file || strcmp(dn, f_name(prior_dir_file, NULL)) != 0)
e7be50
 			 && flist_find_name(cur_flist, dn, 1) < 0) {
e7be50
-				rprintf(FERROR,
e7be50
-					"ABORTING due to invalid path from sender: %s/%s\n",
e7be50
-					dn, file->basename);
e7be50
-				exit_cleanup(RERR_PROTOCOL);
e7be50
+				/* The --delete-missing-args option can actually put invalid entries into
e7be50
+				 * the file list, so if that option was specified, we'll just complain about
e7be50
+				 * it and allow it. */
e7be50
+				if (missing_args == 2 && file->mode == 0)
e7be50
+					rprintf(FERROR, "WARNING: parent dir is absent in the file list: %s\n", dn);
e7be50
+				else {
e7be50
+					rprintf(FERROR, "ABORTING due to invalid path from sender: %s/%s\n",
e7be50
+						dn, file->basename);
e7be50
+					exit_cleanup(RERR_PROTOCOL);
e7be50
+				}
e7be50
 			}
e7be50
 			if (relative_paths && !implied_dirs
e7be50
 			 && do_stat(dn, &sx.st) < 0) {
e7be50
@@ -1383,7 +1389,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
e7be50
 			added_perms = 0;
e7be50
 		if (is_dir < 0) {
e7be50
 			if (!(preserve_times & PRESERVE_DIR_TIMES))
e7be50
-				return;
e7be50
+				goto cleanup;
e7be50
 			/* In inc_recurse mode we want to make sure any missing
e7be50
 			 * directories get created while we're still processing
e7be50
 			 * the parent dir (which allows us to touch the parent
e7be50
@@ -1525,7 +1531,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
e7be50
 					"ignoring unsafe symlink \"%s\" -> \"%s\"\n",
e7be50
 					fname, sl);
e7be50
 			}
e7be50
-			return;
e7be50
+			goto cleanup;
e7be50
 		}
e7be50
 		if (statret == 0) {
e7be50
 			char lnk[MAXPATHLEN];