Avoid spurious "is newer" messages with `--update`.
authorWayne Davison <wayne@opencoder.net>
Mon, 21 Sep 2020 17:44:18 +0000 (10:44 -0700)
committerWayne Davison <wayne@opencoder.net>
Mon, 21 Sep 2020 18:07:42 +0000 (11:07 -0700)
NEWS.md
generator.c
testsuite/exclude.test

diff --git a/NEWS.md b/NEWS.md
index 0d65d2e5a5eecbb2f591136aaaef4cf33e3f4b72..87119e4c6218cfb20335550449cbc13ab4b19aa5 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -9,6 +9,10 @@
  - Fix a bug with `--mkpath` if a single-file copy specifies an existing
    destination dir with a non-existing destination filename.
 
+ - Fix `--update -vv` to output "is uptodate" instead of "is newer" messages
+   for files that are being skipped due to an identical modify time.  (This
+   was a new output quirk in 3.2.3.)
+
  - Avoid a weird failure if you run a local copy with a (useless) `--rsh`
    option that contains a `V`.
 
index f1780838aec5c87aff73b82b213e098c03470bda..f83ac501b3d0a50120ba7909fa182c2e048fd345 100644 (file)
@@ -1703,7 +1703,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                goto cleanup;
        }
 
-       if (update_only > 0 && statret == 0 && file->modtime - sx.st.st_mtime <= modify_window) {
+       if (update_only > 0 && statret == 0 && file->modtime - sx.st.st_mtime < modify_window) {
                if (INFO_GTE(SKIP, 1))
                        rprintf(FINFO, "%s is newer\n", fname);
 #ifdef SUPPORT_HARD_LINKS
index fad4fd721a086d0fdb89e7524e3918931e573546..f9d1a99092fb5b1e63583cdaf5e65d6ede02e7af 100644 (file)
@@ -118,7 +118,8 @@ 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/dst-newness" "$scratchdir/up2/src-newness"
+touch "$scratchdir/up1/same-newness" "$scratchdir/up2/same-newness"
 touch "$scratchdir/up1/extra-src" "$scratchdir/up2/extra-dest"
 
 # Create chkdir with what we expect to be excluded.
@@ -133,7 +134,7 @@ 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"
+touch "$scratchdir/up1/src-newness" "$scratchdir/up2/dst-newness"
 
 # Un-tweak the directory times in our first (weak) exclude test (though
 # it's a good test of the --existing option).
@@ -227,11 +228,14 @@ 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/" \
+$RSYNC -aiiO --update --info=skip "$scratchdir/up1/" "$scratchdir/up2/" \
     | tee "$outfile"
 cat <<EOT >"$chkfile"
+dst-newness is newer
+.d          ./
 >f$all_plus extra-src
->f..t.$dots newer
+.f$allspace same-newness
+>f..t.$dots src-newness
 EOT
 diff $diffopt "$chkfile" "$outfile" || test_fail "--update test failed"