From d32696129097fcc2c0560da2f6b1d481b854a2b9 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 13 Jun 2020 02:32:15 -0700 Subject: 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. --- testsuite/exclude.test | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'testsuite') 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 +# 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 <"$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 -- cgit v1.2.1