Skip to content

feat: add missing daemon config directives and fix unknown directive handling - #2381

Merged
oferchen merged 1 commit into
masterfrom
feature/daemon-config-directives-v2
Feb 21, 2026
Merged

oferchen merged 1 commit into
masterfrom
feature/daemon-config-directives-v2

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Add 11 new per-module configuration directives to the daemon config parser, mirroring upstream rsync's rsyncd.conf parameters from loadparm.c:
    • max_verbosity (default: 1) — caps client verbosity
    • ignore_errors (default: false) — ignore I/O errors during delete
    • ignore_nonreadable (default: false) — skip unreadable files
    • transfer_logging (default: false) — enable per-file transfer logging
    • log_format (default: "%o %h [%a] %m (%u) %f %l") — transfer log format
    • dont_compress — glob patterns of files not to compress
    • pre_xfer_exec / post_xfer_exec — pre/post transfer commands
    • temp_dir — temporary directory for received files
    • charset — character set for filename conversion
    • forward_lookup (default: true) — DNS forward lookup verification
  • Change unknown directive handling to log a warning and continue instead of returning an error, for both global and per-module sections

Test plan

  • All 789 daemon crate tests pass
  • New tests for each directive: parsing, defaults, invalid values
  • Test for unknown global and per-module directive warning behavior
  • Comprehensive test parsing all 11 new directives together
  • cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings passes
  • cargo fmt --all -- --check passes

…handling

Add 11 new per-module configuration directives to the daemon config
parser: max_verbosity, ignore_errors, ignore_nonreadable,
transfer_logging, log_format, dont_compress, pre_xfer_exec,
post_xfer_exec, temp_dir, charset, and forward_lookup. These mirror
upstream rsync's rsyncd.conf parameters from loadparm.c.

Change unknown directive handling to log a warning and continue instead
of returning an error, for both global and per-module sections. This
matches upstream rsync's behavior of gracefully ignoring unrecognized
directives.
@github-actions github-actions Bot added the enhancement New feature or request label Feb 21, 2026
@oferchen
oferchen merged commit 97d92de into master Feb 21, 2026
15 of 16 checks passed
oferchen added a commit that referenced this pull request Feb 21, 2026
Add execution logic for the pre-xfer exec and post-xfer exec daemon
module directives. The config fields and parsing were added in #2381;
this wires up the actual command execution with upstream-compatible
environment variables (RSYNC_MODULE_NAME, RSYNC_MODULE_PATH,
RSYNC_HOST_ADDR, RSYNC_HOST_NAME, RSYNC_USER_NAME, RSYNC_REQUEST,
and RSYNC_EXIT_STATUS for post-xfer).

Commands run via sh -c (Unix) or cmd /C (Windows). Pre-xfer failures
deny the transfer with an @error message. Post-xfer failures are
logged but do not affect the transfer exit status, matching upstream
clientserver.c semantics.
oferchen added a commit that referenced this pull request Feb 21, 2026
Add execution logic for the pre-xfer exec and post-xfer exec daemon
module directives. The config fields and parsing were added in #2381;
this wires up the actual command execution with upstream-compatible
environment variables (RSYNC_MODULE_NAME, RSYNC_MODULE_PATH,
RSYNC_HOST_ADDR, RSYNC_HOST_NAME, RSYNC_USER_NAME, RSYNC_REQUEST,
and RSYNC_EXIT_STATUS for post-xfer).

Commands run via sh -c (Unix) or cmd /C (Windows). Pre-xfer failures
deny the transfer with an @error message. Post-xfer failures are
logged but do not affect the transfer exit status, matching upstream
clientserver.c semantics.
@oferchen
oferchen deleted the feature/daemon-config-directives-v2 branch February 21, 2026 15:17
oferchen added a commit that referenced this pull request May 1, 2026
…handling (#2381)

Add 11 new per-module configuration directives to the daemon config
parser: max_verbosity, ignore_errors, ignore_nonreadable,
transfer_logging, log_format, dont_compress, pre_xfer_exec,
post_xfer_exec, temp_dir, charset, and forward_lookup. These mirror
upstream rsync's rsyncd.conf parameters from loadparm.c.

Change unknown directive handling to log a warning and continue instead
of returning an error, for both global and per-module sections. This
matches upstream rsync's behavior of gracefully ignoring unrecognized
directives.
oferchen added a commit that referenced this pull request May 1, 2026
Add execution logic for the pre-xfer exec and post-xfer exec daemon
module directives. The config fields and parsing were added in #2381;
this wires up the actual command execution with upstream-compatible
environment variables (RSYNC_MODULE_NAME, RSYNC_MODULE_PATH,
RSYNC_HOST_ADDR, RSYNC_HOST_NAME, RSYNC_USER_NAME, RSYNC_REQUEST,
and RSYNC_EXIT_STATUS for post-xfer).

Commands run via sh -c (Unix) or cmd /C (Windows). Pre-xfer failures
deny the transfer with an @error message. Post-xfer failures are
logged but do not affect the transfer exit status, matching upstream
clientserver.c semantics.
oferchen added a commit that referenced this pull request May 5, 2026
…handling (#2381)

Add 11 new per-module configuration directives to the daemon config
parser: max_verbosity, ignore_errors, ignore_nonreadable,
transfer_logging, log_format, dont_compress, pre_xfer_exec,
post_xfer_exec, temp_dir, charset, and forward_lookup. These mirror
upstream rsync's rsyncd.conf parameters from loadparm.c.

Change unknown directive handling to log a warning and continue instead
of returning an error, for both global and per-module sections. This
matches upstream rsync's behavior of gracefully ignoring unrecognized
directives.
oferchen added a commit that referenced this pull request May 5, 2026
Add execution logic for the pre-xfer exec and post-xfer exec daemon
module directives. The config fields and parsing were added in #2381;
this wires up the actual command execution with upstream-compatible
environment variables (RSYNC_MODULE_NAME, RSYNC_MODULE_PATH,
RSYNC_HOST_ADDR, RSYNC_HOST_NAME, RSYNC_USER_NAME, RSYNC_REQUEST,
and RSYNC_EXIT_STATUS for post-xfer).

Commands run via sh -c (Unix) or cmd /C (Windows). Pre-xfer failures
deny the transfer with an @error message. Post-xfer failures are
logged but do not affect the transfer exit status, matching upstream
clientserver.c semantics.
oferchen added a commit that referenced this pull request May 18, 2026
…ap at delete emitter (ATU-4 #2381)

Convert the cursor handoff in `DeleteContext::into_emitter` from
`Arc::try_unwrap(self.cursor)` plus `Mutex::into_inner` to a
crossbeam-channel producer/consumer pair.

Workers (clones of `Arc<DeleteContext>`) call `observe_segment_for_delete`
and `observe_directory`, which enqueue an owned `CursorObservation`
onto the producer side. The drain (`into_emitter`) takes `self` by
value - by Rust ownership rules every Arc clone has been released by
that point - then drops the master sender to close the channel and
blocks on `rx.recv()` until it returns `Err`. Each observation is
folded into a freshly built `DirTraversalCursor`. No `try_unwrap` on
the cursor handle; no `Mutex::into_inner` panic on poison.

The plan-map side keeps `Arc::try_unwrap`, now wrapped in a
`try_unwrap_or_log` helper that emits a structured `tracing::warn!`
with strong/weak counts before returning the original `Arc`. This is
the documented transition-era fallback for fragile drain sites that
have not yet adopted channel-shutdown handoff (per
`docs/architecture/drain-error-recovery.md`).

Tests added:

- `channel_drain_completes_when_workers_drop_normally` - spawns 8
  producer threads, joins them all, asserts the drain finishes without
  blocking and counts every worker observation.
- `channel_drain_completes_when_worker_panics_mid_send` - one worker
  panics inside `catch_unwind` after sending its observation; the
  drain still completes and the surviving worker's observation is
  delivered.

For tests and diagnostics that want mid-flight cursor inspection,
`cursor_snapshot()` drains the channel, replays the observations into
a private cursor, then re-enqueues them so the eventual drain still
sees the full set. Three internal tests and one transfer-side
integration test now access the cursor through that accessor.

`DirTraversalCursor` and its `Frame` derive `Clone` so the snapshot
helper can rebuild a private view without changing the original.

Closes ATU-4 (#2381).
oferchen added a commit that referenced this pull request May 18, 2026
…ap at delete emitter (ATU-4 #2381)

Convert the cursor handoff in `DeleteContext::into_emitter` from
`Arc::try_unwrap(self.cursor)` plus `Mutex::into_inner` to a
crossbeam-channel producer/consumer pair.

Workers (clones of `Arc<DeleteContext>`) call `observe_segment_for_delete`
and `observe_directory`, which enqueue an owned `CursorObservation`
onto the producer side. The drain (`into_emitter`) takes `self` by
value - by Rust ownership rules every Arc clone has been released by
that point - then drops the master sender to close the channel and
blocks on `rx.recv()` until it returns `Err`. Each observation is
folded into a freshly built `DirTraversalCursor`. No `try_unwrap` on
the cursor handle; no `Mutex::into_inner` panic on poison.

The plan-map side keeps `Arc::try_unwrap`, now wrapped in a
`try_unwrap_or_log` helper that emits a structured `tracing::warn!`
with strong/weak counts before returning the original `Arc`. This is
the documented transition-era fallback for fragile drain sites that
have not yet adopted channel-shutdown handoff (per
`docs/architecture/drain-error-recovery.md`).

Tests added:

- `channel_drain_completes_when_workers_drop_normally` - spawns 8
  producer threads, joins them all, asserts the drain finishes without
  blocking and counts every worker observation.
- `channel_drain_completes_when_worker_panics_mid_send` - one worker
  panics inside `catch_unwind` after sending its observation; the
  drain still completes and the surviving worker's observation is
  delivered.

For tests and diagnostics that want mid-flight cursor inspection,
`cursor_snapshot()` drains the channel, replays the observations into
a private cursor, then re-enqueues them so the eventual drain still
sees the full set. Three internal tests and one transfer-side
integration test now access the cursor through that accessor.

`DirTraversalCursor` and its `Frame` derive `Clone` so the snapshot
helper can rebuild a private view without changing the original.

Closes ATU-4 (#2381).
oferchen added a commit that referenced this pull request May 18, 2026
…ap at delete emitter (ATU-4 #2381)

Convert the cursor handoff in `DeleteContext::into_emitter` from
`Arc::try_unwrap(self.cursor)` plus `Mutex::into_inner` to a
crossbeam-channel producer/consumer pair.

Workers (clones of `Arc<DeleteContext>`) call `observe_segment_for_delete`
and `observe_directory`, which enqueue an owned `CursorObservation`
onto the producer side. The drain (`into_emitter`) takes `self` by
value - by Rust ownership rules every Arc clone has been released by
that point - then drops the master sender to close the channel and
blocks on `rx.recv()` until it returns `Err`. Each observation is
folded into a freshly built `DirTraversalCursor`. No `try_unwrap` on
the cursor handle; no `Mutex::into_inner` panic on poison.

The plan-map side keeps `Arc::try_unwrap`, now wrapped in a
`try_unwrap_or_log` helper that emits a structured `tracing::warn!`
with strong/weak counts before returning the original `Arc`. This is
the documented transition-era fallback for fragile drain sites that
have not yet adopted channel-shutdown handoff (per
`docs/architecture/drain-error-recovery.md`).

Tests added:

- `channel_drain_completes_when_workers_drop_normally` - spawns 8
  producer threads, joins them all, asserts the drain finishes without
  blocking and counts every worker observation.
- `channel_drain_completes_when_worker_panics_mid_send` - one worker
  panics inside `catch_unwind` after sending its observation; the
  drain still completes and the surviving worker's observation is
  delivered.

For tests and diagnostics that want mid-flight cursor inspection,
`cursor_snapshot()` drains the channel, replays the observations into
a private cursor, then re-enqueues them so the eventual drain still
sees the full set. Three internal tests and one transfer-side
integration test now access the cursor through that accessor.

`DirTraversalCursor` and its `Frame` derive `Clone` so the snapshot
helper can rebuild a private view without changing the original.

Closes ATU-4 (#2381).
oferchen added a commit that referenced this pull request May 18, 2026
…ap at delete emitter (ATU-4 #2381) (#4401)

Convert the cursor handoff in `DeleteContext::into_emitter` from
`Arc::try_unwrap(self.cursor)` plus `Mutex::into_inner` to a
crossbeam-channel producer/consumer pair.

Workers (clones of `Arc<DeleteContext>`) call `observe_segment_for_delete`
and `observe_directory`, which enqueue an owned `CursorObservation`
onto the producer side. The drain (`into_emitter`) takes `self` by
value - by Rust ownership rules every Arc clone has been released by
that point - then drops the master sender to close the channel and
blocks on `rx.recv()` until it returns `Err`. Each observation is
folded into a freshly built `DirTraversalCursor`. No `try_unwrap` on
the cursor handle; no `Mutex::into_inner` panic on poison.

The plan-map side keeps `Arc::try_unwrap`, now wrapped in a
`try_unwrap_or_log` helper that emits a structured `tracing::warn!`
with strong/weak counts before returning the original `Arc`. This is
the documented transition-era fallback for fragile drain sites that
have not yet adopted channel-shutdown handoff (per
`docs/architecture/drain-error-recovery.md`).

Tests added:

- `channel_drain_completes_when_workers_drop_normally` - spawns 8
  producer threads, joins them all, asserts the drain finishes without
  blocking and counts every worker observation.
- `channel_drain_completes_when_worker_panics_mid_send` - one worker
  panics inside `catch_unwind` after sending its observation; the
  drain still completes and the surviving worker's observation is
  delivered.

For tests and diagnostics that want mid-flight cursor inspection,
`cursor_snapshot()` drains the channel, replays the observations into
a private cursor, then re-enqueues them so the eventual drain still
sees the full set. Three internal tests and one transfer-side
integration test now access the cursor through that accessor.

`DirTraversalCursor` and its `Frame` derive `Clone` so the snapshot
helper can rebuild a private view without changing the original.

Closes ATU-4 (#2381).
oferchen added a commit that referenced this pull request May 18, 2026
…ap at delete emitter (ATU-4 #2381) (#4401)

Convert the cursor handoff in `DeleteContext::into_emitter` from
`Arc::try_unwrap(self.cursor)` plus `Mutex::into_inner` to a
crossbeam-channel producer/consumer pair.

Workers (clones of `Arc<DeleteContext>`) call `observe_segment_for_delete`
and `observe_directory`, which enqueue an owned `CursorObservation`
onto the producer side. The drain (`into_emitter`) takes `self` by
value - by Rust ownership rules every Arc clone has been released by
that point - then drops the master sender to close the channel and
blocks on `rx.recv()` until it returns `Err`. Each observation is
folded into a freshly built `DirTraversalCursor`. No `try_unwrap` on
the cursor handle; no `Mutex::into_inner` panic on poison.

The plan-map side keeps `Arc::try_unwrap`, now wrapped in a
`try_unwrap_or_log` helper that emits a structured `tracing::warn!`
with strong/weak counts before returning the original `Arc`. This is
the documented transition-era fallback for fragile drain sites that
have not yet adopted channel-shutdown handoff (per
`docs/architecture/drain-error-recovery.md`).

Tests added:

- `channel_drain_completes_when_workers_drop_normally` - spawns 8
  producer threads, joins them all, asserts the drain finishes without
  blocking and counts every worker observation.
- `channel_drain_completes_when_worker_panics_mid_send` - one worker
  panics inside `catch_unwind` after sending its observation; the
  drain still completes and the surviving worker's observation is
  delivered.

For tests and diagnostics that want mid-flight cursor inspection,
`cursor_snapshot()` drains the channel, replays the observations into
a private cursor, then re-enqueues them so the eventual drain still
sees the full set. Three internal tests and one transfer-side
integration test now access the cursor through that accessor.

`DirTraversalCursor` and its `Frame` derive `Clone` so the snapshot
helper can rebuild a private view without changing the original.

Closes ATU-4 (#2381).
oferchen added a commit that referenced this pull request May 18, 2026
…ap at delete emitter (ATU-4 #2381) (#4401)

Convert the cursor handoff in `DeleteContext::into_emitter` from
`Arc::try_unwrap(self.cursor)` plus `Mutex::into_inner` to a
crossbeam-channel producer/consumer pair.

Workers (clones of `Arc<DeleteContext>`) call `observe_segment_for_delete`
and `observe_directory`, which enqueue an owned `CursorObservation`
onto the producer side. The drain (`into_emitter`) takes `self` by
value - by Rust ownership rules every Arc clone has been released by
that point - then drops the master sender to close the channel and
blocks on `rx.recv()` until it returns `Err`. Each observation is
folded into a freshly built `DirTraversalCursor`. No `try_unwrap` on
the cursor handle; no `Mutex::into_inner` panic on poison.

The plan-map side keeps `Arc::try_unwrap`, now wrapped in a
`try_unwrap_or_log` helper that emits a structured `tracing::warn!`
with strong/weak counts before returning the original `Arc`. This is
the documented transition-era fallback for fragile drain sites that
have not yet adopted channel-shutdown handoff (per
`docs/architecture/drain-error-recovery.md`).

Tests added:

- `channel_drain_completes_when_workers_drop_normally` - spawns 8
  producer threads, joins them all, asserts the drain finishes without
  blocking and counts every worker observation.
- `channel_drain_completes_when_worker_panics_mid_send` - one worker
  panics inside `catch_unwind` after sending its observation; the
  drain still completes and the surviving worker's observation is
  delivered.

For tests and diagnostics that want mid-flight cursor inspection,
`cursor_snapshot()` drains the channel, replays the observations into
a private cursor, then re-enqueues them so the eventual drain still
sees the full set. Three internal tests and one transfer-side
integration test now access the cursor through that accessor.

`DirTraversalCursor` and its `Frame` derive `Clone` so the snapshot
helper can rebuild a private view without changing the original.

Closes ATU-4 (#2381).
oferchen added a commit that referenced this pull request Aug 24, 2026
…ap at delete emitter (ATU-4 #2381) (#4401)

Convert the cursor handoff in `DeleteContext::into_emitter` from
`Arc::try_unwrap(self.cursor)` plus `Mutex::into_inner` to a
crossbeam-channel producer/consumer pair.

Workers (clones of `Arc<DeleteContext>`) call `observe_segment_for_delete`
and `observe_directory`, which enqueue an owned `CursorObservation`
onto the producer side. The drain (`into_emitter`) takes `self` by
value - by Rust ownership rules every Arc clone has been released by
that point - then drops the master sender to close the channel and
blocks on `rx.recv()` until it returns `Err`. Each observation is
folded into a freshly built `DirTraversalCursor`. No `try_unwrap` on
the cursor handle; no `Mutex::into_inner` panic on poison.

The plan-map side keeps `Arc::try_unwrap`, now wrapped in a
`try_unwrap_or_log` helper that emits a structured `tracing::warn!`
with strong/weak counts before returning the original `Arc`. This is
the documented transition-era fallback for fragile drain sites that
have not yet adopted channel-shutdown handoff (per
`docs/architecture/drain-error-recovery.md`).

Tests added:

- `channel_drain_completes_when_workers_drop_normally` - spawns 8
  producer threads, joins them all, asserts the drain finishes without
  blocking and counts every worker observation.
- `channel_drain_completes_when_worker_panics_mid_send` - one worker
  panics inside `catch_unwind` after sending its observation; the
  drain still completes and the surviving worker's observation is
  delivered.

For tests and diagnostics that want mid-flight cursor inspection,
`cursor_snapshot()` drains the channel, replays the observations into
a private cursor, then re-enqueues them so the eventual drain still
sees the full set. Three internal tests and one transfer-side
integration test now access the cursor through that accessor.

`DirTraversalCursor` and its `Frame` derive `Clone` so the snapshot
helper can rebuild a private view without changing the original.

Closes ATU-4 (#2381).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant