Last active
April 8, 2017 14:30
-
-
Save thread13/94875a05b070202ccec28b20db23cd2e to your computer and use it in GitHub Desktop.
a proposed patch file for rsync 3.1.2 to ignore time/attr setting failures with --delete-missing-args or --ignore-missing-args
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 5e35d4717bd7 options.c | |
--- a/options.c Thu Apr 06 20:00:09 2017 +1000 | |
+++ b/options.c Fri Apr 07 20:01:03 2017 +1000 | |
@@ -2642,11 +2642,11 @@ | |
} | |
} | |
- /* --delete-missing-args needs the cooperation of both sides, but | |
- * the sender can handle --ignore-missing-args by itself. */ | |
+ /* both --delete-missing-args and --ignore-missing-args | |
+ * require a bit of cooperation from the receiver */ | |
if (missing_args == 2) | |
args[ac++] = "--delete-missing-args"; | |
- else if (missing_args == 1 && !am_sender) | |
+ else if (missing_args == 1) | |
args[ac++] = "--ignore-missing-args"; | |
if (modify_window_set) { | |
diff -r 5e35d4717bd7 rsync.c | |
--- a/rsync.c Thu Apr 06 20:00:09 2017 +1000 | |
+++ b/rsync.c Fri Apr 07 20:01:03 2017 +1000 | |
@@ -33,6 +33,7 @@ | |
extern int preserve_perms; | |
extern int preserve_executability; | |
extern int preserve_times; | |
+ extern int missing_args; | |
extern int am_root; | |
extern int am_server; | |
extern int am_daemon; | |
@@ -460,6 +461,7 @@ | |
int change_uid, change_gid; | |
mode_t new_mode = file->mode; | |
int inherit; | |
+ enum logcode ferror_code = FERROR_XFER ; /* handle 'missing_args' */ | |
if (!sxp) { | |
if (dry_run) | |
@@ -543,6 +545,10 @@ | |
set_xattr(fname, file, fnamecmp, sxp); | |
#endif | |
+/* local macro */ | |
+#define IGNORE_MISSING ((1 == missing_args) && (EINVAL == errno)) | |
+ | |
+ | |
if (!preserve_times | |
|| (!(preserve_times & PRESERVE_DIR_TIMES) && S_ISDIR(sxp->st.st_mode)) | |
|| (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode))) | |
@@ -555,9 +561,11 @@ | |
)) { | |
int ret = set_modtime(fname, file->modtime, F_MOD_NSEC(file), sxp->st.st_mode); | |
if (ret < 0) { | |
- rsyserr(FERROR_XFER, errno, "failed to set times on %s", | |
+ ferror_code = ( IGNORE_MISSING ) ? FWARNING : FERROR_XFER ; | |
+ rsyserr(ferror_code, errno, "failed to set times on %s", | |
full_fname(fname)); | |
- goto cleanup; | |
+ if (!IGNORE_MISSING) /* == "normal" behaviour */ | |
+ goto cleanup; | |
} | |
if (ret == 0) /* ret == 1 if symlink could not be set */ | |
updated = 1; | |
@@ -582,16 +590,20 @@ | |
if (!BITS_EQUAL(sxp->st.st_mode, new_mode, CHMOD_BITS)) { | |
int ret = am_root < 0 ? 0 : do_chmod(fname, new_mode); | |
if (ret < 0) { | |
- rsyserr(FERROR_XFER, errno, | |
+ ferror_code = ( IGNORE_MISSING ) ? FWARNING : FERROR_XFER ; | |
+ rsyserr(ferror_code, errno, | |
"failed to set permissions on %s", | |
full_fname(fname)); | |
- goto cleanup; | |
+ if (!IGNORE_MISSING) /* == "normal" behaviour */ | |
+ goto cleanup; | |
} | |
if (ret == 0) /* ret == 1 if symlink could not be set */ | |
updated = 1; | |
} | |
#endif | |
+#undef IGNORE_MISSING /* ((1 == missing_args) && (EINVAL == errno)) */ | |
+ | |
if (INFO_GTE(NAME, 2) && flags & ATTRS_REPORT) { | |
if (updated) | |
rprintf(FCLIENT, "%s\n", fname); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment