Repository navigation
fix(cli): pass is_sender from ClientConfig into OutFormatContext - #5794
Merged
Merged
Conversation
oferchen
force-pushed
the
fix/uts-it-direction-arrow
branch
from
June 14, 2026 20:55
c4e837a to
793cd68
Compare
The two production sites that build `OutFormatContext` in `crates/cli/src/frontend/execution/drive/summary.rs` both used `OutFormatContext::default()` which left `is_sender` at `false`. This flipped the itemize direction arrow for SSH-push sender runs: oc-rsync emitted `>f+++++++++` where upstream rsync emits `<f+++++++++` because the formatter's polarity is already correct (`< if is_sender else >`) but the role was never threaded in. Empirical evidence from an SSH sweep against the PR #5786 binary showed 9 of 9 SSH-push scenarios emitted the wrong arrow. The destination tree was byte-identical with upstream; only the log line differed. upstream: log.c:701-704 c[0] = iflags & ITEM_LOCAL_CHANGE ? iflags & ITEM_XNAME_FOLLOWS ? 'h' : 'c' : !(iflags & ITEM_TRANSFER) ? '.' : !local_server && *op == 's' ? '<' : '>'; i.e. SSH-sender emits '<', everything else emits '>'. Fix: - Add `ClientConfig::is_local_sender()` which inspects `transfer_args` via the existing `client::remote::operand_is_remote` classifier. Push (remote dest, all-local sources) -> sender. Pull (any remote source) -> receiver. Local copy and empty-args -> sender (harmless because upstream hits the `local_server` branch which emits `>`). - Capture the flag before `config` is consumed by `run_client_with_observer` in `execute_transfer`. - Thread it into `OutFormatContext` via a new `with_is_sender` constructor, including the log-file path through a new `EmitLogOutputParams::is_sender` field. Wire protocol unaffected (purely user-facing log layer).
oferchen
force-pushed
the
fix/uts-it-direction-arrow
branch
from
June 14, 2026 21:11
793cd68 to
3b01e0f
Compare
8 tasks
oferchen
added a commit
that referenced
this pull request
Jun 15, 2026
PR #5794 added ClientConfig::is_local_sender() to thread the itemize direction arrow into OutFormatContext. Its docstring claimed the local-copy and empty-args polarity was "harmless because upstream hits the local_server branch which emits >". That assumption holds for upstream's log.c, but oc-rsync's itemize formatter at frontend/out_format/render/itemize.rs only branches on is_sender. With the helper returning true for local copies the formatter started emitting < where upstream emits >, breaking every local-copy itemize test (itemize_combined_with_dry_run_shows_what_would_transfer, itemize_combined_with_verbose_shows_itemized_format, itemize_last_toggle_wins_enabled) across all platforms. Narrow is_local_sender() to return true only when the destination is remote and every source is local - the exact case upstream's log.c renders as <. Local copies, pulls, empty arg lists, and proxy operations all return false so the formatter emits > to match upstream. upstream: log.c:701-704
oferchen
added a commit
that referenced
this pull request
Jun 15, 2026
* fix(cli): drain stdin for both server roles to unblock peer shutdown Under the lsh.sh remote-shell transport (00-hello, alt-dest, files-from, ssh-basic, symlink-dirlink-basis, hardlinks), the previous receiver-only stdin drain caused the server-sender (generator) process to exit before the upstream peer (running as server-receiver child) finished its exit_cleanup() sequence in noop_io_until_death(). The peer was left waiting for FIN on its stdin while we tore down, producing "connection unexpectedly closed" and a 300s timeout in runtests.py. Upstream cleanup.c:254 calls noop_io_until_death() unconditionally for both am_sender and am_receiver server children; mirror that contract by removing the role gate so the generator path also drains stdin to EOF after shutting down its write half. upstream: io.c:943 noop_io_until_death(), cleanup.c:254 _exit_cleanup() * test(cli): drain_stdin_until_eof unit tests for server-sender shutdown Extract the previously-inlined stdin drain loop into a `Read`-generic helper and add nextest coverage for the four shapes that matter on the lsh.sh / SSH transport: - bare EOF (the steady-state case once the peer's exit_cleanup runs) - payload-then-EOF (peer flushes trailing MSG_STATS / NDX_DONE before FIN) - Interrupted + WouldBlock retries (no spurious exit on transient errors) - hard error (drain breaks cleanly instead of spinning) The helper mirrors upstream rsync's noop_io_until_death() (io.c:943) and is now exercised by both the receiver and the generator roles after the goodbye handshake. Tests document the contract so a future revert of the gate would surface immediately. * fix(cli): only report is_local_sender for remote-dest pushes PR #5794 added ClientConfig::is_local_sender() to thread the itemize direction arrow into OutFormatContext. Its docstring claimed the local-copy and empty-args polarity was "harmless because upstream hits the local_server branch which emits >". That assumption holds for upstream's log.c, but oc-rsync's itemize formatter at frontend/out_format/render/itemize.rs only branches on is_sender. With the helper returning true for local copies the formatter started emitting < where upstream emits >, breaking every local-copy itemize test (itemize_combined_with_dry_run_shows_what_would_transfer, itemize_combined_with_verbose_shows_itemized_format, itemize_last_toggle_wins_enabled) across all platforms. Narrow is_local_sender() to return true only when the destination is remote and every source is local - the exact case upstream's log.c renders as <. Local copies, pulls, empty arg lists, and proxy operations all return false so the formatter emits > to match upstream. upstream: log.c:701-704 * fix(metadata): cover remaining chmod sites under --keep-dirlinks bypass PR #5793 added `chmod_path_honoring_keep_dirlinks` but only routed the chmod-modifier and compute_dest_mode paths through it. The path-based fallbacks in `set_permissions_like`, `apply_permissions_without_chmod` executability branch, and both `apply_permissions_from_entry` branches still called `fast_io::secure_chmod_at` directly, which the dirfd sandbox refuses when the destination's parent is a symlink-to-a-dir. Failing test `apply::tests::keep_dirlinks_bypasses_secure_chmod_sandbox` on every Unix CI cell exercised the `apply_file_metadata_with_options` -> `apply_permissions_without_chmod` -> `set_permissions_like` chain and hit ENOTDIR on `dest/alpha/a.txt` whose parent `alpha` is a symlink. Route all four remaining sites through the helper. Pass `options` into `set_permissions_like` (only 2 callers, both in this file) so the Unix chmod can pick `std::fs::set_permissions` when `keep_dirlinks` is set, mirroring upstream `generator.c:1344 link_stat(fname, &sx.st, keep_dirlinks && is_dir)`.
oferchen
added a commit
that referenced
this pull request
Jun 15, 2026
…ss (#5799) * fix(metadata): cover remaining chmod sites under --keep-dirlinks bypass PR #5793 added `chmod_path_honoring_keep_dirlinks` but only routed the chmod-modifier and compute_dest_mode paths through it. The path-based fallbacks in `set_permissions_like`, `apply_permissions_without_chmod` executability branch, and both `apply_permissions_from_entry` branches still called `fast_io::secure_chmod_at` directly, which the dirfd sandbox refuses when the destination's parent is a symlink-to-a-dir. Failing test `apply::tests::keep_dirlinks_bypasses_secure_chmod_sandbox` on every Unix CI cell exercised the `apply_file_metadata_with_options` -> `apply_permissions_without_chmod` -> `set_permissions_like` chain and hit ENOTDIR on `dest/alpha/a.txt` whose parent `alpha` is a symlink. Route all four remaining sites through the helper. Pass `options` into `set_permissions_like` (only 2 callers, both in this file) so the Unix chmod can pick `std::fs::set_permissions` when `keep_dirlinks` is set, mirroring upstream `generator.c:1344 link_stat(fname, &sx.st, keep_dirlinks && is_dir)`. * fix(cli): only report is_local_sender for remote-dest pushes PR #5794 added ClientConfig::is_local_sender() to thread the itemize direction arrow into OutFormatContext. Its docstring claimed the local-copy and empty-args polarity was "harmless because upstream hits the local_server branch which emits >". That assumption holds for upstream's log.c, but oc-rsync's itemize formatter at frontend/out_format/render/itemize.rs only branches on is_sender. With the helper returning true for local copies the formatter started emitting < where upstream emits >, breaking every local-copy itemize test (itemize_combined_with_dry_run_shows_what_would_transfer, itemize_combined_with_verbose_shows_itemized_format, itemize_last_toggle_wins_enabled) across all platforms. Narrow is_local_sender() to return true only when the destination is remote and every source is local - the exact case upstream's log.c renders as <. Local copies, pulls, empty arg lists, and proxy operations all return false so the formatter emits > to match upstream. upstream: log.c:701-704
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
The two production sites that build `OutFormatContext` in `crates/cli/src/frontend/execution/drive/summary.rs` both used `OutFormatContext::default()` which left `is_sender` at `false`. This flipped the itemize direction arrow for SSH-push sender runs: oc-rsync emitted `>f+++++++++` where upstream rsync emits `<f+++++++++` because the formatter's polarity is already correct (`< if is_sender else >`) but the role was never threaded in. Empirical evidence from an SSH sweep against the PR #5786 binary showed 9 of 9 SSH-push scenarios emitted the wrong arrow. The destination tree was byte-identical with upstream; only the log line differed. upstream: log.c:701-704 c[0] = iflags & ITEM_LOCAL_CHANGE ? iflags & ITEM_XNAME_FOLLOWS ? 'h' : 'c' : !(iflags & ITEM_TRANSFER) ? '.' : !local_server && *op == 's' ? '<' : '>'; i.e. SSH-sender emits '<', everything else emits '>'. Fix: - Add `ClientConfig::is_local_sender()` which inspects `transfer_args` via the existing `client::remote::operand_is_remote` classifier. Push (remote dest, all-local sources) -> sender. Pull (any remote source) -> receiver. Local copy and empty-args -> sender (harmless because upstream hits the `local_server` branch which emits `>`). - Capture the flag before `config` is consumed by `run_client_with_observer` in `execute_transfer`. - Thread it into `OutFormatContext` via a new `with_is_sender` constructor, including the log-file path through a new `EmitLogOutputParams::is_sender` field. Wire protocol unaffected (purely user-facing log layer).
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
* fix(cli): drain stdin for both server roles to unblock peer shutdown Under the lsh.sh remote-shell transport (00-hello, alt-dest, files-from, ssh-basic, symlink-dirlink-basis, hardlinks), the previous receiver-only stdin drain caused the server-sender (generator) process to exit before the upstream peer (running as server-receiver child) finished its exit_cleanup() sequence in noop_io_until_death(). The peer was left waiting for FIN on its stdin while we tore down, producing "connection unexpectedly closed" and a 300s timeout in runtests.py. Upstream cleanup.c:254 calls noop_io_until_death() unconditionally for both am_sender and am_receiver server children; mirror that contract by removing the role gate so the generator path also drains stdin to EOF after shutting down its write half. upstream: io.c:943 noop_io_until_death(), cleanup.c:254 _exit_cleanup() * test(cli): drain_stdin_until_eof unit tests for server-sender shutdown Extract the previously-inlined stdin drain loop into a `Read`-generic helper and add nextest coverage for the four shapes that matter on the lsh.sh / SSH transport: - bare EOF (the steady-state case once the peer's exit_cleanup runs) - payload-then-EOF (peer flushes trailing MSG_STATS / NDX_DONE before FIN) - Interrupted + WouldBlock retries (no spurious exit on transient errors) - hard error (drain breaks cleanly instead of spinning) The helper mirrors upstream rsync's noop_io_until_death() (io.c:943) and is now exercised by both the receiver and the generator roles after the goodbye handshake. Tests document the contract so a future revert of the gate would surface immediately. * fix(cli): only report is_local_sender for remote-dest pushes PR #5794 added ClientConfig::is_local_sender() to thread the itemize direction arrow into OutFormatContext. Its docstring claimed the local-copy and empty-args polarity was "harmless because upstream hits the local_server branch which emits >". That assumption holds for upstream's log.c, but oc-rsync's itemize formatter at frontend/out_format/render/itemize.rs only branches on is_sender. With the helper returning true for local copies the formatter started emitting < where upstream emits >, breaking every local-copy itemize test (itemize_combined_with_dry_run_shows_what_would_transfer, itemize_combined_with_verbose_shows_itemized_format, itemize_last_toggle_wins_enabled) across all platforms. Narrow is_local_sender() to return true only when the destination is remote and every source is local - the exact case upstream's log.c renders as <. Local copies, pulls, empty arg lists, and proxy operations all return false so the formatter emits > to match upstream. upstream: log.c:701-704 * fix(metadata): cover remaining chmod sites under --keep-dirlinks bypass PR #5793 added `chmod_path_honoring_keep_dirlinks` but only routed the chmod-modifier and compute_dest_mode paths through it. The path-based fallbacks in `set_permissions_like`, `apply_permissions_without_chmod` executability branch, and both `apply_permissions_from_entry` branches still called `fast_io::secure_chmod_at` directly, which the dirfd sandbox refuses when the destination's parent is a symlink-to-a-dir. Failing test `apply::tests::keep_dirlinks_bypasses_secure_chmod_sandbox` on every Unix CI cell exercised the `apply_file_metadata_with_options` -> `apply_permissions_without_chmod` -> `set_permissions_like` chain and hit ENOTDIR on `dest/alpha/a.txt` whose parent `alpha` is a symlink. Route all four remaining sites through the helper. Pass `options` into `set_permissions_like` (only 2 callers, both in this file) so the Unix chmod can pick `std::fs::set_permissions` when `keep_dirlinks` is set, mirroring upstream `generator.c:1344 link_stat(fname, &sx.st, keep_dirlinks && is_dir)`.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…ss (#5799) * fix(metadata): cover remaining chmod sites under --keep-dirlinks bypass PR #5793 added `chmod_path_honoring_keep_dirlinks` but only routed the chmod-modifier and compute_dest_mode paths through it. The path-based fallbacks in `set_permissions_like`, `apply_permissions_without_chmod` executability branch, and both `apply_permissions_from_entry` branches still called `fast_io::secure_chmod_at` directly, which the dirfd sandbox refuses when the destination's parent is a symlink-to-a-dir. Failing test `apply::tests::keep_dirlinks_bypasses_secure_chmod_sandbox` on every Unix CI cell exercised the `apply_file_metadata_with_options` -> `apply_permissions_without_chmod` -> `set_permissions_like` chain and hit ENOTDIR on `dest/alpha/a.txt` whose parent `alpha` is a symlink. Route all four remaining sites through the helper. Pass `options` into `set_permissions_like` (only 2 callers, both in this file) so the Unix chmod can pick `std::fs::set_permissions` when `keep_dirlinks` is set, mirroring upstream `generator.c:1344 link_stat(fname, &sx.st, keep_dirlinks && is_dir)`. * fix(cli): only report is_local_sender for remote-dest pushes PR #5794 added ClientConfig::is_local_sender() to thread the itemize direction arrow into OutFormatContext. Its docstring claimed the local-copy and empty-args polarity was "harmless because upstream hits the local_server branch which emits >". That assumption holds for upstream's log.c, but oc-rsync's itemize formatter at frontend/out_format/render/itemize.rs only branches on is_sender. With the helper returning true for local copies the formatter started emitting < where upstream emits >, breaking every local-copy itemize test (itemize_combined_with_dry_run_shows_what_would_transfer, itemize_combined_with_verbose_shows_itemized_format, itemize_last_toggle_wins_enabled) across all platforms. Narrow is_local_sender() to return true only when the destination is remote and every source is local - the exact case upstream's log.c renders as <. Local copies, pulls, empty arg lists, and proxy operations all return false so the formatter emits > to match upstream. upstream: log.c:701-704
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
>f+++++++++where upstream rsync emits<f+++++++++.< if is_sender else >); the bug was that both call sites incrates/cli/src/frontend/execution/drive/summary.rsbuiltOutFormatContextvia::default(), leavingis_sender = false.ClientConfigthrough toOutFormatContextvia a newClientConfig::is_local_sender()accessor and anOutFormatContext::with_is_sender(bool)constructor.Upstream reference
SSH-sender emits
<; everything else emits>.Root cause
crates/cli/src/frontend/execution/drive/summary.rs:116(execute_transfer-> live summary path) and:205(emit_log_output->--log-filepath) constructedOutFormatContext::default()which leavesis_sender = false. The formatter atcrates/cli/src/frontend/out_format/render/itemize.rs:28correctly selected<vs>fromcontext.is_sender, but never saw the true value. Result: every SSH-push transfer emitted the wrong direction arrow.Fix
ClientConfig::is_local_sender()(new): inspectstransfer_argsvia the existingclient::remote::operand_is_remoteclassifier.true(local is sender)false(local is receiver)true(sender by upstream convention; upstreamlog.c:704hits thelocal_serverbranch which emits>regardless, so polarity is harmless)false(no local itemize lines render; value unobservable)execute_transfercaptureslet is_sender = config.is_local_sender();beforeconfigis consumed byrun_client_with_observer.OutFormatContext::with_is_sender(bool)constructor added; both summary.rs call sites use it.EmitLogOutputParamsgains anis_sender: boolfield so the log-file path renders with the same polarity as stdout.Wire protocol
Unaffected. The change touches the user-facing log layer only.
Test plan
crates/core/src/client/config/client/arguments.rscovering push (src host:dst), pull (host:src dst), pure-local, daemon push (host::mod/dst), daemon pull (rsync://host/mod/src), and empty transfer args.<to match upstream.