| 1 | --- options.c 6 May 2004 21:08:01 -0000 1.148 |
| 2 | +++ options.c 18 May 2004 09:48:58 -0000 |
| 3 | @@ -46,6 +46,7 @@ int preserve_devices = 0; |
| 4 | int preserve_uid = 0; |
| 5 | int preserve_gid = 0; |
| 6 | int preserve_times = 0; |
| 7 | +int preserve_dir_times = 0; |
| 8 | int update_only = 0; |
| 9 | int cvs_exclude = 0; |
| 10 | int dry_run = 0; |
| 11 | @@ -240,7 +241,8 @@ void usage(enum logcode F) |
| 12 | rprintf(F," -o, --owner preserve owner (root only)\n"); |
| 13 | rprintf(F," -g, --group preserve group\n"); |
| 14 | rprintf(F," -D, --devices preserve devices (root only)\n"); |
| 15 | - rprintf(F," -t, --times preserve times\n"); |
| 16 | + rprintf(F," -t, --times preserve times on non-directories\n"); |
| 17 | + rprintf(F," -d, --dir-times preserve times on directories\n"); |
| 18 | rprintf(F," -S, --sparse handle sparse files efficiently\n"); |
| 19 | rprintf(F," -n, --dry-run show what would have been transferred\n"); |
| 20 | rprintf(F," -W, --whole-file copy whole files, no incremental checks\n"); |
| 21 | @@ -346,6 +348,7 @@ static struct poptOption long_options[] |
| 22 | {"group", 'g', POPT_ARG_NONE, &preserve_gid, 0, 0, 0 }, |
| 23 | {"devices", 'D', POPT_ARG_NONE, &preserve_devices, 0, 0, 0 }, |
| 24 | {"times", 't', POPT_ARG_NONE, &preserve_times, 0, 0, 0 }, |
| 25 | + {"dir-times", 'd', POPT_ARG_NONE, &preserve_dir_times, 0, 0, 0 }, |
| 26 | {"checksum", 'c', POPT_ARG_NONE, &always_checksum, 0, 0, 0 }, |
| 27 | {"verbose", 'v', POPT_ARG_NONE, 0, 'v', 0, 0 }, |
| 28 | {"quiet", 'q', POPT_ARG_NONE, 0, 'q', 0, 0 }, |
| 29 | @@ -823,6 +826,8 @@ void server_options(char **args,int *arg |
| 30 | argstr[x++] = 'D'; |
| 31 | if (preserve_times) |
| 32 | argstr[x++] = 't'; |
| 33 | + if (preserve_dir_times && am_sender) |
| 34 | + argstr[x++] = 'd'; |
| 35 | if (preserve_perms) |
| 36 | argstr[x++] = 'p'; |
| 37 | if (recurse) |
| 38 | --- rsync.c 15 May 2004 19:31:10 -0000 1.139 |
| 39 | +++ rsync.c 18 May 2004 09:48:58 -0000 |
| 40 | @@ -25,6 +25,7 @@ |
| 41 | extern int verbose; |
| 42 | extern int dry_run; |
| 43 | extern int preserve_times; |
| 44 | +extern int preserve_dir_times; |
| 45 | extern int am_root; |
| 46 | extern int am_sender; |
| 47 | extern int am_generator; |
| 48 | @@ -138,14 +139,16 @@ int set_perms(char *fname,struct file_st |
| 49 | st = &st2; |
| 50 | } |
| 51 | |
| 52 | - if (!preserve_times || S_ISLNK(st->st_mode)) |
| 53 | - flags |= PERMS_SKIP_MTIME; |
| 54 | + if (S_ISDIR(st->st_mode)) { |
| 55 | + if (!preserve_dir_times) |
| 56 | + flags |= PERMS_SKIP_MTIME; |
| 57 | + } else { |
| 58 | + if (!preserve_times || S_ISLNK(st->st_mode)) |
| 59 | + flags |= PERMS_SKIP_MTIME; |
| 60 | + } |
| 61 | if (!(flags & PERMS_SKIP_MTIME) |
| 62 | && cmp_modtime(st->st_mtime, file->modtime) != 0) { |
| 63 | - /* don't complain about not setting times on directories |
| 64 | - * because some filesystems can't do it */ |
| 65 | - if (set_modtime(fname,file->modtime) != 0 && |
| 66 | - !S_ISDIR(st->st_mode)) { |
| 67 | + if (set_modtime(fname,file->modtime) != 0) { |
| 68 | rsyserr(FERROR, errno, "failed to set times on %s", |
| 69 | full_fname(fname)); |
| 70 | return 0; |
| 71 | --- rsync.yo 7 May 2004 00:18:37 -0000 1.169 |
| 72 | +++ rsync.yo 18 May 2004 09:48:58 -0000 |
| 73 | @@ -298,7 +298,8 @@ verb( |
| 74 | -o, --owner preserve owner (root only) |
| 75 | -g, --group preserve group |
| 76 | -D, --devices preserve devices (root only) |
| 77 | - -t, --times preserve times |
| 78 | + -t, --times preserve times on non-directories |
| 79 | + -d, --dir-times preserve times on directories |
| 80 | -S, --sparse handle sparse files efficiently |
| 81 | -n, --dry-run show what would have been transferred |
| 82 | -W, --whole-file copy whole files, no incremental checks |
| 83 | @@ -538,13 +539,22 @@ dit(bf(-D, --devices)) This option cause |
| 84 | block device information to the remote system to recreate these |
| 85 | devices. This option is only available to the super-user. |
| 86 | |
| 87 | -dit(bf(-t, --times)) This tells rsync to transfer modification times along |
| 88 | -with the files and update them on the remote system. Note that if this |
| 89 | +dit(bf(-t, --times)) This tells rsync to preserve modification times of |
| 90 | +non-directories transferred to the remote system. Note that if this |
| 91 | option is not used, the optimization that excludes files that have not been |
| 92 | modified cannot be effective; in other words, a missing -t or -a will |
| 93 | cause the next transfer to behave as if it used -I, and all files will have |
| 94 | their checksums compared and show up in log messages even if they haven't |
| 95 | changed. |
| 96 | + |
| 97 | +dit(bf(-d, --dir-times)) This tells rsync to preserve the modification |
| 98 | +times of directories transferred to the remote system. On a modern |
| 99 | +rsync, these are left unpreserved by default to avoid causing problems |
| 100 | +for NFS. |
| 101 | + |
| 102 | +Note: when sending files to an older rsync, the --times option will |
| 103 | +imply --dir-times (if the option causes an error on the receiving |
| 104 | +system, omit it and use --times to preserve all file/directory times). |
| 105 | |
| 106 | dit(bf(-n, --dry-run)) This tells rsync to not do any file transfers, |
| 107 | instead it will just report the actions it would have taken. |
| 108 | --- testsuite/chgrp.test 18 May 2004 00:41:35 -0000 1.11 |
| 109 | +++ testsuite/chgrp.test 18 May 2004 09:48:58 -0000 |
| 110 | @@ -26,7 +26,7 @@ do |
| 111 | done |
| 112 | sleep 2 |
| 113 | |
| 114 | -checkit "$RSYNC -rtgvvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 115 | +checkit "$RSYNC -rtdgvvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 116 | |
| 117 | # The script would have aborted on error, so getting here means we've won. |
| 118 | exit 0 |
| 119 | --- testsuite/chown.test 18 May 2004 00:41:35 -0000 1.5 |
| 120 | +++ testsuite/chown.test 18 May 2004 09:48:58 -0000 |
| 121 | @@ -28,7 +28,7 @@ chown 5001 "$name2" || test_skipped "Can |
| 122 | chgrp 5002 "$name1" || test_skipped "Can't chgrp (probably need root)" |
| 123 | chgrp 5003 "$name2" || test_skipped "Can't chgrp (probably need root)" |
| 124 | |
| 125 | -checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 126 | +checkit "$RSYNC -adHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 127 | |
| 128 | # The script would have aborted on error, so getting here means we've won. |
| 129 | exit 0 |
| 130 | --- testsuite/daemon-gzip-download.test 18 May 2004 00:41:51 -0000 1.7 |
| 131 | +++ testsuite/daemon-gzip-download.test 18 May 2004 09:48:58 -0000 |
| 132 | @@ -29,9 +29,9 @@ export RSYNC_CONNECT_PROG |
| 133 | hands_setup |
| 134 | |
| 135 | # Build chkdir with a normal rsync and an --exclude. |
| 136 | -$RSYNC -av --exclude=foobar.baz "$fromdir/" "$chkdir/" |
| 137 | +$RSYNC -adv --exclude=foobar.baz "$fromdir/" "$chkdir/" |
| 138 | |
| 139 | -checkit "$RSYNC -avvvvz localhost::test-from/ \"$todir/\"" "$chkdir" "$todir" |
| 140 | +checkit "$RSYNC -advvvvz localhost::test-from/ \"$todir/\"" "$chkdir" "$todir" |
| 141 | |
| 142 | # The script would have aborted on error, so getting here means we've won. |
| 143 | exit 0 |
| 144 | --- testsuite/daemon-gzip-upload.test 18 May 2004 00:41:51 -0000 1.7 |
| 145 | +++ testsuite/daemon-gzip-upload.test 18 May 2004 09:48:58 -0000 |
| 146 | @@ -23,9 +23,9 @@ export RSYNC_CONNECT_PROG |
| 147 | hands_setup |
| 148 | |
| 149 | # Build chkdir with a normal rsync and an --exclude. |
| 150 | -$RSYNC -av --exclude=foobar.baz "$fromdir/" "$chkdir/" |
| 151 | +$RSYNC -adv --exclude=foobar.baz "$fromdir/" "$chkdir/" |
| 152 | |
| 153 | -checkit "$RSYNC -avvvvz \"$fromdir/\" localhost::test-to/" "$chkdir" "$todir" |
| 154 | +checkit "$RSYNC -advvvvz \"$fromdir/\" localhost::test-to/" "$chkdir" "$todir" |
| 155 | |
| 156 | # The script would have aborted on error, so getting here means we've won. |
| 157 | exit 0 |
| 158 | --- testsuite/devices.test 18 May 2004 00:41:35 -0000 1.8 |
| 159 | +++ testsuite/devices.test 18 May 2004 09:48:58 -0000 |
| 160 | @@ -29,7 +29,7 @@ mknod "$fromdir/block" b 42 69 || test_s |
| 161 | mknod "$fromdir/block2" b 42 73 || test_skipped "Can't create block device node unless root" |
| 162 | mknod "$fromdir/block3" b 105 73 || test_skipped "Can't create block device node unless root" |
| 163 | |
| 164 | -checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 165 | +checkit "$RSYNC -adHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 166 | |
| 167 | # The script would have aborted on error, so getting here means we've won. |
| 168 | exit 0 |
| 169 | --- testsuite/duplicates.test 18 May 2004 00:41:35 -0000 1.10 |
| 170 | +++ testsuite/duplicates.test 18 May 2004 09:48:59 -0000 |
| 171 | @@ -33,7 +33,7 @@ ln -s "$name1" "$name2" || fail "can't c |
| 172 | |
| 173 | outfile="$scratchdir/rsync.out" |
| 174 | |
| 175 | -checkit "$RSYNC -avv \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" \ |
| 176 | +checkit "$RSYNC -advv \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" \ |
| 177 | | tee "$outfile" |
| 178 | |
| 179 | # Make sure each file was only copied once... |
| 180 | --- testsuite/exclude.test 18 May 2004 00:41:38 -0000 1.6 |
| 181 | +++ testsuite/exclude.test 18 May 2004 09:48:59 -0000 |
| 182 | @@ -63,7 +63,7 @@ EOF |
| 183 | |
| 184 | # Create the chk dir with what we expect to be excluded |
| 185 | |
| 186 | -checkit "$RSYNC -avv \"$fromdir/\" \"$chkdir/\"" "$fromdir" "$chkdir" |
| 187 | +checkit "$RSYNC -advv \"$fromdir/\" \"$chkdir/\"" "$fromdir" "$chkdir" |
| 188 | |
| 189 | sleep 1 # Ensures that the rm commands will tweak the directory times. |
| 190 | |
| 191 | @@ -75,11 +75,11 @@ rm "$chkdir"/mid/for/foo/extra |
| 192 | |
| 193 | # Un-tweak the directory times in our first (weak) exclude test (though |
| 194 | # it's a good test of the --existing option). |
| 195 | -$RSYNC -av --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/" |
| 196 | +$RSYNC -adv --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/" |
| 197 | |
| 198 | # Now, test if rsync excludes the same files. |
| 199 | |
| 200 | -checkit "$RSYNC -avv --exclude-from=$excl \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir" |
| 201 | +checkit "$RSYNC -advv --exclude-from=$excl \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir" |
| 202 | |
| 203 | # Modify the chk dir by removing cvs-ignored files and then tweaking the dir times. |
| 204 | |
| 205 | @@ -89,12 +89,12 @@ rm "$chkdir"/bar/down/to/foo/*.junk |
| 206 | rm "$chkdir"/bar/down/to/home-cvs-exclude |
| 207 | rm "$chkdir"/mid/one-in-one-out |
| 208 | |
| 209 | -$RSYNC -av --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/" |
| 210 | +$RSYNC -adv --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/" |
| 211 | |
| 212 | # Now, test if rsync excludes the same files, this time with --cvs-exclude |
| 213 | # and --delete-excluded. |
| 214 | |
| 215 | -checkit "$RSYNC -avvC --delete-excluded --exclude-from=$excl \ |
| 216 | +checkit "$RSYNC -advvC --delete-excluded --exclude-from=$excl \ |
| 217 | \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir" |
| 218 | |
| 219 | # The script would have aborted on error, so getting here means we've won. |
| 220 | --- testsuite/hands.test 18 May 2004 00:41:46 -0000 1.13 |
| 221 | +++ testsuite/hands.test 18 May 2004 09:48:59 -0000 |
| 222 | @@ -11,19 +11,19 @@ hands_setup |
| 223 | |
| 224 | # Main script starts here |
| 225 | |
| 226 | -runtest "basic operation" 'checkit "$RSYNC -av \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"' |
| 227 | +runtest "basic operation" 'checkit "$RSYNC -adv \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"' |
| 228 | |
| 229 | ln "$fromdir/filelist" "$fromdir/dir" |
| 230 | -runtest "hard links" 'checkit "$RSYNC -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"' |
| 231 | +runtest "hard links" 'checkit "$RSYNC -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"' |
| 232 | |
| 233 | rm "$todir/text" |
| 234 | -runtest "one file" 'checkit "$RSYNC -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"' |
| 235 | +runtest "one file" 'checkit "$RSYNC -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"' |
| 236 | |
| 237 | echo "extra line" >> "$todir/text" |
| 238 | -runtest "extra data" 'checkit "$RSYNC -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"' |
| 239 | +runtest "extra data" 'checkit "$RSYNC -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"' |
| 240 | |
| 241 | cp "$fromdir/text" "$todir/ThisShouldGo" |
| 242 | -runtest " --delete" 'checkit "$RSYNC --delete -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"' |
| 243 | +runtest " --delete" 'checkit "$RSYNC --delete -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"' |
| 244 | |
| 245 | # The script would have aborted on error, so getting here means we've won. |
| 246 | exit 0 |
| 247 | --- testsuite/hardlinks.test 18 May 2004 00:41:40 -0000 1.5 |
| 248 | +++ testsuite/hardlinks.test 18 May 2004 09:48:59 -0000 |
| 249 | @@ -31,7 +31,7 @@ ln "$name1" "$name2" || fail "Can't crea |
| 250 | ln "$name2" "$name3" || fail "Can't create hardlink" |
| 251 | cp "$name2" "$name4" || fail "Can't copy file" |
| 252 | |
| 253 | -checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 254 | +checkit "$RSYNC -adHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 255 | |
| 256 | # The script would have aborted on error, so getting here means we've won. |
| 257 | exit 0 |
| 258 | --- testsuite/longdir.test 18 May 2004 09:47:42 -0000 1.11 |
| 259 | +++ testsuite/longdir.test 18 May 2004 09:48:59 -0000 |
| 260 | @@ -18,7 +18,7 @@ makepath "$longdir" || test_skipped "una |
| 261 | touch "$longdir/1" || test_skipped "unable to create files in long directory" |
| 262 | date > "$longdir/1" |
| 263 | ls -la / > "$longdir/2" |
| 264 | -checkit "$RSYNC --delete -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir" |
| 265 | +checkit "$RSYNC --delete -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir" |
| 266 | |
| 267 | # The script would have aborted on error, so getting here means we've won. |
| 268 | exit 0 |
| 269 | --- testsuite/merge.test 18 May 2004 00:41:38 -0000 1.6 |
| 270 | +++ testsuite/merge.test 18 May 2004 09:48:59 -0000 |
| 271 | @@ -40,9 +40,9 @@ cp -p "$from2dir"/sub1/uno "$from3dir"/s |
| 272 | cp -p "$from3dir"/sub2/subby "$chkdir"/sub2 |
| 273 | |
| 274 | # Get rid of any directory-time differences |
| 275 | -$RSYNC -av --existing --include='*/' --exclude='*' "$from1dir/" "$from2dir/" "$from3dir/" "$chkdir/" |
| 276 | +$RSYNC -adv --existing --include='*/' --exclude='*' "$from1dir/" "$from2dir/" "$from3dir/" "$chkdir/" |
| 277 | |
| 278 | -checkit "$RSYNC -aHvv \"$from1dir/\" \"$from2dir/\" \"$from3dir/\" \"$todir/\"" "$chkdir" "$todir" |
| 279 | +checkit "$RSYNC -adHvv \"$from1dir/\" \"$from2dir/\" \"$from3dir/\" \"$todir/\"" "$chkdir" "$todir" |
| 280 | |
| 281 | # The script would have aborted on error, so getting here means we've won. |
| 282 | exit 0 |
| 283 | --- testsuite/ssh-basic.test 18 May 2004 00:41:46 -0000 1.7 |
| 284 | +++ testsuite/ssh-basic.test 18 May 2004 09:48:59 -0000 |
| 285 | @@ -28,7 +28,7 @@ fi |
| 286 | # nothing to do. |
| 287 | hands_setup |
| 288 | |
| 289 | -runtest "ssh: basic test" 'checkit "$RSYNC -avH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"' |
| 290 | +runtest "ssh: basic test" 'checkit "$RSYNC -advH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"' |
| 291 | |
| 292 | # Added by Steve Bonds Feb 2 2003 |
| 293 | # I assumed that "F1" was intended to hold a single file for testing if |
| 294 | @@ -40,4 +40,4 @@ F1=`ls "$todir" | head -5 | tail -1` |
| 295 | |
| 296 | mv "$todir/$F1" "$todir/ThisShouldGo" |
| 297 | |
| 298 | -runtest "ssh: renamed file" 'checkit "$RSYNC --delete -avH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"' |
| 299 | +runtest "ssh: renamed file" 'checkit "$RSYNC --delete -advH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"' |
| 300 | --- testsuite/unsafe-links.test 18 May 2004 00:41:43 -0000 1.7 |
| 301 | +++ testsuite/unsafe-links.test 18 May 2004 09:48:59 -0000 |
| 302 | @@ -35,33 +35,33 @@ ln -s ../../unsafe/unsafefile "from/safe |
| 303 | set -x |
| 304 | |
| 305 | echo "rsync with relative path and just -a"; |
| 306 | -$RSYNC -avv from/safe/ to |
| 307 | +$RSYNC -advv from/safe/ to |
| 308 | test_symlink to/links/file1 |
| 309 | test_symlink to/links/file2 |
| 310 | test_symlink to/links/unsafefile |
| 311 | |
| 312 | echo "rsync with relative path and -a --copy-links" |
| 313 | -$RSYNC -avv --copy-links from/safe/ to |
| 314 | +$RSYNC -advv --copy-links from/safe/ to |
| 315 | test_regular to/links/file1 |
| 316 | test_regular to/links/file2 |
| 317 | test_regular to/links/unsafefile |
| 318 | |
| 319 | echo "rsync with relative path and --copy-unsafe-links"; |
| 320 | -$RSYNC -avv --copy-unsafe-links from/safe/ to |
| 321 | +$RSYNC -advv --copy-unsafe-links from/safe/ to |
| 322 | test_symlink to/links/file1 |
| 323 | test_symlink to/links/file2 |
| 324 | test_regular to/links/unsafefile |
| 325 | |
| 326 | rm -rf to |
| 327 | echo "rsync with relative2 path"; |
| 328 | -(cd from; $RSYNC -avv --copy-unsafe-links safe/ ../to) |
| 329 | +(cd from; $RSYNC -advv --copy-unsafe-links safe/ ../to) |
| 330 | test_symlink to/links/file1 |
| 331 | test_symlink to/links/file2 |
| 332 | test_regular to/links/unsafefile |
| 333 | |
| 334 | rm -rf to |
| 335 | echo "rsync with absolute path"; |
| 336 | -$RSYNC -avv --copy-unsafe-links `pwd`/from/safe/ to |
| 337 | +$RSYNC -advv --copy-unsafe-links `pwd`/from/safe/ to |
| 338 | test_symlink to/links/file1 |
| 339 | test_symlink to/links/file2 |
| 340 | test_regular to/links/unsafefile |