1 --- options.c 22 May 2004 06:09:22 -0000 1.151
2 +++ options.c 22 May 2004 19:31:28 -0000
3 @@ -46,6 +46,7 @@ int preserve_devices = 0;
6 int preserve_times = 0;
7 +int preserve_dir_times = 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 @@ -347,6 +349,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 @@ -824,6 +827,8 @@ void server_options(char **args,int *arg
33 + if (preserve_dir_times && am_sender)
38 --- rsync.c 21 May 2004 08:43:03 -0000 1.140
39 +++ rsync.c 22 May 2004 19:31:28 -0000
43 extern int preserve_times;
44 +extern int preserve_dir_times;
47 extern int am_generator;
48 @@ -140,15 +141,16 @@ int set_perms(char *fname,struct file_st
52 - if (!preserve_times || S_ISLNK(st->st_mode)
53 - || (make_backups && !backup_dir && S_ISDIR(st->st_mode)))
54 - flags |= PERMS_SKIP_MTIME;
55 + if (S_ISDIR(st->st_mode)) {
56 + if (!preserve_dir_times || (make_backups && !backup_dir))
57 + flags |= PERMS_SKIP_MTIME;
59 + if (!preserve_times || S_ISLNK(st->st_mode))
60 + flags |= PERMS_SKIP_MTIME;
62 if (!(flags & PERMS_SKIP_MTIME)
63 && cmp_modtime(st->st_mtime, file->modtime) != 0) {
64 - /* don't complain about not setting times on directories
65 - * because some filesystems can't do it */
66 - if (set_modtime(fname,file->modtime) != 0 &&
67 - !S_ISDIR(st->st_mode)) {
68 + if (set_modtime(fname,file->modtime) != 0) {
69 rsyserr(FERROR, errno, "failed to set times on %s",
72 --- rsync.yo 21 May 2004 09:44:32 -0000 1.170
73 +++ rsync.yo 22 May 2004 19:31:29 -0000
74 @@ -298,7 +298,8 @@ verb(
75 -o, --owner preserve owner (root only)
76 -g, --group preserve group
77 -D, --devices preserve devices (root only)
78 - -t, --times preserve times
79 + -t, --times preserve times on non-directories
80 + -d, --dir-times preserve times on directories
81 -S, --sparse handle sparse files efficiently
82 -n, --dry-run show what would have been transferred
83 -W, --whole-file copy whole files, no incremental checks
84 @@ -539,14 +540,23 @@ dit(bf(-D, --devices)) This option cause
85 block device information to the remote system to recreate these
86 devices. This option is only available to the super-user.
88 -dit(bf(-t, --times)) This tells rsync to transfer modification times along
89 -with the files and update them on the remote system. Note that if this
90 +dit(bf(-t, --times)) This tells rsync to preserve modification times of
91 +non-directories transferred to the remote system. Note that if this
92 option is not used, the optimization that excludes files that have not been
93 modified cannot be effective; in other words, a missing -t or -a will
94 cause the next transfer to behave as if it used -I, and all files will have
95 their checksums compared and show up in log messages even if they haven't
98 +dit(bf(-d, --dir-times)) This tells rsync to preserve the modification
99 +times of directories transferred to the remote system. On a modern
100 +rsync, these are left unpreserved by default to avoid causing problems
103 +Note: when sending files to an older rsync, the --times option will
104 +imply --dir-times (if the option causes an error on the receiving
105 +system, omit it and use --times to preserve all file/directory times).
107 dit(bf(-n, --dry-run)) This tells rsync to not do any file transfers,
108 instead it will just report the actions it would have taken.
110 --- testsuite/chgrp.test 21 May 2004 10:06:09 -0000 1.12
111 +++ testsuite/chgrp.test 22 May 2004 19:31:29 -0000
116 -checkit "$RSYNC -rtgpvvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
117 +checkit "$RSYNC -rtdgpvvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
119 # The script would have aborted on error, so getting here means we've won.
121 --- testsuite/chown.test 18 May 2004 00:41:35 -0000 1.5
122 +++ testsuite/chown.test 22 May 2004 19:31:29 -0000
123 @@ -28,7 +28,7 @@ chown 5001 "$name2" || test_skipped "Can
124 chgrp 5002 "$name1" || test_skipped "Can't chgrp (probably need root)"
125 chgrp 5003 "$name2" || test_skipped "Can't chgrp (probably need root)"
127 -checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
128 +checkit "$RSYNC -adHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
130 # The script would have aborted on error, so getting here means we've won.
132 --- testsuite/daemon-gzip-download.test 18 May 2004 00:41:51 -0000 1.7
133 +++ testsuite/daemon-gzip-download.test 22 May 2004 19:31:29 -0000
134 @@ -29,9 +29,9 @@ export RSYNC_CONNECT_PROG
137 # Build chkdir with a normal rsync and an --exclude.
138 -$RSYNC -av --exclude=foobar.baz "$fromdir/" "$chkdir/"
139 +$RSYNC -adv --exclude=foobar.baz "$fromdir/" "$chkdir/"
141 -checkit "$RSYNC -avvvvz localhost::test-from/ \"$todir/\"" "$chkdir" "$todir"
142 +checkit "$RSYNC -advvvvz localhost::test-from/ \"$todir/\"" "$chkdir" "$todir"
144 # The script would have aborted on error, so getting here means we've won.
146 --- testsuite/daemon-gzip-upload.test 18 May 2004 00:41:51 -0000 1.7
147 +++ testsuite/daemon-gzip-upload.test 22 May 2004 19:31:29 -0000
148 @@ -23,9 +23,9 @@ export RSYNC_CONNECT_PROG
151 # Build chkdir with a normal rsync and an --exclude.
152 -$RSYNC -av --exclude=foobar.baz "$fromdir/" "$chkdir/"
153 +$RSYNC -adv --exclude=foobar.baz "$fromdir/" "$chkdir/"
155 -checkit "$RSYNC -avvvvz \"$fromdir/\" localhost::test-to/" "$chkdir" "$todir"
156 +checkit "$RSYNC -advvvvz \"$fromdir/\" localhost::test-to/" "$chkdir" "$todir"
158 # The script would have aborted on error, so getting here means we've won.
160 --- testsuite/devices.test 18 May 2004 00:41:35 -0000 1.8
161 +++ testsuite/devices.test 22 May 2004 19:31:29 -0000
162 @@ -29,7 +29,7 @@ mknod "$fromdir/block" b 42 69 || test_s
163 mknod "$fromdir/block2" b 42 73 || test_skipped "Can't create block device node unless root"
164 mknod "$fromdir/block3" b 105 73 || test_skipped "Can't create block device node unless root"
166 -checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
167 +checkit "$RSYNC -adHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
169 # The script would have aborted on error, so getting here means we've won.
171 --- testsuite/duplicates.test 18 May 2004 00:41:35 -0000 1.10
172 +++ testsuite/duplicates.test 22 May 2004 19:31:29 -0000
173 @@ -33,7 +33,7 @@ ln -s "$name1" "$name2" || fail "can't c
175 outfile="$scratchdir/rsync.out"
177 -checkit "$RSYNC -avv \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" \
178 +checkit "$RSYNC -advv \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" \
181 # Make sure each file was only copied once...
182 --- testsuite/exclude.test 22 May 2004 19:29:53 -0000 1.7
183 +++ testsuite/exclude.test 22 May 2004 19:31:29 -0000
184 @@ -63,7 +63,7 @@ EOF
186 # Create the chk dir with what we expect to be excluded
188 -checkit "$RSYNC -avv \"$fromdir/\" \"$chkdir/\"" "$fromdir" "$chkdir"
189 +checkit "$RSYNC -advv \"$fromdir/\" \"$chkdir/\"" "$fromdir" "$chkdir"
191 sleep 1 # Ensures that the rm commands will tweak the directory times.
193 @@ -75,11 +75,11 @@ rm "$chkdir"/mid/for/foo/extra
195 # Un-tweak the directory times in our first (weak) exclude test (though
196 # it's a good test of the --existing option).
197 -$RSYNC -av --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
198 +$RSYNC -adv --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
200 # Now, test if rsync excludes the same files.
202 -checkit "$RSYNC -avv --exclude-from=$excl \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
203 +checkit "$RSYNC -advv --exclude-from=$excl \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
205 # Modify the chk dir by removing cvs-ignored files and then tweaking the dir times.
207 @@ -89,12 +89,12 @@ rm "$chkdir"/bar/down/to/foo/*.junk
208 rm "$chkdir"/bar/down/to/home-cvs-exclude
209 rm "$chkdir"/mid/one-in-one-out
211 -$RSYNC -av --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
212 +$RSYNC -adv --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
214 # Now, test if rsync excludes the same files, this time with --cvs-exclude
215 # and --delete-excluded.
217 -checkit "$RSYNC -avvC --delete-excluded --exclude-from=$excl \
218 +checkit "$RSYNC -advvC --delete-excluded --exclude-from=$excl \
219 \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
221 # The script would have aborted on error, so getting here means we've won.
222 --- testsuite/hands.test 18 May 2004 00:41:46 -0000 1.13
223 +++ testsuite/hands.test 22 May 2004 19:31:29 -0000
224 @@ -11,19 +11,19 @@ hands_setup
226 # Main script starts here
228 -runtest "basic operation" 'checkit "$RSYNC -av \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
229 +runtest "basic operation" 'checkit "$RSYNC -adv \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
231 ln "$fromdir/filelist" "$fromdir/dir"
232 -runtest "hard links" 'checkit "$RSYNC -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
233 +runtest "hard links" 'checkit "$RSYNC -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
236 -runtest "one file" 'checkit "$RSYNC -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
237 +runtest "one file" 'checkit "$RSYNC -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
239 echo "extra line" >> "$todir/text"
240 -runtest "extra data" 'checkit "$RSYNC -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
241 +runtest "extra data" 'checkit "$RSYNC -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
243 cp "$fromdir/text" "$todir/ThisShouldGo"
244 -runtest " --delete" 'checkit "$RSYNC --delete -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
245 +runtest " --delete" 'checkit "$RSYNC --delete -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
247 # The script would have aborted on error, so getting here means we've won.
249 --- testsuite/hardlinks.test 18 May 2004 00:41:40 -0000 1.5
250 +++ testsuite/hardlinks.test 22 May 2004 19:31:29 -0000
251 @@ -31,7 +31,7 @@ ln "$name1" "$name2" || fail "Can't crea
252 ln "$name2" "$name3" || fail "Can't create hardlink"
253 cp "$name2" "$name4" || fail "Can't copy file"
255 -checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
256 +checkit "$RSYNC -adHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
258 # The script would have aborted on error, so getting here means we've won.
260 --- testsuite/longdir.test 18 May 2004 09:47:42 -0000 1.11
261 +++ testsuite/longdir.test 22 May 2004 19:31:29 -0000
262 @@ -18,7 +18,7 @@ makepath "$longdir" || test_skipped "una
263 touch "$longdir/1" || test_skipped "unable to create files in long directory"
265 ls -la / > "$longdir/2"
266 -checkit "$RSYNC --delete -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"
267 +checkit "$RSYNC --delete -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"
269 # The script would have aborted on error, so getting here means we've won.
271 --- testsuite/merge.test 18 May 2004 00:41:38 -0000 1.6
272 +++ testsuite/merge.test 22 May 2004 19:31:29 -0000
273 @@ -40,9 +40,9 @@ cp -p "$from2dir"/sub1/uno "$from3dir"/s
274 cp -p "$from3dir"/sub2/subby "$chkdir"/sub2
276 # Get rid of any directory-time differences
277 -$RSYNC -av --existing --include='*/' --exclude='*' "$from1dir/" "$from2dir/" "$from3dir/" "$chkdir/"
278 +$RSYNC -adv --existing --include='*/' --exclude='*' "$from1dir/" "$from2dir/" "$from3dir/" "$chkdir/"
280 -checkit "$RSYNC -aHvv \"$from1dir/\" \"$from2dir/\" \"$from3dir/\" \"$todir/\"" "$chkdir" "$todir"
281 +checkit "$RSYNC -adHvv \"$from1dir/\" \"$from2dir/\" \"$from3dir/\" \"$todir/\"" "$chkdir" "$todir"
283 # The script would have aborted on error, so getting here means we've won.
285 --- testsuite/ssh-basic.test 18 May 2004 00:41:46 -0000 1.7
286 +++ testsuite/ssh-basic.test 22 May 2004 19:31:29 -0000
291 -runtest "ssh: basic test" 'checkit "$RSYNC -avH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"'
292 +runtest "ssh: basic test" 'checkit "$RSYNC -advH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"'
294 # Added by Steve Bonds Feb 2 2003
295 # I assumed that "F1" was intended to hold a single file for testing if
296 @@ -40,4 +40,4 @@ F1=`ls "$todir" | head -5 | tail -1`
298 mv "$todir/$F1" "$todir/ThisShouldGo"
300 -runtest "ssh: renamed file" 'checkit "$RSYNC --delete -avH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"'
301 +runtest "ssh: renamed file" 'checkit "$RSYNC --delete -advH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"'
302 --- testsuite/unsafe-links.test 18 May 2004 00:41:43 -0000 1.7
303 +++ testsuite/unsafe-links.test 22 May 2004 19:31:29 -0000
304 @@ -35,33 +35,33 @@ ln -s ../../unsafe/unsafefile "from/safe
307 echo "rsync with relative path and just -a";
308 -$RSYNC -avv from/safe/ to
309 +$RSYNC -advv from/safe/ to
310 test_symlink to/links/file1
311 test_symlink to/links/file2
312 test_symlink to/links/unsafefile
314 echo "rsync with relative path and -a --copy-links"
315 -$RSYNC -avv --copy-links from/safe/ to
316 +$RSYNC -advv --copy-links from/safe/ to
317 test_regular to/links/file1
318 test_regular to/links/file2
319 test_regular to/links/unsafefile
321 echo "rsync with relative path and --copy-unsafe-links";
322 -$RSYNC -avv --copy-unsafe-links from/safe/ to
323 +$RSYNC -advv --copy-unsafe-links from/safe/ to
324 test_symlink to/links/file1
325 test_symlink to/links/file2
326 test_regular to/links/unsafefile
329 echo "rsync with relative2 path";
330 -(cd from; $RSYNC -avv --copy-unsafe-links safe/ ../to)
331 +(cd from; $RSYNC -advv --copy-unsafe-links safe/ ../to)
332 test_symlink to/links/file1
333 test_symlink to/links/file2
334 test_regular to/links/unsafefile
337 echo "rsync with absolute path";
338 -$RSYNC -avv --copy-unsafe-links `pwd`/from/safe/ to
339 +$RSYNC -advv --copy-unsafe-links `pwd`/from/safe/ to
340 test_symlink to/links/file1
341 test_symlink to/links/file2
342 test_regular to/links/unsafefile