Skip to content

Commit

Permalink
Avoid spurious "is newer" messages with --update.
Browse files Browse the repository at this point in the history
  • Loading branch information
WayneD committed Sep 21, 2020
1 parent a79d9b2 commit fd6839b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
2 changes: 1 addition & 1 deletion generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions testsuite/exclude.test
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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).
Expand Down Expand Up @@ -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"

Expand Down

0 comments on commit fd6839b

Please sign in to comment.