diff options
author | Wayne Davison <wayne@opencoder.net> | 2020-06-13 02:32:15 -0700 |
---|---|---|
committer | Wayne Davison <wayne@opencoder.net> | 2020-06-13 02:41:30 -0700 |
commit | d32696129097fcc2c0560da2f6b1d481b854a2b9 (patch) | |
tree | 71ffdbb26de5673ca1b5d878ef782637c870ceb9 /testsuite/exclude.test | |
parent | 7dec4029ee4580e5990c062f0b3093e39f800fbf (diff) | |
download | rsync-d32696129097fcc2c0560da2f6b1d481b854a2b9.tar.gz |
Fix overzealous setting of mtime & tweak time comparisons
- Stop setting the mtime on a file we didn't transfer (or didn't verify
the checksum) when the time diff is within the modify window.
- Stop computing a time difference (-1|0|1) when all we care about is
time equality.
Diffstat (limited to 'testsuite/exclude.test')
-rw-r--r-- | testsuite/exclude.test | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/testsuite/exclude.test b/testsuite/exclude.test index 099344f2..fad4fd72 100644 --- a/testsuite/exclude.test +++ b/testsuite/exclude.test @@ -1,6 +1,6 @@ #! /bin/sh -# Copyright (C) 2003, 2004, 2005 by Wayne Davison <wayned@samba.org> +# Copyright (C) 2003-2020 Wayne Davison # This program is distributable under the terms of the GNU GPL (see # COPYING). @@ -12,6 +12,9 @@ . "$suitedir/rsync.fns" +chkfile="$scratchdir/rsync.chk" +outfile="$scratchdir/rsync.out" + CVSIGNORE='*.junk' export CVSIGNORE @@ -113,6 +116,11 @@ rm -rf "$todir" # Add a directory symlink. ln -s too "$fromdir/bar/down/to/foo/sym" +# Start to prep an --update test dir +mkdir "$scratchdir/up1" "$scratchdir/up2" +touch "$scratchdir/up1/older" "$scratchdir/up2/newer" +touch "$scratchdir/up1/extra-src" "$scratchdir/up2/extra-dest" + # Create chkdir with what we expect to be excluded. checkit "$RSYNC -avv '$fromdir/' '$chkdir/'" "$fromdir" "$chkdir" sleep 1 # Ensures that the rm commands will tweak the directory times. @@ -124,6 +132,9 @@ rm "$chkdir"/foo/file[235-9] rm "$chkdir"/bar/down/to/foo/to "$chkdir"/bar/down/to/foo/file[235-9] rm "$chkdir"/mid/for/foo/extra +# Finish prep for the --update test (run last) +touch "$scratchdir/up1/newer" "$scratchdir/up2/older" + # Un-tweak the directory times in our first (weak) exclude test (though # it's a good test of the --existing option). $RSYNC -av --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/" @@ -215,5 +226,14 @@ $RSYNC -av $relative_opts --existing --filter='-! */' "$fromdir/foo" "$chkdir/" checkit "$RSYNC -avv $relative_opts --exclude='$fromdir/foo/down' \ '$fromdir/foo' '$todir'" "$chkdir$fromdir/foo" "$todir$fromdir/foo" +# Now we'll test the --update option. +$RSYNC -aiO --update touch "$scratchdir/up1/" "$scratchdir/up2/" \ + | tee "$outfile" +cat <<EOT >"$chkfile" +>f$all_plus extra-src +>f..t.$dots newer +EOT +diff $diffopt "$chkfile" "$outfile" || test_fail "--update test failed" + # The script would have aborted on error, so getting here means we've won. exit 0 |