Skip to content

test(transfer): cover 8 symlink-dirlink-basis topologies - #5871

Merged
oferchen merged 1 commit into
masterfrom
fix/uts-dd-symlink-dirlink-basis
Jun 17, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/uts-dd-symlink-dirlink-basis

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds 8 regression tests, one per upstream symlink-dirlink-basis topology, pinning that the receiver wiring for -K/--keep-dirlinks survives end-to-end through the compact server-flag parser and the MetadataOptions builder.
  • Closes the regression-coverage half of UTS-DD-symlink-dirlink-basis: the chmod dirfd-sandbox bypass (PR fix(metadata): bypass dirfd-sandbox chmod under --keep-dirlinks #5793) and the compact K parser wire-up (PR fix(transfer): parse compact -K to honour --keep-dirlinks on receiver #5853) are the fix; this PR encodes the upstream scenarios so the chain cannot silently break again.
  • Includes a negative control (topology 6 = top-level file without -K) that catches a parser regression which would spontaneously set keep_dirlinks from sibling bytes.

Root-cause conclusion

The upstream rsync 3.4.4 symlink-dirlink-basis.test (Issue #715) exercises 8 scenarios where the destination's parent directory is a symlink to the real directory; with --keep-dirlinks the receiver must follow the parent symlink at chmod time instead of being refused by secure_chmod_at. PR #5793 introduced chmod_path_honoring_keep_dirlinks to bypass the dirfd sandbox via std::fs::set_permissions, and PR #5853 wired the compact K byte through ParsedServerFlags::parse so the receiver sets MetadataOptions::with_keep_dirlinks(true). Both halves are required for the test to pass; this PR pins the joint invariant for all 8 topologies.

Test plan

  • cargo fmt --all (workspace formatted)
  • CI: nextest stable, Windows, macOS, Linux musl, fmt+clippy
  • Optional: cargo nextest run -p transfer --all-features -E 'test(symlink_dirlink)'

Files touched

  • crates/transfer/tests/uts_dd_symlink_dirlink_basis_topologies.rs (new, 145 lines)

Upstream references

  • target/interop/upstream-src/rsync-3.4.4/testsuite/symlink-dirlink-basis.test
  • target/interop/upstream-src/rsync-3.4.1/options.c:688 (-K mapping)
  • target/interop/upstream-src/rsync-3.4.1/generator.c:1344 (link_stat(fname, &sx.st, keep_dirlinks && is_dir))

@github-actions github-actions Bot added the test label Jun 17, 2026
@oferchen
oferchen force-pushed the fix/uts-dd-symlink-dirlink-basis branch from 54b3195 to 216c01c Compare June 17, 2026 14:37
Pins the receiver-side wiring that the upstream rsync 3.4.4 testsuite
`symlink-dirlink-basis` test exercises against -K/--keep-dirlinks. The
chmod dirfd-sandbox bypass (#5793) plus the compact `K` flag parser
wire-up (#5853) close the failure; this test file is the regression
coverage for both halves together.

Each test mirrors one of the eight Test N scenarios in
`testsuite/symlink-dirlink-basis.test` (Issue #715): basic, compressed,
nested, --backup, --inplace, top-level (negative control), proto28
--partial-dir, and proto28 basic. The negative control catches a
parser regression that would silently set keep_dirlinks for the
non-symlinked top-level case.

Pins both halves of the chain:
- ParsedServerFlags::parse recognises the compact `K` byte from the
  server-side flag string the client emits in every topology.
- The parsed flag survives MetadataOptions::with_keep_dirlinks, which
  is what chmod_path_honoring_keep_dirlinks consults at apply time.

Upstream sources of truth:
- target/interop/upstream-src/rsync-3.4.4/testsuite/symlink-dirlink-basis.test
- target/interop/upstream-src/rsync-3.4.1/options.c:688 (-K mapping)
- target/interop/upstream-src/rsync-3.4.1/generator.c:1344
  (link_stat(fname, &sx.st, keep_dirlinks && is_dir))
@oferchen
oferchen force-pushed the fix/uts-dd-symlink-dirlink-basis branch from 216c01c to f1fb04a Compare June 17, 2026 14:45
@oferchen
oferchen merged commit 68c49af into master Jun 17, 2026
2 of 3 checks passed
@oferchen
oferchen deleted the fix/uts-dd-symlink-dirlink-basis branch June 17, 2026 15:29
oferchen added a commit that referenced this pull request Aug 24, 2026
… (#5871)

Pins the receiver-side wiring that the upstream rsync 3.4.4 testsuite
`symlink-dirlink-basis` test exercises against -K/--keep-dirlinks. The
chmod dirfd-sandbox bypass (#5793) plus the compact `K` flag parser
wire-up (#5853) close the failure; this test file is the regression
coverage for both halves together.

Each test mirrors one of the eight Test N scenarios in
`testsuite/symlink-dirlink-basis.test` (Issue #715): basic, compressed,
nested, --backup, --inplace, top-level (negative control), proto28
--partial-dir, and proto28 basic. The negative control catches a
parser regression that would silently set keep_dirlinks for the
non-symlinked top-level case.

Pins both halves of the chain:
- ParsedServerFlags::parse recognises the compact `K` byte from the
  server-side flag string the client emits in every topology.
- The parsed flag survives MetadataOptions::with_keep_dirlinks, which
  is what chmod_path_honoring_keep_dirlinks consults at apply time.

Upstream sources of truth:
- target/interop/upstream-src/rsync-3.4.4/testsuite/symlink-dirlink-basis.test
- target/interop/upstream-src/rsync-3.4.1/options.c:688 (-K mapping)
- target/interop/upstream-src/rsync-3.4.1/generator.c:1344
  (link_stat(fname, &sx.st, keep_dirlinks && is_dir))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant