Last active
April 8, 2017 14:29
-
-
Save thread13/64bcd8aab05c5f9b6428253e0d8ddef6 to your computer and use it in GitHub Desktop.
a proposed patch file for rsync 3.1.1 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 0bbc80b2fd14 options.c | |
--- a/options.c Wed Apr 05 18:11:37 2017 +1000 | |
+++ b/options.c Fri Apr 07 19:50:39 2017 +1000 | |
@@ -2640,11 +2640,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 0bbc80b2fd14 rsync.c | |
--- a/rsync.c Wed Apr 05 18:11:37 2017 +1000 | |
+++ b/rsync.c Fri Apr 07 19:50:39 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))) | |
@@ -551,9 +557,11 @@ | |
&& cmp_time(sxp->st.st_mtime, file->modtime) != 0) { | |
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; | |
@@ -578,16 +586,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