Repository navigation
fix(metadata): cover remaining chmod sites under --keep-dirlinks bypass - #5799
Merged
Merged
Conversation
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)`.
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
#5803) Add a cross-platform regression test asserting that apply_file_metadata_with_options succeeds through a symlinked destination directory under --keep-dirlinks on Linux, macOS, and Windows. Pins the guarantee from PR #5793 (macOS chmod bypass) and PRs #5798/#5799 (extension to four more chmod sites), and codifies that Linux (openat2 RESOLVE_BENEATH sandboxes parents only) and Windows (chmod no-op) are clean by construction.
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
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
#5803) Add a cross-platform regression test asserting that apply_file_metadata_with_options succeeds through a symlinked destination directory under --keep-dirlinks on Linux, macOS, and Windows. Pins the guarantee from PR #5793 (macOS chmod bypass) and PRs #5798/#5799 (extension to four more chmod sites), and codifies that Linux (openat2 RESOLVE_BENEATH sandboxes parents only) and Windows (chmod no-op) are clean by construction.
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
chmod_path_honoring_keep_dirlinksbut only routed the chmod-modifier andcompute_dest_modepaths through it. Four other chmod sites (set_permissions_likebody,apply_permissions_without_chmodexecutability branch, and bothapply_permissions_from_entrybranches) still calledfast_io::secure_chmod_atdirectly.Test plan