Ticket #19591: patch-rsync306.diff
File patch-rsync306.diff, 29.4 KB (added by cssdev, 16 years ago) |
---|
-
files/patch-fileflags.diff
65 65 diff --git a/configure.in b/configure.in 66 66 --- a/configure.in 67 67 +++ b/configure.in 68 @@ -55 3,7 +553,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \68 @@ -551,7 +551,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \ 69 69 memmove lchown vsnprintf snprintf vasprintf asprintf setsid strpbrk \ 70 70 strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \ 71 71 setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \ … … 108 108 + } 109 109 +#endif 110 110 111 if ( (preserve_devices && IS_DEVICE(mode))112 || (preserve_specials && IS_SPECIAL(mode))) {113 @@ -5 38,6 +550,10 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,111 if (preserve_devices && IS_DEVICE(mode)) { 112 if (protocol_version < 28) { 113 @@ -548,6 +560,10 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file, 114 114 } 115 115 if (!(xflags & XMIT_SAME_MODE)) 116 116 write_int(f, to_wire_mode(mode)); … … 121 121 if (preserve_uid && !(xflags & XMIT_SAME_UID)) { 122 122 if (protocol_version < 30) 123 123 write_int(f, uid); 124 @@ -6 24,6 +640,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist,124 @@ -634,6 +650,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist, 125 125 { 126 126 static int64 modtime; 127 127 static mode_t mode; … … 131 131 #ifdef SUPPORT_HARD_LINKS 132 132 static int64 dev; 133 133 #endif 134 @@ -7 59,6 +778,10 @@ static struct file_struct *recv_file_entry(struct file_list *flist,134 @@ -768,6 +787,10 @@ static struct file_struct *recv_file_entry(struct file_list *flist, 135 135 136 136 if (chmod_modes && !S_ISLNK(mode)) 137 137 mode = tweak_mode(mode, chmod_modes); … … 142 142 143 143 if (preserve_uid && !(xflags & XMIT_SAME_UID)) { 144 144 if (protocol_version < 30) 145 @@ - 899,6 +922,10 @@ static struct file_struct *recv_file_entry(struct file_list *flist,145 @@ -909,6 +932,10 @@ static struct file_struct *recv_file_entry(struct file_list *flist, 146 146 } 147 147 #endif 148 148 file->mode = mode; … … 153 153 if (preserve_uid) 154 154 F_OWNER(file) = uid; 155 155 if (preserve_gid) { 156 @@ -12 73,6 +1300,10 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,156 @@ -1283,6 +1310,10 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, 157 157 } 158 158 #endif 159 159 file->mode = st.st_mode; … … 164 164 if (uid_ndx) /* Check uid_ndx instead of preserve_uid for del support */ 165 165 F_OWNER(file) = st.st_uid; 166 166 if (gid_ndx) /* Check gid_ndx instead of preserve_gid for del support */ 167 @@ -14 08,6 +1439,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,167 @@ -1426,6 +1457,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist, 168 168 #endif 169 169 #ifdef SUPPORT_XATTRS 170 170 if (preserve_xattrs) { … … 286 286 287 287 #ifdef SUPPORT_HARD_LINKS 288 288 if (preserve_hard_links && F_HLINK_NOT_FIRST(file) 289 @@ -205 4,13 +2090,17 @@ static void touch_up_dirs(struct file_list *flist, int ndx)289 @@ -2058,13 +2094,17 @@ static void touch_up_dirs(struct file_list *flist, int ndx) 290 290 continue; 291 291 fname = f_name(file, NULL); 292 292 if (!(file->mode & S_IWUSR)) … … 416 416 {"ignore-errors", 0, POPT_ARG_VAL, &ignore_errors, 1, 0, 0 }, 417 417 {"no-ignore-errors", 0, POPT_ARG_VAL, &ignore_errors, 0, 0, 0 }, 418 418 {"max-delete", 0, POPT_ARG_INT, &max_delete, 0, 0, 0 }, 419 @@ -18 68,6 +1894,9 @@ void server_options(char **args, int *argc_p)419 @@ -1874,6 +1900,9 @@ void server_options(char **args, int *argc_p) 420 420 if (xfer_dirs && !recurse && delete_mode && am_sender) 421 421 args[ac++] = "--no-r"; 422 422 … … 426 426 if (do_compression && def_compress_level != Z_DEFAULT_COMPRESSION) { 427 427 if (asprintf(&arg, "--compress-level=%d", def_compress_level) < 0) 428 428 goto oom; 429 @@ -19 55,6 +1984,16 @@ void server_options(char **args, int *argc_p)429 @@ -1961,6 +1990,16 @@ void server_options(char **args, int *argc_p) 430 430 args[ac++] = "--delete-excluded"; 431 431 if (force_delete) 432 432 args[ac++] = "--force"; … … 662 662 --max-delete=NUM don't delete more than NUM files 663 663 --max-size=SIZE don't transfer any file larger than SIZE 664 664 --min-size=SIZE don't transfer any file smaller than SIZE 665 @@ -54 4,7 +548,8 @@ specified, in which case bf(-r) is not implied.665 @@ -547,7 +551,8 @@ specified, in which case bf(-r) is not implied. 666 666 667 667 Note that bf(-a) bf(does not preserve hardlinks), because 668 668 finding multiply-linked files is expensive. You must separately … … 672 672 673 673 dit(--no-OPTION) You may turn off one or more implied options by prefixing 674 674 the option name with "no-". Not all options may be prefixed with a "no-": 675 @@ -80 2,7 +807,7 @@ they would be using bf(--copy-links).675 @@ -809,7 +814,7 @@ they would be using bf(--copy-links). 676 676 Without this option, if the sending side has replaced a directory with a 677 677 symlink to a directory, the receiving side will delete anything that is in 678 678 the way of the new symlink, including a directory hierarchy (as long as … … 681 681 682 682 See also bf(--keep-dirlinks) for an analogous option for the receiving 683 683 side. 684 @@ -9 39,6 +944,29 @@ super-user copies all namespaces except system.*. A normal user only copies684 @@ -946,6 +951,29 @@ super-user copies all namespaces except system.*. A normal user only copies 685 685 the user.* namespace. To be able to backup and restore non-user namespaces as 686 686 a normal user, see the bf(--fake-super) option. 687 687 … … 711 711 dit(bf(--chmod)) This option tells rsync to apply one or more 712 712 comma-separated "chmod" strings to the permission of the files in the 713 713 transfer. The resulting value is treated as though it was the permissions 714 @@ -12 01,12 +1229,13 @@ See bf(--delete) (which is implied) for more details on file-deletion.714 @@ -1216,12 +1244,13 @@ See bf(--delete) (which is implied) for more details on file-deletion. 715 715 dit(bf(--ignore-errors)) Tells bf(--delete) to go ahead and delete files 716 716 even when there are I/O errors. 717 717 … … 728 728 bf(--recursive) option was also enabled. 729 729 730 730 dit(bf(--max-delete=NUM)) This tells rsync not to delete more than NUM 731 @@ -16 67,7 +1696,7 @@ with older versions of rsync, but that also turns on the output of other731 @@ -1686,7 +1715,7 @@ with older versions of rsync, but that also turns on the output of other 732 732 verbose messages). 733 733 734 734 The "%i" escape has a cryptic output that is 11 letters long. The general … … 737 737 type of update being done, bf(X) is replaced by the file-type, and the 738 738 other letters represent attributes that may be output if they are being 739 739 modified. 740 @@ -17 23,7 +1752,7 @@ quote(itemization(740 @@ -1742,7 +1771,7 @@ quote(itemization( 741 741 sender's value (requires bf(--owner) and super-user privileges). 742 742 it() A bf(g) means the group is different and is being updated to the 743 743 sender's value (requires bf(--group) and the authority to set the group). … … 1049 1049 diff --git a/xattrs.c b/xattrs.c 1050 1050 --- a/xattrs.c 1051 1051 +++ b/xattrs.c 1052 @@ -28 1,6 +281,10 @@ int get_xattr(const char *fname, stat_x *sxp)1052 @@ -283,6 +283,10 @@ int get_xattr(const char *fname, stat_x *sxp) 1053 1053 { 1054 1054 sxp->xattr = new(item_list); 1055 1055 *sxp->xattr = empty_xattr; … … 1060 1060 if (rsync_xal_get(fname, sxp->xattr) < 0) { 1061 1061 free_xattr(sxp); 1062 1062 return -1; 1063 @@ -8 64,6 +868,11 @@ int set_xattr(const char *fname, const struct file_struct *file,1063 @@ -883,6 +887,11 @@ int set_xattr(const char *fname, const struct file_struct *file, 1064 1064 return -1; 1065 1065 } 1066 1066 … … 1072 1072 ndx = F_XATTR(file); 1073 1073 return rsync_xal_set(fname, lst + ndx, fnamecmp, sxp); 1074 1074 } 1075 @@ -9 80,7 +989,7 @@ int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode)1075 @@ -999,7 +1008,7 @@ int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode) 1076 1076 mode = (fst.st_mode & _S_IFMT) | (fmode & ACCESSPERMS) 1077 1077 | (S_ISDIR(fst.st_mode) ? 0700 : 0600); 1078 1078 if (fst.st_mode != mode) 1079 1079 - do_chmod(fname, mode); 1080 1080 + do_chmod(fname, mode, ST_FLAGS(fst)); 1081 if (!IS_DEVICE(fst.st_mode) && !IS_SPECIAL(fst.st_mode))1081 if (!IS_DEVICE(fst.st_mode)) 1082 1082 fst.st_rdev = 0; /* just in case */ 1083 1083 1084 diff -up a/config.h.in b/config.h.in 1085 --- a/config.h.in 1086 +++ b/config.h.in 1087 @@ -70,6 +70,9 @@ 1088 /* Define to 1 if vsprintf has a C99-compatible return value */ 1089 #undef HAVE_C99_VSNPRINTF 1090 1091 +/* Define to 1 if you have the `chflags' function. */ 1092 +#undef HAVE_CHFLAGS 1093 + 1094 /* Define to 1 if you have the `chmod' function. */ 1095 #undef HAVE_CHMOD 1096 1097 diff -up a/configure.sh b/configure.sh 1098 --- a/configure.sh 1099 +++ b/configure.sh 1100 @@ -15031,12 +15031,13 @@ fi 1101 1102 1103 1104 + 1105 for ac_func in waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \ 1106 fchmod fstat ftruncate strchr readlink link utime utimes lutimes strftime \ 1107 memmove lchown vsnprintf snprintf vasprintf asprintf setsid strpbrk \ 1108 strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \ 1109 setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \ 1110 - strerror putenv iconv_open locale_charset nl_langinfo getxattr \ 1111 + chflags strerror putenv iconv_open locale_charset nl_langinfo getxattr \ 1112 extattr_get_link sigaction sigprocmask setattrlist 1113 do 1114 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 1115 diff -up a/proto.h b/proto.h 1116 --- a/proto.h 1117 +++ b/proto.h 1118 @@ -274,6 +274,8 @@ int read_ndx_and_attrs(int f_in, int *if 1119 void free_sums(struct sum_struct *s); 1120 mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms, 1121 int exists); 1122 +int make_mutable(const char *fname, mode_t mode, uint32 fileflags, uint32 iflags); 1123 +int undo_make_mutable(const char *fname, uint32 fileflags); 1124 int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp, 1125 const char *fnamecmp, int flags); 1126 RETSIGTYPE sig_int(UNUSED(int val)); 1127 @@ -298,11 +300,12 @@ int sock_exec(const char *prog); 1128 int do_unlink(const char *fname); 1129 int do_symlink(const char *fname1, const char *fname2); 1130 int do_link(const char *fname1, const char *fname2); 1131 -int do_lchown(const char *path, uid_t owner, gid_t group); 1132 +int do_lchown(const char *path, uid_t owner, gid_t group, mode_t mode, uint32 fileflags); 1133 int do_mknod(const char *pathname, mode_t mode, dev_t dev); 1134 int do_rmdir(const char *pathname); 1135 int do_open(const char *pathname, int flags, mode_t mode); 1136 -int do_chmod(const char *path, mode_t mode); 1137 +int do_chmod(const char *path, mode_t mode, uint32 fileflags); 1138 +int do_chflags(const char *path, uint32 fileflags); 1139 int do_rename(const char *fname1, const char *fname2); 1140 void trim_trailing_slashes(char *name); 1141 int do_mkdir(char *fname, mode_t mode); 1142 @@ -330,7 +333,7 @@ int fd_pair(int fd[2]); 1143 void print_child_argv(const char *prefix, char **cmd); 1144 NORETURN void out_of_memory(const char *str); 1145 NORETURN void overflow_exit(const char *str); 1146 -int set_modtime(const char *fname, time_t modtime, mode_t mode); 1147 +int set_modtime(const char *fname, time_t modtime, mode_t mode, uint32 fileflags); 1148 int mkdir_defmode(char *fname); 1149 int create_directory_path(char *fname); 1150 int full_write(int desc, const char *ptr, size_t len); 1151 diff -up a/rsync.1 b/rsync.1 1152 --- a/rsync.1 1153 +++ b/rsync.1 1154 @@ -417,6 +417,7 @@ to the detailed description below for a 1155 \-K, \-\-keep\-dirlinks treat symlinked dir on receiver as dir 1156 \-H, \-\-hard\-links preserve hard links 1157 \-p, \-\-perms preserve permissions 1158 + \-\-fileflags preserve file-flags (aka chflags) 1159 \-E, \-\-executability preserve executability 1160 \-\-chmod=CHMOD affect file and/or directory permissions 1161 \-A, \-\-acls preserve ACLs (implies \-p) 1162 @@ -448,7 +449,10 @@ to the detailed description below for a 1163 \-\-delete\-after receiver deletes after transfer, not before 1164 \-\-delete\-excluded also delete excluded files from dest dirs 1165 \-\-ignore\-errors delete even if there are I/O errors 1166 - \-\-force force deletion of dirs even if not empty 1167 + \-\-force\-delete force deletion of dirs even if not empty 1168 + \-\-force\-change affect user/system immutable files/dirs 1169 + \-\-force\-uchange affect user-immutable files/dirs 1170 + \-\-force\-schange affect system-immutable files/dirs 1171 \-\-max\-delete=NUM don't delete more than NUM files 1172 \-\-max\-size=SIZE don't transfer any file larger than SIZE 1173 \-\-min\-size=SIZE don't transfer any file smaller than SIZE 1174 @@ -638,7 +642,8 @@ specified, in which case \fB\-r\fP is no 1175 .IP 1176 Note that \fB\-a\fP \fBdoes not preserve hardlinks\fP, because 1177 finding multiply-linked files is expensive. You must separately 1178 -specify \fB\-H\fP. 1179 +specify \fB\-H\fP. Note also that for backward compatibility, \fB\-a\fP 1180 +currently does \fBnot\fP imply the \fB\-\-fileflags\fP option. 1181 .IP 1182 .IP "\-\-no\-OPTION" 1183 You may turn off one or more implied options by prefixing 1184 @@ -931,7 +936,7 @@ they would be using \fB\-\-copy\-links\f 1185 Without this option, if the sending side has replaced a directory with a 1186 symlink to a directory, the receiving side will delete anything that is in 1187 the way of the new symlink, including a directory hierarchy (as long as 1188 -\fB\-\-force\fP or \fB\-\-delete\fP is in effect). 1189 +\fB\-\-force\-delete\fP or \fB\-\-delete\fP is in effect). 1190 .IP 1191 See also \fB\-\-keep\-dirlinks\fP for an analogous option for the receiving 1192 side. 1193 @@ -1086,6 +1091,33 @@ super-user copies all namespaces except 1194 the user.* namespace. To be able to backup and restore non-user namespaces as 1195 a normal user, see the \fB\-\-fake\-super\fP option. 1196 .IP 1197 +.IP "\fB\-\-fileflags\fP" 1198 +This option causes rsync to update the file-flags to be 1199 +the same as the source files and directories (if your OS supports the 1200 +\fBchflags\fP(2) system call). Some flags can only be altered by the super-user 1201 +and some might only be unset below a certain secure-level (usually single-user 1202 +mode). It will not make files alterable that are set to immutable on the 1203 +receiver. To do that, see \fB\-\-force\-change\fP, \fB\-\-force\-uchange\fP, and 1204 +\fB\-\-force\-schange\fP. 1205 +.IP 1206 +.IP "\fB\-\-force\-change\fP" 1207 +This option causes rsync to disable both user-immutable 1208 +and system-immutable flags on files and directories that are being updated or 1209 +deleted on the receiving side. This option overrides \fB\-\-force\-uchange\fP and 1210 +\fB\-\-force\-schange\fP. 1211 +.IP 1212 +.IP "\fB\-\-force\-uchange\fP" 1213 +This option causes rsync to disable user-immutable 1214 +flags on files and directories that are being updated or deleted on the 1215 +receiving side. It does not try to affect system flags. This option overrides 1216 +\fB\-\-force\-change\fP and \fB\-\-force\-schange\fP. 1217 +.IP 1218 +.IP "\fB\-\-force\-schange\fP" 1219 +This option causes rsync to disable system-immutable 1220 +flags on files and directories that are being updated or deleted on the 1221 +receiving side. It does not try to affect user flags. This option overrides 1222 +\fB\-\-force\-change\fP and \fB\-\-force\-schange\fP. 1223 +.IP 1224 .IP "\fB\-\-chmod\fP" 1225 This option tells rsync to apply one or more 1226 comma-separated \(lqchmod\(rq strings to the permission of the files in the 1227 @@ -1386,13 +1418,14 @@ See \fB\-\-delete\fP (which is implied) 1228 Tells \fB\-\-delete\fP to go ahead and delete files 1229 even when there are I/O errors. 1230 .IP 1231 -.IP "\fB\-\-force\fP" 1232 +.IP "\fB\-\-force\-delete\fP" 1233 This option tells rsync to delete a non-empty directory 1234 when it is to be replaced by a non-directory. This is only relevant if 1235 deletions are not active (see \fB\-\-delete\fP for details). 1236 .IP 1237 -Note for older rsync versions: \fB\-\-force\fP used to still be required when 1238 -using \fB\-\-delete\-after\fP, and it used to be non-functional unless the 1239 +This option can be abbreviated \fB\-\-force\fP for backward compatibility. 1240 +Note that some older rsync versions used to still require \fB\-\-force\fP 1241 +when using \fB\-\-delete\-after\fP, and it used to be non-functional unless the 1242 \fB\-\-recursive\fP option was also enabled. 1243 .IP 1244 .IP "\fB\-\-max\-delete=NUM\fP" 1245 @@ -1928,7 +1961,7 @@ with older versions of rsync, but that a 1246 verbose messages). 1247 .IP 1248 The \(lq%i\(rq escape has a cryptic output that is 11 letters long. The general 1249 -format is like the string \fBYXcstpoguax\fP, where \fBY\fP is replaced by the 1250 +format is like the string \fBYXcstpogfax\fP, where \fBY\fP is replaced by the 1251 type of update being done, \fBX\fP is replaced by the file-type, and the 1252 other letters represent attributes that may be output if they are being 1253 modified. 1254 @@ -1998,7 +2031,7 @@ sender's value (requires \fB\-\-owner\fP 1255 A \fBg\fP means the group is different and is being updated to the 1256 sender's value (requires \fB\-\-group\fP and the authority to set the group). 1257 .IP o 1258 -The \fBu\fP slot is reserved for future use. 1259 +The \fBf\fP means that the fileflags information changed. 1260 .IP o 1261 The \fBa\fP means that the ACL information changed. 1262 .IP o -
files/patch-osx-xattr-nodev.diff
1 This patch makes the xattr functions skip devices and special files, 2 because OS X returns the wrong errno when getting/setting xattrs on 3 them (it returns EPERM instead of ENOTSUP). 4 5 To use this patch, run these commands for a successful build: 6 7 patch -p1 <patches/osx-xattr-nodev.diff 8 ./configure (optional if already run) 9 make 10 11 diff --git a/flist.c b/flist.c 12 --- a/flist.c 13 +++ b/flist.c 14 @@ -1426,6 +1426,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist, 15 #endif 16 #ifdef SUPPORT_XATTRS 17 if (preserve_xattrs) { 18 + sx.st.st_mode = file->mode; 19 sx.xattr = NULL; 20 if (get_xattr(fname, &sx) < 0) { 21 io_error |= IOERR_GENERAL; 22 diff --git a/xattrs.c b/xattrs.c 23 --- a/xattrs.c 24 +++ b/xattrs.c 25 @@ -283,6 +283,10 @@ int get_xattr(const char *fname, stat_x *sxp) 26 { 27 sxp->xattr = new(item_list); 28 *sxp->xattr = empty_xattr; 29 + 30 + if (IS_SPECIAL(sxp->st.st_mode) || IS_DEVICE(sxp->st.st_mode)) 31 + return 0; 32 + 33 if (rsync_xal_get(fname, sxp->xattr) < 0) { 34 free_xattr(sxp); 35 return -1; 36 @@ -883,6 +887,11 @@ int set_xattr(const char *fname, const struct file_struct *file, 37 return -1; 38 } 39 40 + if (IS_SPECIAL(sxp->st.st_mode) || IS_DEVICE(sxp->st.st_mode)) { 41 + errno = ENOTSUP; 42 + return -1; 43 + } 44 + 45 ndx = F_XATTR(file); 46 return rsync_xal_set(fname, lst + ndx, fnamecmp, sxp); 47 } -
files/patch-crtimes.diff
57 57 static mode_t mode; 58 58 #ifdef SUPPORT_FILEFLAGS 59 59 static uint32 fileflags; 60 @@ -4 79,6 +480,13 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,60 @@ -489,6 +490,13 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file, 61 61 xflags |= XMIT_SAME_TIME; 62 62 else 63 63 modtime = file->modtime; … … 71 71 72 72 #ifdef SUPPORT_HARD_LINKS 73 73 if (tmp_dev != 0) { 74 @@ -5 48,6 +556,8 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,74 @@ -558,6 +566,8 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file, 75 75 else 76 76 write_int(f, modtime); 77 77 } … … 80 80 if (!(xflags & XMIT_SAME_MODE)) 81 81 write_int(f, to_wire_mode(mode)); 82 82 #ifdef SUPPORT_FILEFLAGS 83 @@ -6 38,7 +648,7 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,83 @@ -648,7 +658,7 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file, 84 84 static struct file_struct *recv_file_entry(struct file_list *flist, 85 85 int xflags, int f) 86 86 { … … 89 89 static mode_t mode; 90 90 #ifdef SUPPORT_FILEFLAGS 91 91 static uint32 fileflags; 92 @@ -7 44,6 +754,8 @@ static struct file_struct *recv_file_entry(struct file_list *flist,92 @@ -754,6 +764,8 @@ static struct file_struct *recv_file_entry(struct file_list *flist, 93 93 uid = F_OWNER(first); 94 94 if (preserve_gid) 95 95 gid = F_GROUP(first); 96 96 + if (crtimes_ndx) 97 97 + crtime = f_crtime(first); 98 if ((preserve_devices && IS_DEVICE(mode)) 99 || (preserve_specials && IS_SPECIAL(mode))) { 98 if (preserve_devices && IS_DEVICE(mode)) { 100 99 uint32 *devp = F_RDEV_P(first); 101 @@ -773,6 +785,19 @@ static struct file_struct *recv_file_entry(struct file_list *flist, 100 rdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp)); 101 @@ -782,6 +794,19 @@ static struct file_struct *recv_file_entry(struct file_list *flist, 102 102 } else 103 103 modtime = read_int(f); 104 104 } … … 118 118 if (!(xflags & XMIT_SAME_MODE)) 119 119 mode = from_wire_mode(read_int(f)); 120 120 121 @@ -9 32,6 +957,8 @@ static struct file_struct *recv_file_entry(struct file_list *flist,121 @@ -942,6 +967,8 @@ static struct file_struct *recv_file_entry(struct file_list *flist, 122 122 F_GROUP(file) = gid; 123 123 file->flags |= gid_flags; 124 124 } … … 127 127 if (unsort_ndx) 128 128 F_NDX(file) = flist->used + flist->ndx_start; 129 129 130 @@ -13 08,6 +1335,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,130 @@ -1318,6 +1345,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, 131 131 F_OWNER(file) = st.st_uid; 132 132 if (gid_ndx) /* Check gid_ndx instead of preserve_gid for del support */ 133 133 F_GROUP(file) = st.st_gid; … … 182 182 #if !defined HAVE_LCHMOD && !defined HAVE_SETATTRLIST 183 183 if (S_ISLNK(file->mode)) { 184 184 ; 185 @@ -1226,6 +1241,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx, 185 @@ -1225,7 +1240,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx, 186 186 187 static void list_file_entry(struct file_struct *f) 187 188 { 188 189 + time_t crtime = crtimes_ndx ? f_crtime(f) : 0;189 - char permbuf[PERMSTRING_SIZE]; 190 + char permbuf[PERMSTRING_SIZE], crtime_buf[32]; 190 191 double len; 191 192 192 193 if (!F_IS_ACTIVE(f)) { 193 @@ -1240,14 +1256,16 @@ static void list_file_entry(struct file_struct *f) 194 @@ -1236,19 +1251,24 @@ static void list_file_entry(struct file_struct *f) 195 permstring(permbuf, f->mode); 196 len = F_LENGTH(f); 194 197 198 + if (crtimes_ndx) 199 + snprintf(crtime_buf, sizeof crtime_buf, " %s", timestring(f_crtime(f))); 200 + else 201 + *crtime_buf = '\0'; 202 + 203 /* TODO: indicate '+' if the entry has an ACL. */ 204 195 205 #ifdef SUPPORT_LINKS 196 206 if (preserve_links && S_ISLNK(f->mode)) { 197 207 - rprintf(FINFO, "%s %11.0f %s %s -> %s\n", 198 + rprintf(FINFO, "%s %11.0f %s 208 + rprintf(FINFO, "%s %11.0f %s%s %s -> %s\n", 199 209 permbuf, len, timestring(f->modtime), 200 + crtimes_ndx ? timestring(crtime) : "", 201 210 - f_name(f, NULL), F_SYMLINK(f)); 211 + crtime_buf, f_name(f, NULL), F_SYMLINK(f)); 202 212 } else 203 213 #endif 204 214 { 205 215 - rprintf(FINFO, "%s %11.0f %s %s\n", 206 + rprintf(FINFO, "%s %11.0f %s 216 + rprintf(FINFO, "%s %11.0f %s%s %s\n", 207 217 permbuf, len, timestring(f->modtime), 208 + crtimes_ndx ? timestring(crtime) : "", 209 218 - f_name(f, NULL)); 219 + crtime_buf, f_name(f, NULL)); 210 220 } 211 221 } 212 @@ -1339,6 +1357,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, 222 223 @@ -1339,6 +1359,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, 213 224 return; 214 225 } 215 226 } … … 310 321 {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 1, 0, 0 }, 311 322 {"no-omit-dir-times",0, POPT_ARG_VAL, &omit_dir_times, 0, 0, 0 }, 312 323 {"no-O", 0, POPT_ARG_VAL, &omit_dir_times, 0, 0, 0 }, 313 @@ -180 0,6 +1805,8 @@ void server_options(char **args, int *argc_p)324 @@ -1806,6 +1811,8 @@ void server_options(char **args, int *argc_p) 314 325 argstr[x++] = 'D'; 315 326 if (preserve_times) 316 327 argstr[x++] = 't'; … … 426 437 --super receiver attempts super-user activities 427 438 --fake-super store/recover privileged attrs using xattrs 428 439 -S, --sparse handle sparse files efficiently 429 @@ -103 2,6 +1033,9 @@ it is preserving modification times (see bf(--times)). If NFS is sharing440 @@ -1039,6 +1040,9 @@ it is preserving modification times (see bf(--times)). If NFS is sharing 430 441 the directories on the receiving side, it is a good idea to use bf(-O). 431 442 This option is inferred if you use bf(--backup) without bf(--backup-dir). 432 443 … … 436 447 dit(bf(--super)) This tells the receiving side to attempt super-user 437 448 activities even if the receiving rsync wasn't run by the super-user. These 438 449 activities include: preserving users via the bf(--owner) option, preserving 439 @@ -1 696,7 +1700,7 @@ with older versions of rsync, but that also turns on the output of other450 @@ -1715,7 +1719,7 @@ with older versions of rsync, but that also turns on the output of other 440 451 verbose messages). 441 452 442 453 The "%i" escape has a cryptic output that is 11 letters long. The general … … 445 456 type of update being done, bf(X) is replaced by the file-type, and the 446 457 other letters represent attributes that may be output if they are being 447 458 modified. 448 @@ -17 55,6 +1759,8 @@ quote(itemization(459 @@ -1774,6 +1778,8 @@ quote(itemization( 449 460 it() The bf(f) means that the fileflags information changed. 450 461 it() The bf(a) means that the ACL information changed. 451 462 it() The bf(x) means that the extended attribute information changed. … … 649 660 fprintf(F," -l, --link-times display the time on a symlink\n"); 650 661 fprintf(F," -L, --link-owner display the owner+group on a symlink\n"); 651 662 #ifdef SUPPORT_XATTRS 663 diff -up a/proto.h b/proto.h 664 --- a/proto.h 665 +++ b/proto.h 666 @@ -314,6 +314,8 @@ int do_stat(const char *fname, STRUCT_ST 667 int do_lstat(const char *fname, STRUCT_STAT *st); 668 int do_fstat(int fd, STRUCT_STAT *st); 669 OFF_T do_lseek(int fd, OFF_T offset, int whence); 670 +time_t get_create_time(const char *path); 671 +int set_create_time(const char *path, time_t crtime); 672 void set_compression(const char *fname); 673 void send_token(int f, int32 token, struct map_struct *buf, OFF_T offset, 674 int32 n, int32 toklen); 675 diff -up a/rsync.1 b/rsync.1 676 --- a/rsync.1 677 +++ b/rsync.1 678 @@ -429,6 +429,7 @@ to the detailed description below for a 679 \-D same as \-\-devices \-\-specials 680 \-t, \-\-times preserve modification times 681 \-O, \-\-omit\-dir\-times omit directories from \-\-times 682 + \-N, \-\-crtimes preserve create times (newness) 683 \-\-super receiver attempts super-user activities 684 \-\-fake\-super store/recover privileged attrs using xattrs 685 \-S, \-\-sparse handle sparse files efficiently 686 @@ -1194,6 +1195,10 @@ it is preserving modification times (see 687 the directories on the receiving side, it is a good idea to use \fB\-O\fP. 688 This option is inferred if you use \fB\-\-backup\fP without \fB\-\-backup\-dir\fP. 689 .IP 690 +.IP "\fB\-N, \-\-crtimes\fP" 691 +This tells rsync to set the create times (newness) of 692 +the destination files to the same value as the source files. 693 +.IP 694 .IP "\fB\-\-super\fP" 695 This tells the receiving side to attempt super-user 696 activities even if the receiving rsync wasn't run by the super-user. These 697 @@ -1961,7 +1966,7 @@ with older versions of rsync, but that a 698 verbose messages). 699 .IP 700 The \(lq%i\(rq escape has a cryptic output that is 11 letters long. The general 701 -format is like the string \fBYXcstpogfax\fP, where \fBY\fP is replaced by the 702 +format is like the string \fBYXcstpogfaxn\fP, where \fBY\fP is replaced by the 703 type of update being done, \fBX\fP is replaced by the file-type, and the 704 other letters represent attributes that may be output if they are being 705 modified. 706 @@ -2036,6 +2041,9 @@ The \fBf\fP means that the fileflags inf 707 The \fBa\fP means that the ACL information changed. 708 .IP o 709 The \fBx\fP means that the extended attribute information changed. 710 +.IP o 711 +A \fBn\fP means the create time (newness) is different and is being 712 +updated to the sender's value (requires \fB\-\-crtimes\fP). 713 .RE 714 715 .IP -
Portfile
3 3 PortSystem 1.0 4 4 5 5 name rsync 6 version 3.0. 56 version 3.0.6 7 7 categories net 8 8 platforms darwin freebsd sunos 9 9 maintainers simon openmaintainer … … 13 13 under the GNU General Public License and is currently \ 14 14 being maintained by Wayne Davison. \ 15 15 \ 16 Rsync version 3.0. 5has been released. This is a \16 Rsync version 3.0.6 has been released. This is a \ 17 17 bug-fix release. Related pages: \ 18 18 http://rsync.samba.org/ftp/rsync/rsync-${version}-NEWS 19 19 … … 21 21 master_sites http://rsync.samba.org/ftp/rsync/ \ 22 22 http://rsync.samba.org/ftp/rsync/src/ 23 23 checksums ${distname}${extract.suffix} \ 24 md5 a130e736c011572cb423b6245e97fc4b\25 sha1 d95e75af9456b0edca68bde17260c98261b4b8c5\26 rmd160 c2a223c7afc29be413b593deaa2187f5d000f7a624 md5 e9865d093a18e4668b9d31b635dc8e99 \ 25 sha1 8853dfd291b3850aafa60169d2eea8601498f713 \ 26 rmd160 881ecea519b97d1a7f326b021ebac939ac2fe091 27 27 distname rsync-${version} 28 28 29 29 depends_lib port:popt port:libiconv