1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
diff -u3 rsync-3.1.2/generator.c rsync-3.1.2-mod/generator.c
--- rsync-3.1.2/generator.c 2015-12-05 20:10:24.000000000 +0100
+++ rsync-3.1.2-mod/generator.c 2016-11-22 12:58:41.614885853 +0100
@@ -79,6 +79,7 @@
extern int compare_dest;
extern int copy_dest;
extern int link_dest;
+extern int may_modify_others;
extern int whole_file;
extern int list_only;
extern int read_batch;
@@ -904,7 +905,7 @@
goto got_nothing_for_ya;
}
- if (match_level == 3 && !copy_dest) {
+ if (match_level + may_modify_others >= 3 && !copy_dest) {
if (find_exact_for_existing) {
if (link_dest && real_st.st_dev == sxp->st.st_dev && real_st.st_ino == sxp->st.st_ino)
return -1;
@@ -928,6 +929,8 @@
if (itemizing)
itemize(cmpbuf, file, ndx, 0, sxp, 0, 0, NULL);
}
+ if (match_level == 2)
+ set_file_attrs(fname, file, NULL, cmpbuf, 0);
if (INFO_GTE(NAME, 2) && maybe_ATTRS_REPORT)
rprintf(FCLIENT, "%s is uptodate\n", fname);
return -2;
diff -u3 rsync-3.1.2/options.c rsync-3.1.2-mod/options.c
--- rsync-3.1.2/options.c 2015-12-18 23:46:28.000000000 +0100
+++ rsync-3.1.2-mod/options.c 2016-11-22 12:57:19.161815853 +0100
@@ -176,6 +176,7 @@
int compare_dest = 0;
int copy_dest = 0;
int link_dest = 0;
+int may_modify_others = 0;
int basis_dir_cnt = 0;
char *dest_option = NULL;
@@ -761,6 +762,8 @@
rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n");
rprintf(F," --copy-dest=DIR ... and include copies of unchanged files\n");
rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n");
+ rprintf(F," --may-modify-others allow meta data of files in above three\n");
+ rprintf(F," DIRs to be modified\n");
rprintf(F," -z, --compress compress file data during the transfer\n");
rprintf(F," --compress-level=NUM explicitly set compression level\n");
rprintf(F," --skip-compress=LIST skip compressing files with a suffix in LIST\n");
@@ -814,7 +817,7 @@
}
enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
- OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
+ OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_MAY_MODIFY_OTHERS, OPT_HELP,
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG,
@@ -961,6 +964,7 @@
{"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
{"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
{"link-dest", 0, POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 },
+ {"may-modify-others",0, POPT_ARG_NONE, 0, OPT_MAY_MODIFY_OTHERS, 0, 0 },
{"fuzzy", 'y', POPT_ARG_NONE, 0, 'y', 0, 0 },
{"no-fuzzy", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
{"no-y", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
@@ -1643,6 +1647,10 @@
return 0;
#endif
+ case OPT_MAY_MODIFY_OTHERS:
+ may_modify_others = 1;
+ break;
+
case OPT_COPY_DEST:
copy_dest = 1;
dest_option = "--copy-dest";
--- rsync-3.1.2/rsync.yo 2015-12-21 21:00:49.000000000 +0100
+++ rsync-3.1.2-mod/rsync.yo 2016-11-22 13:12:57.606979457 +0100
@@ -419,6 +419,8 @@
--compare-dest=DIR also compare received files relative to DIR
--copy-dest=DIR ... and include copies of unchanged files
--link-dest=DIR hardlink to files in DIR when unchanged
+ --may-modify-others allow meta data of files in above three
+ DIRs to be modified
-z, --compress compress file data during the transfer
--compress-level=NUM explicitly set compression level
--skip-compress=LIST skip compressing files with suffix in LIST
--- rsync-3.1.2/rsync.1 2015-12-21 21:22:41.000000000 +0100
+++ rsync-3.1.2-mod/rsync.1 2016-11-22 13:54:19.227845494 +0100
@@ -495,6 +495,8 @@
\-\-compare\-dest=DIR also compare received files relative to DIR
\-\-copy\-dest=DIR ... and include copies of unchanged files
\-\-link\-dest=DIR hardlink to files in DIR when unchanged
+ \-\-may\-modify\-others allow meta data of files in above three
+ DIRs to be modified
\-z, \-\-compress compress file data during the transfer
\-\-compress\-level=NUM explicitly set compression level
\-\-skip\-compress=LIST skip compressing files with suffix in LIST
|