]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
testsuite: assert absolute --partial-dir delta resume now works
authorAndrew Tridgell <andrew@tridgell.net>
Sat, 23 May 2026 22:48:42 +0000 (08:48 +1000)
committerAndrew Tridgell <andrew@tridgell.net>
Sun, 24 May 2026 02:31:52 +0000 (12:31 +1000)
partial_test.py sub-test 5 deterministically asserts a delta (--no-whole-file)
resume from an absolute, outside-tree --partial-dir reproduces the source and
consumes the basis -- the regression guard for the receiver fix. Sub-test 4
keeps asserting the cross-directory partial WRITE on interrupt. Drop the
--whole-file workaround and the 'broken on master' notes in the docstring and
COVERAGE.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
testsuite/COVERAGE.md
testsuite/partial_test.py

index 44094b63f3fae504d895e3d89aafcf4987b2392f..6f6e37cf3bbf662757e63eff71f824f85e524f21 100644 (file)
@@ -77,7 +77,7 @@ Status legend: ✓ property asserted · `~` shallow / by an existing ported test
 |---|---|---|---|---|
 | -T, --temp-dir | temp-dir*new*, chmod-temp-dir | Y | Y | ✓ cross-dir rename |
 | --partial | partial*new* | Y | — | ✓ partial kept in dest file |
-| --partial-dir | partial*new*, symlink-dirlink-basis | Y | Y | ✓ relative (in-tree) + absolute (outside). Absolute **delta** resume is broken on master — asserts only the cross-dir write |
+| --partial-dir | partial*new*, symlink-dirlink-basis | Y | Y | ✓ relative (in-tree) + absolute (outside), incl. delta resume from an absolute outside-tree partial |
 | --delay-updates | delay-updates, delay-updates-deep*new* | Y | — | ✓ per-dir staging |
 | --inplace | inplace*new*, alt-dest | Y | — | ✓ inode preserved |
 | --append / --append-verify | append*new* | Y | — | ✓ verify split is proto 30+ |
@@ -202,5 +202,3 @@ Status legend: ✓ property asserted · `~` shallow / by an existing ported test
   = yes`, daemon uid/gid) skip as non-root; run the suite as root to cover.
 * `--ignore-errors`, `-x/--one-file-system`, `--numeric-ids` have no dedicated
   test yet (lower restructure risk).
-* Absolute `--partial-dir` + delta resume is broken on master; the test asserts
-  only the cross-directory write there and completes with `--whole-file`.
index 97b6f69aff47f351d792556b9633091dd55b54b7..1c8e9531a47e05c35f5f76240bb190228127a200 100644 (file)
@@ -9,11 +9,6 @@ directory; an ABSOLUTE dir is a reserved location that holds partials by
 basename. All of this is parent- and cross-directory path resolution -- what
 the resolver restructure rewrites -- so exercise it on a file several levels
 deep, with the absolute partial-dir kept OUTSIDE the destination tree.
-
-Note: a *delta* resume from an absolute partial-dir currently fails whole-file
-verification on master (it re-puts the partial and never converges). This test
-therefore only asserts the cross-directory WRITE of the partial for that case
-and completes it with --whole-file, which is the clearly-correct baseline.
 """
 
 import os
@@ -115,7 +110,7 @@ run_rsync('-a', '--partial-dir=.rsync-partial', '--no-whole-file',
           f'{src}/', f'{TODIR}/')
 assert_same(TODIR / deep, src / deep, label='rel partial-dir resume')
 
-# --- 4. absolute --partial-dir OUTSIDE the tree (cross-dir): interrupt -----
+# --- 4. absolute --partial-dir OUTSIDE the tree (cross-dir): interrupt write -
 ext = SCRATCHDIR / 'partials'      # sibling of from/ and to/ -- outside both
 rmtree(ext)
 ext.mkdir()
@@ -124,7 +119,21 @@ interrupt_transfer([f'--partial-dir={ext}'], ext / 'f3')
 if not (ext / 'f3').is_file() or not is_prefix(ext / 'f3'):
     test_fail("absolute --partial-dir did not write the partial to the "
               "outside-tree dir")
-run_rsync('-a', f'--partial-dir={ext}', '--whole-file', f'{src}/', f'{TODIR}/')
-assert_same(TODIR / deep, src / deep, label='abs partial-dir resume')
+
+# --- 5. absolute --partial-dir delta resume completes (regression guard) ----
+# A delta (--no-whole-file) resume from an absolute, outside-tree partial-dir
+# used to fail whole-file verification forever: the receiver couldn't open the
+# absolute basis, so matched blocks were dropped from the verify checksum.
+rmtree(src)
+rmtree(TODIR)
+rmtree(ext)
+makepath(src / deepdir, ext)
+make_data_file(src / deep, 1_000_000)
+(ext / 'f3').write_bytes((src / deep).read_bytes()[:400_000])   # clean prefix
+run_rsync('-a', f'--partial-dir={ext}', '--no-whole-file', f'{src}/', f'{TODIR}/')
+assert_same(TODIR / deep, src / deep, label='abs partial-dir delta resume')
+if (ext / 'f3').exists():
+    test_fail("absolute --partial-dir basis was not consumed after a "
+              "successful delta resume")
 
 print("partial: --partial + relative/absolute --partial-dir verified at depth")