From fd96bc7e8a9c320b40fa30a40fe6c36b516ae2e0 Mon Sep 17 00:00:00 2001 From: Angel J <78835633+iamanaws@users.noreply.github.com> Date: Mon, 26 Oct 2026 04:25:30 -0700 Subject: [PATCH] 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 --- testsuite/exclude_test.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/testsuite/exclude_test.py b/testsuite/exclude_test.py index a35901c2..f3469d24 100644 --- a/testsuite/exclude_test.py +++ b/testsuite/exclude_test.py @@ -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()