Fixed failing hunks and/or fuzz.
[rsync/rsync-patches.git] / dir-times.diff
CommitLineData
6de33581 1--- options.c 6 May 2004 21:08:01 -0000 1.148
7f2baf27 2+++ options.c 13 May 2004 18:59:46 -0000
6de33581
WD
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)
7f2baf27
WD
38--- rsync.c 13 May 2004 18:51:22 -0000 1.138
39+++ rsync.c 13 May 2004 18:59:47 -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
6de33581
WD
49 st = &st2;
50 }
51
52- if (!preserve_times || S_ISLNK(st->st_mode))
7f2baf27 53- flags |= PERMS_SKIP_MTIME;
6de33581
WD
54+ if (S_ISDIR(st->st_mode)) {
55+ if (!preserve_dir_times)
7f2baf27 56+ flags |= PERMS_SKIP_MTIME;
6de33581
WD
57+ } else {
58+ if (!preserve_times || S_ISLNK(st->st_mode))
7f2baf27 59+ flags |= PERMS_SKIP_MTIME;
6de33581 60+ }
7f2baf27 61 if (!(flags & PERMS_SKIP_MTIME)
6de33581
WD
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) {
fe6407b5
WD
68 rsyserr(FERROR, errno, "failed to set times on %s",
69 full_fname(fname));
6de33581
WD
70 return 0;
71--- rsync.yo 7 May 2004 00:18:37 -0000 1.169
7f2baf27 72+++ rsync.yo 13 May 2004 18:59:47 -0000
6de33581
WD
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 5 Feb 2004 01:37:08 -0000 1.10
7f2baf27 109+++ testsuite/chgrp.test 13 May 2004 18:59:47 -0000
6de33581
WD
110@@ -29,7 +29,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 4 Feb 2004 18:24:41 -0000 1.4
7f2baf27 120+++ testsuite/chown.test 13 May 2004 18:59:47 -0000
6de33581
WD
121@@ -31,7 +31,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 4 Feb 2004 18:24:41 -0000 1.6
7f2baf27 131+++ testsuite/daemon-gzip-download.test 13 May 2004 18:59:47 -0000
6de33581
WD
132@@ -27,7 +27,7 @@ RSYNC_CONNECT_PROG="$RSYNC --config=$con
133 export RSYNC_CONNECT_PROG
134
135 hands_setup
136-checkit "$RSYNC -avvvvz localhost::test-from/ \"$TO/\"" "$FROM" "$TO"
137+checkit "$RSYNC -advvvvz localhost::test-from/ \"$TO/\"" "$FROM" "$TO"
138
139 # The script would have aborted on error, so getting here means we've won.
140 exit 0
141--- testsuite/daemon-gzip-upload.test 4 Feb 2004 18:24:41 -0000 1.6
7f2baf27 142+++ testsuite/daemon-gzip-upload.test 13 May 2004 18:59:47 -0000
6de33581
WD
143@@ -21,7 +21,7 @@ RSYNC_CONNECT_PROG="$RSYNC --config=$con
144 export RSYNC_CONNECT_PROG
145
146 hands_setup
147-checkit "$RSYNC -avvvvz \"$FROM/\" localhost::test-to/" "$FROM" "$TO"
148+checkit "$RSYNC -advvvvz \"$FROM/\" localhost::test-to/" "$FROM" "$TO"
149
150 # The script would have aborted on error, so getting here means we've won.
151 exit 0
152--- testsuite/devices.test 9 Apr 2004 00:36:45 -0000 1.7
7f2baf27 153+++ testsuite/devices.test 13 May 2004 18:59:47 -0000
6de33581
WD
154@@ -32,7 +32,7 @@ mknod "$fromdir/block" b 42 69 || test_s
155 mknod "$fromdir/block2" b 42 73 || test_skipped "Can't create block device node unless root"
156 mknod "$fromdir/block3" b 105 73 || test_skipped "Can't create block device node unless root"
157
158-checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
159+checkit "$RSYNC -adHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
160
161 # The script would have aborted on error, so getting here means we've won.
162 exit 0
163--- testsuite/duplicates.test 4 Feb 2004 18:24:41 -0000 1.9
7f2baf27 164+++ testsuite/duplicates.test 13 May 2004 18:59:47 -0000
6de33581
WD
165@@ -36,7 +36,7 @@ ln -s "$name1" "$name2" || fail "can't c
166
167 outfile="$scratchdir/rsync.out"
168
169-checkit "$RSYNC -avv \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" \
170+checkit "$RSYNC -advv \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" \
171 | tee "$outfile"
172
173 # Make sure each file was only copied once...
174--- testsuite/exclude.test 14 Apr 2004 20:50:32 -0000 1.5
7f2baf27 175+++ testsuite/exclude.test 13 May 2004 18:59:47 -0000
6de33581
WD
176@@ -67,7 +67,7 @@ EOF
177
178 # Create the chk dir with what we expect to be excluded
179
180-checkit "$RSYNC -avv \"$fromdir/\" \"$chkdir/\"" "$fromdir" "$chkdir"
181+checkit "$RSYNC -advv \"$fromdir/\" \"$chkdir/\"" "$fromdir" "$chkdir"
182
183 sleep 1 # Ensures that the rm commands will tweak the directory times.
184
185@@ -79,11 +79,11 @@ rm "$chkdir"/mid/for/foo/extra
186
187 # Un-tweak the directory times in our first (weak) exclude test (though
188 # it's a good test of the --existing option).
189-$RSYNC -av --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
190+$RSYNC -adv --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
191
192 # Now, test if rsync excludes the same files.
193
194-checkit "$RSYNC -avv --exclude-from=$excl \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
195+checkit "$RSYNC -advv --exclude-from=$excl \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
196
197 # Modify the chk dir by removing cvs-ignored files and then tweaking the dir times.
198
199@@ -93,12 +93,12 @@ rm "$chkdir"/bar/down/to/foo/*.junk
200 rm "$chkdir"/bar/down/to/home-cvs-exclude
201 rm "$chkdir"/mid/one-in-one-out
202
203-$RSYNC -av --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
204+$RSYNC -adv --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
205
206 # Now, test if rsync excludes the same files, this time with --cvs-exclude
207 # and --delete-excluded.
208
209-checkit "$RSYNC -avvC --delete-excluded --exclude-from=$excl \
210+checkit "$RSYNC -advvC --delete-excluded --exclude-from=$excl \
211 \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
212
213 # The script would have aborted on error, so getting here means we've won.
214--- testsuite/hands.test 4 Feb 2004 18:24:41 -0000 1.12
7f2baf27 215+++ testsuite/hands.test 13 May 2004 18:59:47 -0000
6de33581
WD
216@@ -11,19 +11,19 @@ hands_setup
217
218 # Main script starts here
219
220-runtest "basic operation" 'checkit "$RSYNC -av ${FROM}/ ${TO}" ${FROM}/ ${TO}'
221+runtest "basic operation" 'checkit "$RSYNC -adv ${FROM}/ ${TO}" ${FROM}/ ${TO}'
222
223 ln ${FROM}/filelist ${FROM}/dir
224-runtest "hard links" 'checkit "$RSYNC -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}'
225+runtest "hard links" 'checkit "$RSYNC -advH ${FROM}/ ${TO}" ${FROM}/ ${TO}'
226
227 rm ${TO}/text
228-runtest "one file" 'checkit "$RSYNC -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}'
229+runtest "one file" 'checkit "$RSYNC -advH ${FROM}/ ${TO}" ${FROM}/ ${TO}'
230
231 echo "extra line" >> ${TO}/text
232-runtest "extra data" 'checkit "$RSYNC -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}'
233+runtest "extra data" 'checkit "$RSYNC -advH ${FROM}/ ${TO}" ${FROM}/ ${TO}'
234
235 cp ${FROM}/text ${TO}/ThisShouldGo
236-runtest " --delete" 'checkit "$RSYNC --delete -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}'
237+runtest " --delete" 'checkit "$RSYNC --delete -advH ${FROM}/ ${TO}" ${FROM}/ ${TO}'
238
239 # The script would have aborted on error, so getting here means we've won.
240 exit 0
241--- testsuite/hardlinks.test 4 Feb 2004 18:24:41 -0000 1.4
7f2baf27 242+++ testsuite/hardlinks.test 13 May 2004 18:59:47 -0000
6de33581
WD
243@@ -31,7 +31,7 @@ ln "$name1" "$name2" || fail "Can't crea
244 ln "$name2" "$name3" || fail "Can't create hardlink"
245 cp "$name2" "$name4" || fail "Can't copy file"
246
247-checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
248+checkit "$RSYNC -adHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
249
250 # The script would have aborted on error, so getting here means we've won.
251 exit 0
252--- testsuite/longdir.test 4 Feb 2004 18:24:41 -0000 1.9
7f2baf27 253+++ testsuite/longdir.test 13 May 2004 18:59:47 -0000
6de33581
WD
254@@ -18,7 +18,7 @@ makepath $LONGDIR || test_skipped "unabl
255 touch $LONGDIR/1 || test_skipped "unable to create files in long directory"
256 date > ${LONGDIR}/1
257 ls -la / > ${LONGDIR}/2
258-checkit "$RSYNC --delete -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}
259+checkit "$RSYNC --delete -advH ${FROM}/ ${TO}" ${FROM}/ ${TO}
260
261 # The script would have aborted on error, so getting here means we've won.
262 exit 0
263--- testsuite/merge.test 30 Apr 2004 17:24:49 -0000 1.5
7f2baf27 264+++ testsuite/merge.test 13 May 2004 18:59:47 -0000
6de33581
WD
265@@ -43,9 +43,9 @@ cp -p "$from2dir"/sub1/uno "$from3dir"/s
266 cp -p "$from3dir"/sub2/subby "$chkdir"/sub2
267
268 # Get rid of any directory-time differences
269-$RSYNC -av --existing --include='*/' --exclude='*' "$from1dir/" "$from2dir/" "$from3dir/" "$chkdir/"
270+$RSYNC -adv --existing --include='*/' --exclude='*' "$from1dir/" "$from2dir/" "$from3dir/" "$chkdir/"
271
272-checkit "$RSYNC -aHvv \"$from1dir/\" \"$from2dir/\" \"$from3dir/\" \"$todir/\"" "$chkdir" "$todir"
273+checkit "$RSYNC -adHvv \"$from1dir/\" \"$from2dir/\" \"$from3dir/\" \"$todir/\"" "$chkdir" "$todir"
274
275 # The script would have aborted on error, so getting here means we've won.
276 exit 0
277--- testsuite/ssh-basic.test 19 Feb 2003 16:22:50 -0000 1.6
7f2baf27 278+++ testsuite/ssh-basic.test 13 May 2004 18:59:47 -0000
6de33581
WD
279@@ -28,7 +28,7 @@ fi
280 # nothing to do.
281 hands_setup
282
283-runtest "ssh: basic test" 'checkit "$RSYNC -avH -e ssh --rsync-path=$RSYNC ${FROM}/ localhost:${TO}" ${FROM}/ ${TO}'
284+runtest "ssh: basic test" 'checkit "$RSYNC -advH -e ssh --rsync-path=$RSYNC ${FROM}/ localhost:${TO}" ${FROM}/ ${TO}'
285
286 # Added by Steve Bonds Feb 2 2003
287 # I assumed that "F1" was intended to hold a single file for testing if
288@@ -40,4 +40,4 @@ F1=`ls ${TO} | head -5 | tail -1`
289
290 mv ${TO}/${F1} ${TO}/ThisShouldGo
291
292-runtest "ssh: renamed file" 'checkit "$RSYNC --delete -avH -e ssh --rsync-path=$RSYNC ${FROM}/ localhost:${TO}" ${FROM}/ ${TO}'
293+runtest "ssh: renamed file" 'checkit "$RSYNC --delete -advH -e ssh --rsync-path=$RSYNC ${FROM}/ localhost:${TO}" ${FROM}/ ${TO}'
294--- testsuite/unsafe-links.test 15 Jan 2003 16:14:07 -0000 1.6
7f2baf27 295+++ testsuite/unsafe-links.test 13 May 2004 18:59:47 -0000
6de33581
WD
296@@ -35,33 +35,33 @@ ln -s ../../unsafe/unsafefile "from/safe
297 set -x
298
299 echo "rsync with relative path and just -a";
300-$RSYNC -avv from/safe/ to
301+$RSYNC -advv from/safe/ to
302 test_symlink to/links/file1
303 test_symlink to/links/file2
304 test_symlink to/links/unsafefile
305
306 echo "rsync with relative path and -a --copy-links"
307-$RSYNC -avv --copy-links from/safe/ to
308+$RSYNC -advv --copy-links from/safe/ to
309 test_regular to/links/file1
310 test_regular to/links/file2
311 test_regular to/links/unsafefile
312
313 echo "rsync with relative path and --copy-unsafe-links";
314-$RSYNC -avv --copy-unsafe-links from/safe/ to
315+$RSYNC -advv --copy-unsafe-links from/safe/ to
316 test_symlink to/links/file1
317 test_symlink to/links/file2
318 test_regular to/links/unsafefile
319
320 rm -rf to
321 echo "rsync with relative2 path";
322-(cd from; $RSYNC -avv --copy-unsafe-links safe/ ../to)
323+(cd from; $RSYNC -advv --copy-unsafe-links safe/ ../to)
324 test_symlink to/links/file1
325 test_symlink to/links/file2
326 test_regular to/links/unsafefile
327
328 rm -rf to
329 echo "rsync with absolute path";
330-$RSYNC -avv --copy-unsafe-links `pwd`/from/safe/ to
331+$RSYNC -advv --copy-unsafe-links `pwd`/from/safe/ to
332 test_symlink to/links/file1
333 test_symlink to/links/file2
334 test_regular to/links/unsafefile