Skip to content

test: cover daemon runtime serving path = / without chroot - #5532

Merged
oferchen merged 1 commit into
masterfrom
fix/uts-12-daemon-path-root-v2
Jun 10, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/uts-12-daemon-path-root-v2

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds an end-to-end daemon integration test for the UTS-12
    daemon-path-root-read scenario: a module configured with
    path = /, use chroot = no, read only = yes must accept a
    #list request and advertise the module without the connection
    handler tripping over the bare-slash path.
  • Complements the validator-layer coverage merged in fix: accept path = / in rsyncd.conf module definitions #5522 so a
    future regression that passes parsing but breaks inside the
    runtime path (e.g. a chdir/chroot mishap or a stray
    is_absolute()-style guard sneaking in) fails fast.

Upstream reference

  • loadparm.c (P_PATH, rsync 3.4.2): single / survives the
    trailing-slash strip (len > 1 guard) and is reachable via
    lp_path(module_id).
  • clientserver.c (rsync 3.4.2, line ~823-865): when
    use chroot = no the daemon serves the module path as-is; when
    use chroot = yes chroot("/") succeeds as a no-op.

Changes

  • crates/daemon/src/tests/chunks/run_daemon_serves_module_with_root_path_no_chroot.rs:
    new #[cfg(unix)] integration test that starts the daemon with
    an inline rsyncd.conf containing [root] path = / use chroot = no read only = yes, connects, issues #list, and asserts the
    module is advertised followed by @RSYNCD: EXIT.
  • crates/daemon/src/tests.rs: wires the new chunk into the
    daemon test module.

No changes to wire protocol, branding, or any oc-rsync-specific
path (parallel-receive-delta, io_uring, IOCP, flat-flist,
daemon-tls, DirSandbox, SEND_ZC, flat arena flist). Test-only.

Test plan

  • CI fmt+clippy passes.
  • CI nextest (stable) passes the new
    run_daemon_serves_module_with_root_path_no_chroot test.
  • Windows CI stays green (new test is #[cfg(unix)]).

Locks in the runtime-path side of UTS-12 (`daemon-path-root-read`):
PR #5522 added validator-level regression coverage, but no test
exercised an actual daemon thread serving a module whose `path = /`
without chroot. This adds an end-to-end `#list` round-trip so a
future regression that lets the validator accept the config but
breaks inside the connection handler (e.g. an inappropriate `chdir`
of `/` or a bare-slash module name advertisement bug) fails fast.

Upstream reference: `loadparm.c` (P_PATH) preserves a single `/`
verbatim; `clientserver.c` serves it as-is when `use chroot = no`.
@github-actions github-actions Bot added the test label Jun 10, 2026
@oferchen
oferchen merged commit d5a3dfa into master Jun 10, 2026
69 checks passed
@oferchen
oferchen deleted the fix/uts-12-daemon-path-root-v2 branch June 10, 2026 07:41
oferchen added a commit that referenced this pull request Jun 10, 2026
PR #5532 added run_daemon_serves_module_with_root_path_no_chroot which
only exercises #list against a `path = /` module. The upstream rsync
3.4.4 #897 scenario was specifically about reading a file from such a
module. This test pulls a deterministic file via
rsync://127.0.0.1:port/root<absolute_tempdir>/source.txt against a
`[root] path = / use chroot = no read only = yes` module and asserts
the destination matches the source byte-for-byte.

The upstream bug class does not reproduce in oc-rsync because the
per-file `secure_relative_open` check is replaced with module-rooted
ServerConfig plus canonical-prefix validation, but the end-to-end
file-pull path was previously uncovered by an integration test.
oferchen added a commit that referenced this pull request Aug 24, 2026
…5532)

Locks in the runtime-path side of UTS-12 (`daemon-path-root-read`):
PR #5522 added validator-level regression coverage, but no test
exercised an actual daemon thread serving a module whose `path = /`
without chroot. This adds an end-to-end `#list` round-trip so a
future regression that lets the validator accept the config but
breaks inside the connection handler (e.g. an inappropriate `chdir`
of `/` or a bare-slash module name advertisement bug) fails fast.

Upstream reference: `loadparm.c` (P_PATH) preserves a single `/`
verbatim; `clientserver.c` serves it as-is when `use chroot = no`.
oferchen added a commit that referenced this pull request Aug 24, 2026
PR #5532 added run_daemon_serves_module_with_root_path_no_chroot which
only exercises #list against a `path = /` module. The upstream rsync
3.4.4 #897 scenario was specifically about reading a file from such a
module. This test pulls a deterministic file via
rsync://127.0.0.1:port/root<absolute_tempdir>/source.txt against a
`[root] path = / use chroot = no read only = yes` module and asserts
the destination matches the source byte-for-byte.

The upstream bug class does not reproduce in oc-rsync because the
per-file `secure_relative_open` check is replaced with module-rooted
ServerConfig plus canonical-prefix validation, but the end-to-end
file-pull path was previously uncovered by an integration test.
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