mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-10-28 08:38:19 -04:00
testsuite: fix timestamp race in exclude test (#1120)
* testsuite: fix timestamp race in exclude test The same-newness files must have equal modification times, but separate touch calls can straddle a second boundary and make the destination newer. This causes --update to skip it unexpectedly. Copy the source timestamps to the destination explicitly. * testsuite: only copy update-test mtime --------- Co-authored-by: Zen Dodd <mail@steadytao.com>
This commit is contained in:
1 parent
26da01aa58
commit
fd96bc7e8a
1 file changed
+9
-2
@@ -137,8 +137,15 @@ up1.mkdir()
|
||||
up2.mkdir()
|
||||
(up1 / 'dst-newness').touch()
|
||||
(up2 / 'src-newness').touch()
|
||||
(up1 / 'same-newness').touch()
|
||||
(up2 / 'same-newness').touch()
|
||||
same_src = up1 / 'same-newness'
|
||||
same_dst = up2 / 'same-newness'
|
||||
same_src.touch()
|
||||
same_dst.touch()
|
||||
# Give both files the same mtime; otherwise two touch calls could straddle a
|
||||
# second boundary and --update would see the destination as newer.
|
||||
src_stat = same_src.stat()
|
||||
dst_stat = same_dst.stat()
|
||||
os.utime(same_dst, ns=(dst_stat.st_atime_ns, src_stat.st_mtime_ns))
|
||||
(up1 / 'extra-src').touch()
|
||||
(up2 / 'extra-dest').touch()
|
||||
|
||||
|
||||
Reference in new issue
Block a user