Repository navigation
Add protocol negotiation utilities - #1
Merged
Merged
Conversation
oferchen
added a commit
that referenced
this pull request
Dec 14, 2025
…urrent failure Created VALIDATION_SUMMARY.md comparing report claims vs actual findings: CONFIRMED BUG (from report): - mtime serialization in flist/write.rs:130 always casts i64→i32 - This will fail for timestamps > 2038 (Year 2038 problem) - This will fail for timestamps < 1970 (negative Unix time) REPORT INACCURACIES: - Actual error: 'Connection reset by peer (104)', NOT Error Code 12 - Failure point: Early protocol handshake, NOT file list transmission - mtime bug is real but not causing current interop failure CURRENT STATUS: - Bug #1: Connection reset (BLOCKER) - under investigation - Bug #2: mtime serialization (CONFIRMED) - needs fix after Bug #1 The report correctly identified a Year 2038 compliance issue but incorrectly attributed it as the cause of interop test failures.
oferchen
added a commit
that referenced
this pull request
Dec 14, 2025
Documented accomplishments: - Protocol trace system infrastructure (300+ lines) - Debugging methodology guide (758 lines) - Analysis report validation (154 lines) - Confirmed mtime serialization bug (Year 2038) - Systematic debug workflow established Status: - Bug #1: Connection reset (BLOCKER) - investigation in progress - Bug #2: mtime serialization - confirmed, pending fix Created repeatable methodology for future protocol debugging.
oferchen
added a commit
that referenced
this pull request
Feb 12, 2026
…arden CI Buffer pool: replace expensive resize(size, 0) memset in return_buffer with unsafe set_len — safe because all consumers overwrite via Read::read before consumption. Eliminates #1 CPU hotspot (26% of runtime), yielding ~25% speedup. Verbosity: align info/debug flag levels with upstream rsync 3.4.1 mapping for -v through -vvvvv (backup/mount/remove/skip at level 1, not 2; exit/proto corrected at higher verbosity tiers). CI: pin all GitHub Actions to SHA hashes for supply-chain security; add io_uring and copy_file_range feature isolation tests to the matrix. Tests: add 19 output parity tests (dry-run, list-only, error format, progress2, --out-format placeholders), 9 tracing integration tests for verbosity/info/debug/quiet flags, and fix flaky compress_level_upstream test. Benchmark harness: add throughput metrics, stats parsing, mirror support, and fix unused import/dead_code warnings in xtask.
oferchen
added a commit
that referenced
this pull request
May 1, 2026
…urrent failure Created VALIDATION_SUMMARY.md comparing report claims vs actual findings: CONFIRMED BUG (from report): - mtime serialization in flist/write.rs:130 always casts i64→i32 - This will fail for timestamps > 2038 (Year 2038 problem) - This will fail for timestamps < 1970 (negative Unix time) REPORT INACCURACIES: - Actual error: 'Connection reset by peer (104)', NOT Error Code 12 - Failure point: Early protocol handshake, NOT file list transmission - mtime bug is real but not causing current interop failure CURRENT STATUS: - Bug #1: Connection reset (BLOCKER) - under investigation - Bug #2: mtime serialization (CONFIRMED) - needs fix after Bug #1 The report correctly identified a Year 2038 compliance issue but incorrectly attributed it as the cause of interop test failures.
oferchen
added a commit
that referenced
this pull request
May 1, 2026
Documented accomplishments: - Protocol trace system infrastructure (300+ lines) - Debugging methodology guide (758 lines) - Analysis report validation (154 lines) - Confirmed mtime serialization bug (Year 2038) - Systematic debug workflow established Status: - Bug #1: Connection reset (BLOCKER) - investigation in progress - Bug #2: mtime serialization - confirmed, pending fix Created repeatable methodology for future protocol debugging.
oferchen
added a commit
that referenced
this pull request
May 1, 2026
…arden CI Buffer pool: replace expensive resize(size, 0) memset in return_buffer with unsafe set_len — safe because all consumers overwrite via Read::read before consumption. Eliminates #1 CPU hotspot (26% of runtime), yielding ~25% speedup. Verbosity: align info/debug flag levels with upstream rsync 3.4.1 mapping for -v through -vvvvv (backup/mount/remove/skip at level 1, not 2; exit/proto corrected at higher verbosity tiers). CI: pin all GitHub Actions to SHA hashes for supply-chain security; add io_uring and copy_file_range feature isolation tests to the matrix. Tests: add 19 output parity tests (dry-run, list-only, error format, progress2, --out-format placeholders), 9 tracing integration tests for verbosity/info/debug/quiet flags, and fix flaky compress_level_upstream test. Benchmark harness: add throughput metrics, stats parsing, mirror support, and fix unused import/dead_code warnings in xtask.
oferchen
added a commit
that referenced
this pull request
May 5, 2026
…urrent failure Created VALIDATION_SUMMARY.md comparing report claims vs actual findings: CONFIRMED BUG (from report): - mtime serialization in flist/write.rs:130 always casts i64→i32 - This will fail for timestamps > 2038 (Year 2038 problem) - This will fail for timestamps < 1970 (negative Unix time) REPORT INACCURACIES: - Actual error: 'Connection reset by peer (104)', NOT Error Code 12 - Failure point: Early protocol handshake, NOT file list transmission - mtime bug is real but not causing current interop failure CURRENT STATUS: - Bug #1: Connection reset (BLOCKER) - under investigation - Bug #2: mtime serialization (CONFIRMED) - needs fix after Bug #1 The report correctly identified a Year 2038 compliance issue but incorrectly attributed it as the cause of interop test failures.
oferchen
added a commit
that referenced
this pull request
May 5, 2026
Documented accomplishments: - Protocol trace system infrastructure (300+ lines) - Debugging methodology guide (758 lines) - Analysis report validation (154 lines) - Confirmed mtime serialization bug (Year 2038) - Systematic debug workflow established Status: - Bug #1: Connection reset (BLOCKER) - investigation in progress - Bug #2: mtime serialization - confirmed, pending fix Created repeatable methodology for future protocol debugging.
oferchen
added a commit
that referenced
this pull request
May 5, 2026
…arden CI Buffer pool: replace expensive resize(size, 0) memset in return_buffer with unsafe set_len — safe because all consumers overwrite via Read::read before consumption. Eliminates #1 CPU hotspot (26% of runtime), yielding ~25% speedup. Verbosity: align info/debug flag levels with upstream rsync 3.4.1 mapping for -v through -vvvvv (backup/mount/remove/skip at level 1, not 2; exit/proto corrected at higher verbosity tiers). CI: pin all GitHub Actions to SHA hashes for supply-chain security; add io_uring and copy_file_range feature isolation tests to the matrix. Tests: add 19 output parity tests (dry-run, list-only, error format, progress2, --out-format placeholders), 9 tracing integration tests for verbosity/info/debug/quiet flags, and fix flaky compress_level_upstream test. Benchmark harness: add throughput metrics, stats parsing, mirror support, and fix unused import/dead_code warnings in xtask.
3 tasks
oferchen
added a commit
that referenced
this pull request
May 17, 2026
Adds three env-gated sub-scenarios to scripts/windows_throughput_bench.sh that isolate the IOCP hotspots catalogued in the IOCP sync-blocking audit, so future Windows write/read/network improvements can be attributed to specific changes instead of moving the aggregate large_1gib / small_10000 numbers. Enabled by OC_RSYNC_BENCH_DRILLDOWN=1; the existing scenarios run unchanged when the flag is absent. - write_only_iocp: oc-rsync --whole-file --inplace vs cp control to pin the IocpWriter per-IO drain (audit rows #1, #4, #13). - read_only_iocp: oc-rsync --dry-run vs upstream --dry-run over the 1 GiB fixture to pin the IocpReader drain (audit rows #2, #3). - network_only_loopback: rsync push between two short-lived loopback daemons on 127.0.0.1, cancelling out disk bandwidth so only the IocpSocket send/recv path varies (audit rows #8-#11). Documents the invocation, hotspot mapping, and interpretation rules in docs/benchmarks/windows-throughput.md. The drilldown scenarios are not in the required-checks list and have no acceptable-band thresholds; they exist to attribute movement, not to gate merges.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…ete/context.rs (#2353) (#4365) * docs: design SpillPolicy public API + env-var surface (#2335) (#4340) Introduces design for a 5-knob SpillPolicy struct replacing the single spill_threshold_bytes field on ConcurrentDeltaConfig. Documents defaults, env-var precedence under OC_RSYNC_SPILL_*, ops-friendly CLI flags (--spill-dir, --spill-threshold-bytes), validation rules, a one-release deprecated-forwarding migration story, and a 5-step implementation plan keyed to subtasks STN-2..STN-14. Design only; no runtime changes. * docs(audits): mutex poison recovery classification (#2350, #2351, #2358) (#4341) Inventory all `.lock().expect()` / `.lock().unwrap()` (and `RwLock` peers) sites across the workspace. Classify each as RECOVERABLE (safe to `PoisonError::into_inner()` and proceed), FATAL (mid-operation panic leaves wire state inconsistent, must propagate), or TEST-ONLY (test fixtures and `#[cfg(test)]` env mutexes). Adds tables for the delete module and workspace hotspots, per-crate counts, and follow-up MPE-3..MPE-17 task list anchored on a shared `lock_or_recover` / `lock_or_panic` helper. Identifies `crates/engine/src/local_copy/context_impl/options.rs` as the highest- value single remediation target (7 FATAL batch-writer sites). * feat(engine): add lock_or_recover helpers for poison recovery (#4342) Introduce util::poison with lock_or_recover, read_or_recover, and write_or_recover helpers that promote PoisonError into the inner guard for state that remains valid after a panicking thread unwinds. These helpers will be used by upcoming refactors that replace .lock().expect(...) call sites in modules whose protected state is monotonic or otherwise self-consistent (delete emitter recorder, buffer pool counters, work-queue shards) so a single panicking worker no longer cascades into a full pool abort. Includes unit tests that poison a Mutex and RwLock via a panicking spawned thread and verify the helpers return a usable guard rather than re-panicking. * docs(audits): io_uring data path coverage (#2361) (#4343) Catalogue every SQE construction site in fast_io/io_uring by opcode category. Trace each site upward to confirm whether engine, transfer, or rsync_io route real production data through it. Refute the "metadata-only" framing - the receiver write path, disk-commit thread, and sender source-read path all submit file-data SQEs today. Identify the three production sites where switching to io_uring data SQEs would yield the largest throughput gain (sockets, sub-1MiB source reads, sparse/append fallback) for follow-on IUD-2 and IUD-3 work. * test(fuzz): extend varint decode fuzz target (#2318) (#4344) Adds structured boundary coverage to the protocol varint fuzz target so it does not rely on the corpus to reach extreme inputs: - i32 edges (MIN/MAX, +-1, 0, -0x4000_0000) and i64 edges encoded with write_int/write_varint/write_varlong/write_longint/encode_varint_to_vec, decoded with the matching readers and asserted to roundtrip. - Truncated buffers: every strict prefix of each encoded boundary value is fed through decode_varint/read_varint/read_varlong/read_longint to exercise mid-byte UnexpectedEof paths without panicking. - Both protocol 31 (legacy 4-byte LE via read_int) and protocol 32 (varint) paths driven through read_varint30_int with proto 28-32. - Legacy longint short and long (0xFFFFFFFF-prefixed) forms. The unstructured arbitrary-bytes coverage from the original target is preserved and still runs every iteration. * docs: document Windows NTFS ACL behaviour and lossy cases (#2313) (#4346) Expand the --acls reference, README platform table, and operator migration guide to describe the Tier 1C partial Windows DACL path: deny ACEs dropped, inherited ACEs skipped, SACL gated on --audit-acls, non-rwx access bits collapsed, and unresolvable SIDs dropped. Document --audit-acls, --fail-on-windows-acl-loss, and --windows-acls as planned flags with SDDL wire encoding notes, and cross-link the design doc from all three surfaces. * docs(audits): fuzz coverage gap followups (#2316) (#4347) Decompose the remaining P0/P1 fuzz coverage gaps from the FCV audit into individually filable follow-up tasks. Each entry cites the parse function (file:line), recommends a raw vs structured Arbitrary input shape, and lists the panic / no-panic invariants the harness should assert. Covers the two open P0 gaps (negotiation_prologue, capability_vstring) plus a P0 fill-in (legacy_sniffer reader paths) and the five highest P1 surfaces (compat_flags, filter_list_wire, ndx_codec, incremental_flist, idlist, compress_decoders). * feat(rsync_io): ssh-socketpair-stderr connection primitive (#2372) (#4348) Implements task SSE-3 from docs/design/socketpair-stderr-channel.md. Adds the `socketpair_stderr` module gated behind the new `ssh-socketpair-stderr` Cargo feature (default off). The primitive returns a connected pair of `File`-typed byte streams ready to back the async drain that SSE-4 will layer on top. Unix path uses `UnixStream::pair` (`socketpair(AF_UNIX, SOCK_STREAM, 0)` under the hood with `SOCK_CLOEXEC`) and converts both halves through `OwnedFd` so callers store the parent and child ends behind the same handle type as the existing pipe fallback. A `set_nonblocking` helper toggles `O_NONBLOCK` via the safe stdlib API, ready for the SSE-4 tokio reactor registration. Windows currently returns `io::ErrorKind::Unsupported`; the loopback shim ships under SSE-5 alongside the safe handle bridge in `fast_io`, so the crate keeps `#![deny(unsafe_code)]` intact. Tests gated on Unix + feature flag: 1 KiB round-trip, peer-close EOF, and `set_nonblocking` mode flip surfaced as `WouldBlock`. * docs(design): io_uring data path - receive + send (#2362, #2363) (#4349) Two companion design docs specifying how transfer file data will be routed through io_uring SQEs end-to-end on Linux: - iouring-receive-data-path.md: route disk-commit chunk writes through registered buffers + IORING_OP_WRITE_FIXED, gated by the new iouring-data-writes feature (default off). Shares a pool with the SMR-3a basis reader. - iouring-send-data-path.md: basis re-read via IORING_OP_READ_FIXED feeding directly into IORING_OP_SEND_ZC against the multiplex socket, with the 4-byte MSG_DATA header pre-pended in-slot. Gated by the new iouring-data-sends feature (default off). Both docs spell out ordering, fsync placement, short-write handling, fallback hierarchy, SQPOLL exclusion, and a 5-step phased rollout keyed to follow-up tasks IUD-5..IUD-8. No code changes. * docs(audits): Windows hardlink ACL inheritance (#2311) (#4350) Audits every ACL apply site for files participating in NTFS hardlink cohorts, compares oc-rsync behaviour to upstream rsync 3.4.2 on cygwin, and documents the one divergence: the local-copy --copy-dest Link branch re-applies the source DACL once per follower instead of relying on NTFS inode-level sharing. The writes are idempotent (identical bytes), so correctness holds; the cost is N redundant SetNamedSecurityInfoW round trips and audit log noise. Includes a 3-link cohort test plan covering wire receive, local copy, --copy-dest and cross-cohort isolation. * ci: nightly fuzz coverage report per target (#2322) (#4351) Add `Fuzz Coverage Report` workflow that runs `cargo fuzz coverage` for every target across the `fuzz/`, `crates/protocol/fuzz/`, and `crates/filters/fuzz/` workspaces nightly at 03:30 UTC and uploads the resulting `.lcov` files as 30-day workflow artifacts. The job is informational (`continue-on-error: true`) and emits a per-target line coverage summary to the GitHub step summary, mirroring the SAFETY audit informational pattern from ci.yml. Documents the rollout in docs/audits/fuzz-coverage-matrix.md so the matrix and promotion criteria stay in one place. * bench(windows): per-hotspot drilldown mode (#2305) (#4352) Adds three env-gated sub-scenarios to scripts/windows_throughput_bench.sh that isolate the IOCP hotspots catalogued in the IOCP sync-blocking audit, so future Windows write/read/network improvements can be attributed to specific changes instead of moving the aggregate large_1gib / small_10000 numbers. Enabled by OC_RSYNC_BENCH_DRILLDOWN=1; the existing scenarios run unchanged when the flag is absent. - write_only_iocp: oc-rsync --whole-file --inplace vs cp control to pin the IocpWriter per-IO drain (audit rows #1, #4, #13). - read_only_iocp: oc-rsync --dry-run vs upstream --dry-run over the 1 GiB fixture to pin the IocpReader drain (audit rows #2, #3). - network_only_loopback: rsync push between two short-lived loopback daemons on 127.0.0.1, cancelling out disk bandwidth so only the IocpSocket send/recv path varies (audit rows #8-#11). Documents the invocation, hotspot mapping, and interpretation rules in docs/benchmarks/windows-throughput.md. The drilldown scenarios are not in the required-checks list and have no acceptable-band thresholds; they exist to attribute movement, not to gate merges. * docs(architecture): BGID lifecycle (#2299) (#4353) Add docs/architecture/bgid-lifecycle.md covering the allocation flow, Drop-driven recycling rules, u16 namespace exhaustion math, pre-sized free-list rationale, planned high-water-mark stat (BGE-3), and the planned graceful fallback when exhausted (BGE-6). Cross-references the audit at docs/audits/bgid-lifecycle.md (PR #4331) and the session topology overview. * feat(metadata): Windows DACL/SACL SDDL round-trip (#2307, #2308) (#4354) Adds opt-in SDDL serialisation helpers in crates/metadata/src/acl_windows.rs: - read_dacl_sddl(path): GetNamedSecurityInfoW + ConvertSecurityDescriptor ToStringSecurityDescriptorW for owner/group/DACL. - read_sddl_with_sacl(path): same plus SACL (requires SE_SECURITY_NAME). - write_dacl_sddl(path, sddl): ConvertStringSecurityDescriptorToSecurity DescriptorW + SetNamedSecurityInfoW, applying owner, group, DACL, and SACL components present in the parsed descriptor. DACL is written with PROTECTED_DACL_SECURITY_INFORMATION per design section 5.2 to avoid silently inheriting extra ACEs from the parent directory. All Win32-allocated buffers are wrapped in RAII guards (OwnedSecurity Descriptor, OwnedLocalWString) that release via LocalFree on drop, even on error paths. Unsafe blocks each carry SAFETY notes naming the invariant they uphold. Implements the Windows fidelity payload described in docs/design/windows-ntfs-acl-support.md section 4.2. Re-exports the new functions from crates/metadata/src/lib.rs under the existing cfg(all(feature = "acl", windows)) gate so consumers can drive the round-trip without poking module internals. Tests on a Windows tempdir: - read_dacl_sddl_returns_non_empty_for_temp_file - write_dacl_sddl_round_trips_known_descriptor - write_dacl_sddl_preserves_owner_and_group - write_dacl_sddl_rejects_invalid_input * feat(fast_io): BGID high-water mark + 50%-occupancy warning (#2295) (#4355) Adds an observable peak counter to the io_uring buffer-group-ID allocator so operators can see the worst-case namespace pressure the process has experienced. - `PEAK_USED: AtomicU16` is updated via `fetch_max` after every successful `BgidAllocator::allocate`, including reuses from the free-list. Deallocation never lowers the value. - `bgid_peak_used()` and `bgid_inflight()` expose the stat and the live snapshot for dashboards and capacity tests. - The free-list is pre-sized to 4 096 entries so steady-state daemon churn does not trigger `Vec` reallocations under the free-list mutex. - When the in-flight count crosses 50 % of the 16-bit namespace (32 768) a throttled `tracing::warn!` fires at most once per 30 s so a hot allocate loop cannot flood the log. - Non-Linux stub mirrors the new public accessors with zero returns so cross-platform callers compile without cfg-gating. - Tests cover the 100-allocation peak, the deallocate monotonicity, the pre-sized capacity, and the inflight subtraction. * docs(architecture): drain error recovery contract (#2385) (#4356) * feat(fast_io): IOCP concurrent_ops auto-size based on CPU count (#2302) (#4358) Replace the static IocpConfig::concurrent_ops default (4) with a CPU-derived value: (cpus * 4).clamp(8, 64). This mirrors io_uring's default_sq_entries derivation so wide hosts keep more overlapped WriteFile operations in flight, while a 1-CPU host still gets a healthy 8-deep submission window. The field stays overridable for explicit tuning. The COMPLETION_DRAIN_BATCH = 64 in disk_batch.rs and DEFAULT_BATCH_SIZE = 64 in pump.rs remain fixed (intentionally aligned with the new MAX_CONCURRENT_OPS ceiling) so a single GetQueuedCompletionStatusEx call can reap an entire in-flight cohort; the pump path already grows on demand up to MAX_BATCH_SIZE on ERROR_INSUFFICIENT_BUFFER (#1930). * docs: Mutex poison recovery policy (#2360) (#4359) Capture the engine-wide contract for reacting to a poisoned Mutex / RwLock. Distils the per-site audit at docs/audits/mutex-poison-policy.md and the helpers landed in crates/engine/src/util/poison.rs into one document new code can follow. Defines the four cases (RECOVERABLE, FATAL, TEST-ONLY, UNAUDITED), the decision tree for picking between them, code templates for the RECOVERABLE (lock_or_recover) and FATAL (expect + # Panics rustdoc) paths, the per-crate audit counts (23 fatal / 28 recoverable / 317 test-only across 368 sites), and the MPE-4..MPE-10 promotion path that ends with the contract becoming a CI lint. Cross-references docs/architecture/drain-error-recovery.md for the ATU-series companion and the rsync_io/fast_io call sites that already match the helper recipe. * feat(engine): SpillPolicy struct + ConcurrentDeltaConfig wiring (#2336) (#4360) Introduce a public SpillPolicy aggregate that groups every spill-layer knob (threshold_bytes, dir, reclaim_mode, granularity, compression) under one value, and wire it through ConcurrentDeltaConfig so callers can stage policy changes without touching the DeltaConsumer API. The legacy spill_threshold_bytes / spill_dir fields collapse into spill_policy; deprecated accessors keep existing call sites compiling while pointing readers at the new field. Defaults match the historical behaviour (no spill, no extra plumbing). The new SpillCompression::Zstd variant lives behind the additive spill-compression feature so default builds gain no dependency. * test(metadata): Windows source -> Linux destination ACL round-trip (#2312) (#4366) Pins the cross-platform translation contract from the Windows NTFS ACL design (docs/design/windows-ntfs-acl-support.md, sections 5.1/5.2/5.3): - Forward leg: synthetic Windows-side DACL with owner/group/Everyone allow ACEs plus one named user lowers to user_obj/group_obj/other_obj and a RsyncAcl::names entry, with name preserved. - Reverse leg: POSIX mode 0o755 plus one named user and one named group round-trips through the Windows-side ACE shape and back to the same rwx triplet, kinds, RIDs, and account names. - Lossy path: deny ACEs are dropped on lowering; POSIX bits derive exclusively from surviving allow ACEs. Gate on OC_RSYNC_METADATA_INTEROP=1 to match acl_xattr_roundtrip_linux, and cfg(unix) so Linux/macOS CI runners can pick it up. Uses synthetic SDDL-style fixtures so no Windows host is needed; assertions exercise the documented mapping rules without depending on the in-flight WAS-2, WAS-3, and WAS-4 helpers. * docs(audits): Windows IOCP profiling methodology (#2300) (#4370) WPG-1 deliverable: methodology a Windows operator follows to convert the wall-clock signal from the throughput bench into a ranked hotspot table. Picks ETW + WPA as the default stack (free, ships with the Windows ADK), with VTune and WPR as alternatives. Documents the six profiling steps (release-with-debug build, drilldown bench run, ETW CPU + IO captures, classify, append results), defines the three hotspot buckets (per-IO blocking drain, CQ-depth saturation, bounce-buffer copy) keyed to rows of the sync-blocking audit and to WPG-3/WPG-4 mitigations, and lays out a five-step implementation plan keyed to WPG-4..WPG-6. * docs: document ssh-socketpair-stderr feature (#2377) (#4368) Adds the experimental `ssh-socketpair-stderr` feature to the README cargo features table and a dedicated subsection in the vNEXT operator migration guide. The flag was introduced by SSE-3 (#2372) on top of the design in docs/design/socketpair-stderr-channel.md (#2371) and gates the AF_UNIX socketpair stderr channel that lets the async SSH transport register the drain with epoll/kqueue/tokio AsyncFd and wake it via shutdown(2) instead of consuming a per-connection blocking thread. Migration guide entry explains when to opt in (Linux endpoints running with async-ssh, fan-out clients, deployments wanting the larger socketpair kernel buffer and shutdown-based wake) and when to leave the default (Windows until SSE-5 lands, sync-only SSH builds, operators who prefer the simpler pipe semantics for debugging). Updates the section 4 count, rollback list, and appendix table. Cross-links to the design doc and the SSE-1 stderr handling audit. Task SSE-8. * docs: SpillPolicy user-facing documentation (#2346) (#4378) Document the receiver-side SpillPolicy surface across the three operator-facing docs: - README: add a Receiver memory tuning subsection under the cargo features table cross-linking the public-API design and the spillable buffer internals. - docs/oc-rsync.1.md: document the planned --spill-dir and --spill-threshold-bytes flags (STN-11) under Performance Options, including the OC_RSYNC_SPILL_* env-var bridge until they ship. - docs/operator-migration-guide-vNEXT.md: add a Receiver spill tunability subsection covering all five OC_RSYNC_SPILL_* env vars, defaults, precedence, and when to override. * docs: ssh-socketpair-stderr opt-in feature (SSE-8 #2377) (#4385) * docs(audit): SPL-9 spill mod.rs re-export audit (#2331) (#4390) * refactor(engine): document delete/context mutex panic invariants (#2353) Per the workspace mutex-poison policy (docs/audits/mutex-poison-policy.md, MPE-1/2/9), every `.lock().expect()` site in `crates/engine/src/delete/context.rs` is classified FATAL. The cursor stack encodes upstream's parent-before-child traversal order and the segment-entries buffer is overwritten in place; recovery from a poisoned guard would mis-order deletes or unlink stale names. The strict policy is to keep `.lock().expect("...")` and document the invariant. Changes - Add `# Panics` sections to `observe_directory`, `begin_directory`, `publish_plan_for` naming the invariant and pointing at the audit doc. - Refresh the existing `# Panics` block on `observe_segment_for_delete` to match the new wording. - Normalise the three `cursor.lock().unwrap()` test sites to `cursor.lock().expect("test cursor poisoned")` so diagnostics match the production message. No production swap to `lock_or_recover` here: the audit lists 0 RECOVERABLE sites in this file. The helper now lives in `crates/engine/src/util/poison.rs` (PR #4342) for later MPE-* tickets that target genuinely recoverable state (drain shard buffer, recorder sinks, bgid free lists). No public API change. `cargo fmt --all` clean.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Adds three env-gated sub-scenarios to scripts/windows_throughput_bench.sh that isolate the IOCP hotspots catalogued in the IOCP sync-blocking audit, so future Windows write/read/network improvements can be attributed to specific changes instead of moving the aggregate large_1gib / small_10000 numbers. Enabled by OC_RSYNC_BENCH_DRILLDOWN=1; the existing scenarios run unchanged when the flag is absent. - write_only_iocp: oc-rsync --whole-file --inplace vs cp control to pin the IocpWriter per-IO drain (audit rows #1, #4, #13). - read_only_iocp: oc-rsync --dry-run vs upstream --dry-run over the 1 GiB fixture to pin the IocpReader drain (audit rows #2, #3). - network_only_loopback: rsync push between two short-lived loopback daemons on 127.0.0.1, cancelling out disk bandwidth so only the IocpSocket send/recv path varies (audit rows #8-#11). Documents the invocation, hotspot mapping, and interpretation rules in docs/benchmarks/windows-throughput.md. The drilldown scenarios are not in the required-checks list and have no acceptable-band thresholds; they exist to attribute movement, not to gate merges.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Adds three env-gated sub-scenarios to scripts/windows_throughput_bench.sh that isolate the IOCP hotspots catalogued in the IOCP sync-blocking audit, so future Windows write/read/network improvements can be attributed to specific changes instead of moving the aggregate large_1gib / small_10000 numbers. Enabled by OC_RSYNC_BENCH_DRILLDOWN=1; the existing scenarios run unchanged when the flag is absent. - write_only_iocp: oc-rsync --whole-file --inplace vs cp control to pin the IocpWriter per-IO drain (audit rows #1, #4, #13). - read_only_iocp: oc-rsync --dry-run vs upstream --dry-run over the 1 GiB fixture to pin the IocpReader drain (audit rows #2, #3). - network_only_loopback: rsync push between two short-lived loopback daemons on 127.0.0.1, cancelling out disk bandwidth so only the IocpSocket send/recv path varies (audit rows #8-#11). Documents the invocation, hotspot mapping, and interpretation rules in docs/benchmarks/windows-throughput.md. The drilldown scenarios are not in the required-checks list and have no acceptable-band thresholds; they exist to attribute movement, not to gate merges.
4 tasks
4 tasks done
This was referenced Jun 23, 2026
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
Adds three env-gated sub-scenarios to scripts/windows_throughput_bench.sh that isolate the IOCP hotspots catalogued in the IOCP sync-blocking audit, so future Windows write/read/network improvements can be attributed to specific changes instead of moving the aggregate large_1gib / small_10000 numbers. Enabled by OC_RSYNC_BENCH_DRILLDOWN=1; the existing scenarios run unchanged when the flag is absent. - write_only_iocp: oc-rsync --whole-file --inplace vs cp control to pin the IocpWriter per-IO drain (audit rows #1, #4, #13). - read_only_iocp: oc-rsync --dry-run vs upstream --dry-run over the 1 GiB fixture to pin the IocpReader drain (audit rows #2, #3). - network_only_loopback: rsync push between two short-lived loopback daemons on 127.0.0.1, cancelling out disk bandwidth so only the IocpSocket send/recv path varies (audit rows #8-#11). Documents the invocation, hotspot mapping, and interpretation rules in docs/benchmarks/windows-throughput.md. The drilldown scenarios are not in the required-checks list and have no acceptable-band thresholds; they exist to attribute movement, not to gate merges.
oferchen
added a commit
that referenced
this pull request
Nov 27, 2026
## What rsync 3.5.2 does `rwrite()` hands every FERROR/FWARNING/FINFO line to `filtered_fwrite()` before it reaches the terminal: - A client without `-8` opens `ic_chck = iconv_open(cs, cs)` (rsync.c:96-98). `rwrite()` then validates the line in the locale codeset (log.c:463-496). Each rejected byte is written as `\#ooo` (log.c:487), and the valid characters go through `filtered_fwrite(f, convbuf, len, 0, ..)` (log.c:476). - A `-8` client or a server takes `filtered_fwrite(f, buf, len, !allow_8bit_chars, ..)` (log.c:499). - `filtered_char_len()` (log.c:276-293) escapes C0 except TAB, DEL, 0x80-0x9F, and the backslash of a literal `\#ddd` (log.c:288-291). With `use_isprint` it also escapes every byte `isprint()` rejects. - `rwrite()` peels one trailing newline and writes it raw (log.c:460). - A refused filter rule is echoed through `rprintf(FERROR, ...)`: `filter_rule_err()` at exclude.c:133-136 and the `invalid modifier` line at exclude.c:1376. So a VT in the rule prints as `\#13`, both in the `'%c'` detail and in the echoed rule. ## What oc did oc's daemon log file already escaped its lines (`LogFileWriter`, mirroring `logit()` at log.c:143), and so did lines forwarded from a server in MSG frames. Lines the client printed itself were not escaped: - A refused `--filter` rule (`write_refusal`). - Every `Message` written through the client stderr `MessageSink`. - The pre-formatted cause lines of a `ClientError` report. - The local-copy `link_stat ... failed` / `file has vanished` operand lines, which the engine printed with `eprintln!`. ## The fix It reuses the existing escaper in `logging::escape`. There is no second escaper. - `logging::escape`: - `may_need_escaping()` is the fast-path test `escape_for_output` already ran, now split out so sinks can skip the copy. - `write_terminal_line()` / `eprint_terminal_line()` write one escaped stderr line. A clean line goes out with no copy. - `MessageSink`: - A `terminal_escaping` flag, set on the client stderr sink. A message whose text is clean keeps the vectored, allocation-free render. Only a text with something to escape is rendered into a buffer and escaped once. - `write_escaped_line()` for pre-formatted lines. - The style is read at write time, because `-8` and the locale are parsed after the sink is built. - `write_refusal` takes an `EscapeStyle`: - Client: the sink's style. - Server argv: `terminal_style()`, as log.c:499 applies on a server before multiplexing. - Daemon: `passthrough()`. This is deliberate. The daemon's refusal lines also go to its log sink, which escapes on its own as upstream's `logit()` does (log.c:143). Escaping here as well would print `\#134#013`, so each line is still escaped exactly once. - `emit_error_report` sends its cause and program lines through `write_escaped_line`. The remote shell's own stderr is still written as received. ## Measured on Linux, stderr cause line (`od -c`) and exit code | cell | rsync 3.5.2 | oc master | oc with this change | |---|---|---|---| | `--filter=$'+\vfoo'` | `invalid modifier '\#13' at position 1 in filter rule: +\#013foo`, exit 1 | raw `\v` twice, exit 1 | `invalid modifier '\#13' at position 1 in filter rule: +\#013foo`, exit 1 | | `--filter=$'foo\vbar'` | `Unknown filter rule: foo\#013bar`, exit 1 | raw `\v`, exit 1 | `Unknown filter rule: foo\#013bar`, exit 1 | | missing operand `no\001pe` | `link_stat ".../no\#001pe" failed`, exit 23 | raw `\001` on both lines, exit 23 | `link_stat ".../no\#001pe" failed` on both lines, exit 23 | | same, forwarded from a remote server | `\#1`, exit 23 | `\#1`, exit 23 | `\#1`, exit 23 (unchanged) | | missing operand `no\tpe` | raw TAB, exit 23 | raw TAB, exit 23 | raw TAB, exit 23 | | operand `café\001`, `LC_ALL=C` | `caf\#303\#251\#1` | raw | `caf\#303\#251\#1` | | operand `café\001`, `-8` or `C.UTF-8` | `caf` + raw `é` + `\#1` | raw | `caf` + raw `é` + `\#1` | ## Tests - `crates/cli/tests/client_stderr_control_byte_escaping.rs`: - Three oracle cells against rsync 3.5.2: VT in a refused modifier, the same under `-8`, and a control byte in an unknown rule. Each compares the cause line byte for byte, plus the exit code. - One cell for a control byte in a missing operand. It checks the escaping and exit 23, not the whole line, because the surrounding wording still differs (see below). - `MessageSink` unit tests, one per byte class: - C0 escaped and TAB raw. - DEL and high/C1 bytes. - The literal `\#ddd` guard. - An embedded newline staying on one line. - A raw trailing newline. - `write_escaped_line`. - Unit tests for `write_refusal` (VT) and `write_terminal_line`. Mutation: with the escaping switched off at each new site (the client sink flag, the `write_refusal` style, `MessageSink::escape_style`, `write_terminal_line`), all 12 new tests fail: 4/4 cli, 6/6 logging-sink, 1/1 core, 1/1 logging. ## Multi-line causes Escaping showed that oc folded some multi-line diagnostics into one line. Each such cause is now written one line per upstream `rprintf` call: - `Unexpected local arg: %s` and `If arg is a remote file/dir, prefix it with a colon (:).` are two `rprintf(FERROR, ...)` calls in 3.5.2 (main.c:1591-1592). oc built one cause with an embedded newline, so escaping printed `\#12` between the two parts. A `ClientError` cause now holds one line per upstream call (`cause_lines()`), and the report writes each line through the escaper. A newline inside the operand itself is still escaped as `\#12`, as log.c:288-291 does. - clap's parse error spans several lines. oc writes it line by line, so its own line breaks stay raw and only bytes inside each line are escaped. Upstream prints its option error as one popt line through `option_error()` (options.c:2087-2090, options.c:933), then the trailer (main.c:1916-1917). The wording differs, and this PR does not change it: - 3.5.2: `rsync: --version=extra: option does not take an argument`, then `rsync error: syntax or usage error (code 1) at main.c(1917) [client=3.5.2]` - oc: `rsync error: syntax or usage error: unexpected value 'extra' for '--version...' found; no more were expected`, a blank line, `Usage: rsync --version... [args]...`, then ` (code 1) [client=...]` - The unknown-option refusal and the failed `--log-file` open line were raw writes. They now go through the escaper too. Measured: 3.5.2 prints `rsync: --bo\#001gus: unknown option`, and oc now prints the same line. - A daemon that sends free text and then closes before acknowledging a module listing used to be reported as one message, with the received lines joined by newlines. Escaping would have printed `\#12` between them. Upstream prints each received line with its own `rprintf` (clientserver.c:428-429 for `@ERROR`, 438-439 for MOTD and listing lines). Each received line is now its own escaped stderr line, followed by the existing `daemon refused module listing` trailer. The trailer no longer repeats the lines. The connect-failure lines on that path also go through the escaper now. New tests in `crates/cli/src/frontend/tests/stderr_lines.rs`. Each one fails with the split reverted: - the local-after-remote refusal prints 3 lines, and a newline in the operand prints as `\#12` - a parse error keeps its lines - an unknown option is escaped - a daemon refusal prints one stderr line per received line, with a control byte escaped (plus a core `module_list` test that the refusal keeps one cause line per received line) ## Gates (Linux host, on master 0c57d58) | gate | exit | |---|---| | `cargo fmt --all -- --check` | 0 | | `python3 tools/ci/check_rustfmt_all.py` | 0 | | clippy on logging, logging-sink, core, cli, daemon, engine (`--all-targets --all-features -D warnings`) | 0 | | `cargo check --workspace --all-features --all-targets --target x86_64-pc-windows-gnu` | 0 | | `cargo clippy --workspace --all-features --all-targets --target x86_64-pc-windows-gnu --no-deps -- -D warnings` | 0 | | `cargo run --locked -p xtask -- no-placeholders` | 0 | | `tools/ci/citation_drift_audit.py --ratchet` | 0 | | new oracle file vs rsync 3.5.2 (`OC_RSYNC_UPSTREAM_COMPAT=1`) | 0 (4/4) | | cli `--lib` (all frontend unit tests) | 0 (3142/3142) | | cli `stderr_lines` + `clap` under `LC_ALL=C` and `LC_ALL=en_US.UTF-8` | 0 (7/7 each) | | cli summary/filters/argv_filters/refusal/filter_rule units | 0 (67/67) | | cli `module` (module listing) | 0 (20/20) | | core `module_list` | 0 (269/269) | | daemon `/list/` | 0 (118/118) | | cli `client_output_locale_escaping`, `upstream_compat_filter_rule_parse` | 0 (31/31) | | bin `ssh_transport` | 0 (15/15) | | test-support `daemon_pull_every_operand` | 0 (10/10) | | core `filter_args`, `client::error` | 0 (357/357) | | core `client::remote::invocation` | 0 (322/322) | | logging-sink `message_sink` | 0 (63/63) | | logging `escape` | 0 (50/50) | | engine orchestration/link_stat/vanished | 0 (20/20) | | daemon `/argv_filters/`, `/daemon_filter/` | 0 (39/39) | ## Remaining differences - The missing-operand report is worded differently from 3.5.2. oc prints a bare `link_stat ...` line, then an `rsync error: link_stat ... (code 23)` trailer. 3.5.2 prints `rsync: [sender] link_stat ...`, then `some files/attrs were not transferred ... (code 23)`. That is a separate text-parity gap; this change only fixes the escaping. - Other raw `eprintln!` diagnostics in the local-copy engine carry names that are not escaped yet. Examples: `symlink has no referent`, `opendir`, `directory has vanished`, and the skip notices. They can move to `eprint_terminal_line()` one by one. - The same applies to the remaining raw stderr writes of an oc `--server`, and to the copy of a daemon's refusal on its own stderr. - Stdout escaping is untouched. The escaping of valid UTF-8 names on stdout is tracked separately. Closes #8884
oferchen
added a commit
that referenced
this pull request
Nov 28, 2026
## Summary A daemon serving a module with `use chroot = no` had two gaps against rsync 3.5.2, one destructive bug, and one pre-existing rendering defect on its privileged leg. **Data loss: an opted-out module's symlinked root was replaced.** With `insecure links = yes` and `path =` naming a symlink, oc replaced the operator's symlink with a new empty directory and wrote the transfer into it. rsync 3.5.2 follows the link. oc now does the same: the symlink is still there afterward and the data lands in its target. **The module root was never walked by a rootless daemon.** rsync 3.5.2 enters the module root with `change_dir(module_chdir)` on every session (clientserver.c:1063). For an unchrooted module that is the ownership walk (util1.c:1351-1361): a symlink in `path =` owned by another user is refused. The client gets `@ERROR: chdir failed`, and the daemon log gets `chdir <path> failed` (clientserver.c:692-699). oc had this walk, but `apply_privilege_restrictions_with_upstream_errors` returned early when the session neither chrooted nor dropped privileges. A rootless daemon therefore served a foreign-owned symlinked module root, on push and pull alike. The early path now runs the same walk and keeps the root's descriptor. It does not chdir (see "Working directory" below). **The destination beneath the root was not walked either.** rsync 3.5.2 enters the client's destination with the confined walk `secure_relative_dirfd()` (util1.c:1430-1446). That walk follows an in-tree relative symlink and refuses one that leaves the module with `ELOOP`, whoever owns it. `get_local_name()` then prints `change_dir#1/#2/#3 "<dest>" (in <module>) failed` and exits 3. Under `--mkpath` it prints `mkdir ... failed` and exits 11 (main.c:757-869). oc instead did a plain stat and failed later in its anchored sandbox, with either an oc-only code-11 line or a landlock `EACCES`. The receiver now walks a daemon destination beneath the module root's descriptor and prints 3.5.2's lines. **Pre-existing defect on the privileged leg.** A root daemon serving an unchrooted module with `uid =` enters the module root and served the transfer as `.`. Two renderers took the module root from that spelling: - `full_fname()` rendered a missing source as `link_stat "/d/d/a1" (in m)`. 3.5.2 prints `"/d/a1"` (util1.c:1540-1547, `p1 = curr_dir + module_dirlen`). - A relative merge-file name was not joined onto the module root. oc logged `failed to open exclude file etc/hostname`; 3.5.2 logs `<module path>/etc/hostname` (exclude.c:735-746). Both reproduce on master (c87bc25) under `sudo`. Both renderers now read one absolute module root, recorded once per session. `insecure links = yes` keeps the plain open for both the root and the tail (syscall.c:139, :433-436; util1.c:1447-1451). A chrooted module also keeps the plain chdir for the tail. ## Difference from rsync 3.5.2's process model The observable semantics are 3.5.2's, taken from its C source: - the `full_fname()` strip (util1.c:1543) - the merge-file join (exclude.c:735-746) - entering the module root before the privilege drop (clientserver.c:1063) Only the mechanism differs, in one place. A rootless unchrooted session does not change directory; it walks relative to the module root's descriptor, because oc's threaded async daemon cannot share a process working directory. - **What 3.5.2 does:** every session runs `change_dir(module_chdir, CD_NORMAL)` (clientserver.c:1063). That is safe there because each connection is its own process: `start_accept_loop()` forks per connection (socket.c:761). - **Why oc differs:** under `--features async-daemon`, oc serves sessions as threads of one process, and those threads share one working directory. A `chdir`/`fchdir` in one session would move every other session. - **What oc does instead:** a rootless session runs the same ownership walk, keeps the module root's descriptor, and resolves the client's destination beneath that descriptor. - **Privileged sessions are unchanged:** they still `fchdir` into the module root before the privilege drop, as 3.5.2 does (clientserver.c:1063 before the setgid/setuid at :1102 and :1127). A module below a directory its `uid` cannot search works only that way. - **No async session reaches that `fchdir`:** a privileged session always runs in its own forked process, because the async daemon refuses `uid`, `gid`, `use chroot` and running as root (daemon.rs, `run_async_daemon`). No new task is needed. Client-visible output is byte-identical to 3.5.2. Both renderers take the module root from its absolute path, so they print what 3.5.2 prints from its working directory: - `full_fname()` strips the module root the way util1.c:1540-1547 does (`p1 = curr_dir + module_dirlen`). - A relative merge-file name is joined onto the module root, as exclude.c:735-746 joins it onto `dirbuf`. The oracle cells compare every line against 3.5.2, in both legs and in all four client/daemon pairings. ## Changes - `transfer` `config/served_root.rs`: new `ServedRoot`. It holds the module root's absolute path, its canonical form, whether the session runs from that directory, and the root's descriptor. It is set once per connection and replaces `daemon_module_dir`. - `transfer` `full_fname.rs`: `FullFnamePaths::daemon` takes the `ServedRoot`. The module strip always uses the absolute path. A session served from its working directory roots the relative spellings first; the sender's paths and `curr_dir` are both cwd-space (`.sender()`), the receiver's `curr_dir` only. - `transfer` `receiver/dest_root.rs`: new `Entry::Confined(ModuleRoot)`; `Entry::Walked` is Unix-only, as its only constructor is. The destination is walked beneath the root's descriptor: - change_dir#1 and #3 through `open_dir_beneath` - the change_dir#2 mkdir through `create_dir_beneath` - `--mkpath` through `make_path_beneath`, whose `ELOOP` stays make_path()'s own failure (exit 11), as the relative make_path of 3.5.2 reports it (syscall.c:2306-2332) - an `ELOOP` from change_dir is the refusal that names the step - `transfer` `receiver/directory/mod.rs`: the destination root itself is stat'd through a symlink that names it. Upstream stats `.` in the directory it entered (main.c:776-781). Without this, serving the absolute path brought the opted-out data-loss bug back. - `transfer` `setup/context.rs`: `destination_entry` picks `Confined` for an unchrooted daemon module that has not opted out. The merge-name filter strips the canonical and the absolute module root. - `daemon` `module_access/transfer/sandbox.rs`: - The rootless early path walks and opens the module root with no chdir. - The privileged path pins, then fchdirs, as before. Both return the root's descriptor for the `ServedRoot`. - On a refusal it logs the walk's own notice, then `[Receiver] chdir <path> failed: <strerror> (<errno>)` in rsyserr form (clientserver.c:695). - `daemon` `orchestration.rs`, `server_config.rs`: build the `ServedRoot` and hand it to the server config. A relative merge-file name is joined onto the absolute root (exclude.c:735-746). - `daemon` `module_access/helpers.rs`: `log_pending_diagnostics` drains session diagnostics into the daemon log. It is shared with `streams.rs`, so a notice raised before the transfer reaches the log, not stderr. - `daemon` `module_access/transfer/streams.rs`: a fatal cause and its trailer are written to the daemon log before they are framed for the client. This matches upstream rwrite(), which calls logit() before sending (log.c:390-407). - A 3.5.2 client exits on the first error frame and kills its remote-shell child (cleanup.c:203-204 kill_all()). Over a remote-shell daemon, that child is the oc server, so the line never reached the log. - Measured: the cell with a 3.5.2 client and an oc daemon over a remote shell failed on that log line before this change. - `fast_io` `at_syscalls/create.rs`: `open_dir_beneath`, `create_dir_beneath` and `make_path_beneath` take the anchor descriptor. `EINVAL` for an absolute path or `..`, as at syscall.c:3477-3484. `make_path_beneath_cwd` delegates to `make_path_beneath(CWD, ...)`. The cwd-only `open_dir_beneath_cwd` and `create_dir_beneath_cwd` are removed, so there are no duplicates. ## Deviations | Case | rsync 3.5.2 | oc | |---|---|---| | Push to `mod/esc/new/`, where `esc` leaves the module | `do_mkdir()` (main.c:817) follows `esc` and **creates `outside/new`**, then `change_dir#2 "esc/new" (in mod) failed: Too many levels of symbolic links (40)`, exit 3 | Refuses before the mkdir: the same `change_dir#2` line, exit 3, **nothing created outside the module** | This deviation is owner-approved and matches #8858 and #8899. Every other cell below matches 3.5.2. ## Measured The 3.5.2 client drove a 3.5.2 daemon and an oc daemon, each with `use chroot = no` and a global `log file`. The rootless rows ran the daemon as an unprivileged user, with `flink`/`esc` owned by `nobody`. | Cell | 3.5.2 | oc before | oc after | |---|---|---|---| | root-flink (module root is a foreign symlink) | `@ERROR: chdir failed`, exit 5 | transfer through the link, exit 0 | same as 3.5.2 | | root-fmid (`flink/sub`) | exit 5 | exit 0 | same | | pull-flink | exit 5 | exit 0 | same | | root-olink (own symlink) | exit 0 | exit 0 | same | | opt-root-flink (`insecure links = yes`) | follows, exit 0 | replaced the symlink with an empty dir | same as 3.5.2 | | tail-rel (`rel -> inner`) | exit 0 | exit 0 | same | | tail-esc / tail-oesc (foreign / own escaping link) | `change_dir#1 "esc/" (in mod) ... (40)`, exit 3 | oc-only line, exit 11 | same line, exit 3 | | tail-escfile (`mod/esc/f`) | `change_dir#3 "esc" (in mod) ... (40)`, exit 3 | exit 11 | same | | tail-escmk (`--mkpath mod/esc/a/b/`) | `mkdir "esc/a/b/" (in mod) ... (40)`, exit 11 | `... Permission denied (13)`, exit 11 | same | | tail-escnew | see Deviations | `mkdir ... (13)`, exit 11 | see Deviations | | opt-tail-esc (`insecure links = yes`) | follows, exit 0 | exit 0 | same | | priv: pull missing `d/a1` (root daemon, `uid =` the user) | `link_stat "/d/a1" (in m)`, exit 23 | `link_stat "/d/d/a1" (in m)` | same as 3.5.2 | | priv: `-M--filter=. /etc/hostname` | log: `failed to open exclude file <module>/etc/hostname`, exit 11 | log: `... etc/hostname` | same as 3.5.2 | Daemon log after the change: line for line equal to 3.5.2's, apart from the program name (`oc-rsync:`) and the trailer location. That covers the untrusted-symlink notice, `[Receiver] chdir <path> failed: ...`, each `change_dir#N`/`mkdir` line with its trailer, and the merge-file line. ## Tests - `crates/cli/tests/daemon_module_change_dir.rs`. It runs each cell oc to oc and, when `OC_RSYNC_UPSTREAM_BIN_3_5_2` resolves, with a 3.5.2 client, a 3.5.2 daemon, and both. Results must be equal, except for the deviation cell, which pins oc's daemon. The cells cover: - the three refused tails (exit code, line, trailer, daemon-log line, nothing written outside) - the new-directory deviation - in-tree and opted-out links - a Linux-only foreign-owned module root: `@ERROR: chdir failed`, exit 5, nothing written, and the untrusted-symlink notice followed by the `chdir <path> failed` log line - a Linux-only opted-out foreign root (the data-loss bug): exit 0, the root is still a symlink to the same target, and the data is in the target - Linux-only privileged leg under `sudo -n`: a missing source renders `link_stat "/inner/a1" (in priv)`, and the merge file is logged as `<module>/etc/hostname`. Red against the master binary (`"/inner/inner/a1"`), green after. - Linux-only privileged module below a directory its `uid` cannot search (mode 000): push, pull and a new destination directory all exit 0 and land in the module. This pins why the privileged session keeps its working-directory entry. - The root and privileged cells need `sudo -n`. They fail rather than skip when it is unavailable. - Log-line cells compare each daemon log line byte for byte with 3.5.2's line. Only the program name is substituted (`rsync` vs `oc-rsync`), and the log stamp before `] ` is stripped. A trailer is compared up to its source location, which names each program's own file and line. - `crates/daemon/src/tests/chunks/daemon_async_push_pull.rs`: `concurrent_async_sessions_keep_their_own_module_roots_and_the_process_cwd`. Two sessions on different modules run at once in one async daemon. Each pushes 200 files and pulls a seed from its own module, and the process working directory is unchanged afterwards. Red on this PR's first head (a7ac723), where the rootless path fchdir'd: the cwd moved to `module-a`. Green on master and after. - `crates/fast_io/tests/daemon_destination_beneath_root.rs` (renamed from `..._beneath_cwd.rs`): the three walks beneath a descriptor, with no chdir. Covers the root and an in-tree link, an escape, `EINVAL`, mkdir errors, a whole `make_path`, nothing made outside, and a cell showing the anchor, not the cwd, decides where a name resolves. - `full_fname.rs` unit tests: a session served from its cwd renders the sender's `./d/a1` once below the root; the receiver roots only its `curr_dir`; a session not served from its cwd roots nothing. - Before and after: on the base sources, 4 of the 5 rootless cli cells fail. The foreign module root exits 0, the opted-out root's symlink is replaced, and the tails and the new dir exit 11 with oc's own lines. The in-tree and opted-out-tail cell passes on both, as it should. After the change all pass. - Mutations, each red on the new cells: - (a) plain open of the module root: the root cells red (measured before the cell split, 4/4) - (b) the tail follows the escaping link: only the 2 tail cells red - (c) swapped step mapping, change_dir#2 reported as #1: only the new-dir cell red - Measured locally on Linux, with `OC_RSYNC_UPSTREAM_COMPAT=1` and the 3.5.2 oracle (`cargo nextest run -p <crate> --all-features`): - cli: 3773 passed, 2 skipped - bin: 1092 passed, 29 skipped (with the 3.5.1 oracle as well) - fast_io: 1381 passed, 1 skipped - transfer: 3515 passed, 0 skipped - daemon: 2209 passed, 20 skipped - The skips are existing ones. None of the new cells skips; the root and privileged cells fail without `sudo -n`. - Gates: - fmt and `check_rustfmt_all` - workspace clippy `-D warnings` on the host and on `x86_64-pc-windows-gnu` - rustdoc `-D warnings` - `no-placeholders` - `citation_drift_audit --ratchet` ## Follow-ups - A chrooted module with a `/./` inner path (`module_dirlen > 0`). 3.5.2 confines the tail there too (util1.c:1430). oc keeps its anchored sandbox for chrooted modules, unchanged here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rsync-protocolcrate with protocol version selection helpers and testsCargo.lockTesting