Ensure compression level zero uses parsed state#1867
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| }; | ||
|
|
||
| let mut compression_setting = CompressionSetting::default(); | ||
| if let Some(value) = inputs.compress_level { | ||
| match parse_compress_level_argument(value.as_os_str()) { | ||
| Ok(setting) => { | ||
| compression_setting = setting; | ||
| compress = !setting.is_disabled(); | ||
| let compression_setting = match compress_level_setting { | ||
| Some(CompressLevelArg::Disable) => CompressionSetting::disabled(), | ||
| Some(CompressLevelArg::Level(level)) => { | ||
| CompressionSetting::level(CompressionLevel::precise(level)) |
There was a problem hiding this comment.
Avoid moving
compress_level_setting before later use
The new logic computes compress_disabled via matches!(compress_level_setting, Some(CompressLevelArg::Disable)) and then immediately uses compress_level_setting again when building compress_level_cli and compression_setting. CompressLevelArg is not Copy, so this matches! call moves the Option and subsequent references produce a compile‑time use of moved value error. The commit as written will not build. Evaluate the predicate by reference (e.g. matches!(&compress_level_setting, …)) or otherwise avoid consuming the value before reusing it.
Useful? React with 👍 / 👎.
Documents the actual Windows feature state so users have realistic expectations: ACLs (-A), xattrs (-X), symlinks, devices, and ownership are stubbed on Windows, while permissions degrade to the read-only flag and IOCP is implemented in fast_io but not yet wired into the transfer pipeline. References tasks #1866 (Windows ACLs), #1867 (Windows xattrs), and #1868 (IOCP wiring).
Documents the actual Windows feature state so users have realistic expectations: ACLs (-A), xattrs (-X), symlinks, devices, and ownership are stubbed on Windows, while permissions degrade to the read-only flag and IOCP is implemented in fast_io but not yet wired into the transfer pipeline. References tasks #1866 (Windows ACLs), #1867 (Windows xattrs), and #1868 (IOCP wiring).
…ams (#1867) Add a Windows backend for the cross-platform xattr layer that maps each named extended attribute onto an NTFS Alternate Data Stream using the `path:streamname:$DATA` syntax. The four POSIX primitives are now backed by `FindFirstStreamW`/`FindNextStreamW` for listing, `CreateFileW` + `ReadFile`/`WriteFile` for read and write, and `DeleteFileW` for removal. Stream-name parsing strips the `:` prefix and `:$DATA` suffix returned by NTFS so the wire-format names match the Unix xattr names exposed by the existing `xattr` crate backend. Refactor the per-attribute primitives in `crates/metadata/src/xattr.rs` to take raw `&[u8]` names and dispatch to a platform backend module (`xattr_unix` or `xattr_windows`). The Unix backend continues to wrap the `xattr` crate; the new Windows backend lives in a separate file under the same `feature = "xattr"` gate so the cross-platform layer remains backend-agnostic. The public API (`read_xattrs_for_wire`, `sync_xattrs`, `apply_xattrs_from_list`) is unchanged and the upstream rsync namespace-filtering policy still applies on Linux. Unsafe FFI is contained in `xattr_windows.rs` with `#![allow(unsafe_code)]` matching the existing convention for platform wrappers in the metadata crate (alongside `acl_windows`, `ownership`, `id_lookup`). Resource management uses RAII wrappers around `FindClose` and `CloseHandle` so handles are released on every error path. Tests cover the stream-name parser, input validation in `stream_path_wide`, and a write/read/list/remove round-trip that gracefully skips when the test volume does not support ADS (e.g. FAT32 runners). Refs #1867
…ams (#1867) Add a Windows backend for the cross-platform xattr layer that maps each named extended attribute onto an NTFS Alternate Data Stream using the `path:streamname:$DATA` syntax. The four POSIX primitives are now backed by `FindFirstStreamW`/`FindNextStreamW` for listing, `CreateFileW` + `ReadFile`/`WriteFile` for read and write, and `DeleteFileW` for removal. Stream-name parsing strips the `:` prefix and `:$DATA` suffix returned by NTFS so the wire-format names match the Unix xattr names exposed by the existing `xattr` crate backend. Refactor the per-attribute primitives in `crates/metadata/src/xattr.rs` to take raw `&[u8]` names and dispatch to a platform backend module (`xattr_unix` or `xattr_windows`). The Unix backend continues to wrap the `xattr` crate; the new Windows backend lives in a separate file under the same `feature = "xattr"` gate so the cross-platform layer remains backend-agnostic. The public API (`read_xattrs_for_wire`, `sync_xattrs`, `apply_xattrs_from_list`) is unchanged and the upstream rsync namespace-filtering policy still applies on Linux. Unsafe FFI is contained in `xattr_windows.rs` with `#![allow(unsafe_code)]` matching the existing convention for platform wrappers in the metadata crate (alongside `acl_windows`, `ownership`, `id_lookup`). Resource management uses RAII wrappers around `FindClose` and `CloseHandle` so handles are released on every error path. Tests cover the stream-name parser, input validation in `stream_path_wide`, and a write/read/list/remove round-trip that gracefully skips when the test volume does not support ADS (e.g. FAT32 runners). Refs #1867
…ams (#1867) Add a Windows backend for the cross-platform xattr layer that maps each named extended attribute onto an NTFS Alternate Data Stream using the `path:streamname:$DATA` syntax. The four POSIX primitives are now backed by `FindFirstStreamW`/`FindNextStreamW` for listing, `CreateFileW` + `ReadFile`/`WriteFile` for read and write, and `DeleteFileW` for removal. Stream-name parsing strips the `:` prefix and `:$DATA` suffix returned by NTFS so the wire-format names match the Unix xattr names exposed by the existing `xattr` crate backend. Refactor the per-attribute primitives in `crates/metadata/src/xattr.rs` to take raw `&[u8]` names and dispatch to a platform backend module (`xattr_unix` or `xattr_windows`). The Unix backend continues to wrap the `xattr` crate; the new Windows backend lives in a separate file under the same `feature = "xattr"` gate so the cross-platform layer remains backend-agnostic. The public API (`read_xattrs_for_wire`, `sync_xattrs`, `apply_xattrs_from_list`) is unchanged and the upstream rsync namespace-filtering policy still applies on Linux. Unsafe FFI is contained in `xattr_windows.rs` with `#![allow(unsafe_code)]` matching the existing convention for platform wrappers in the metadata crate (alongside `acl_windows`, `ownership`, `id_lookup`). Resource management uses RAII wrappers around `FindClose` and `CloseHandle` so handles are released on every error path. Tests cover the stream-name parser, input validation in `stream_path_wide`, and a write/read/list/remove round-trip that gracefully skips when the test volume does not support ADS (e.g. FAT32 runners). Refs #1867
…ams (#1867) (#3536) * feat(metadata): implement Windows xattrs via NTFS Alternate Data Streams (#1867) Add a Windows backend for the cross-platform xattr layer that maps each named extended attribute onto an NTFS Alternate Data Stream using the `path:streamname:$DATA` syntax. The four POSIX primitives are now backed by `FindFirstStreamW`/`FindNextStreamW` for listing, `CreateFileW` + `ReadFile`/`WriteFile` for read and write, and `DeleteFileW` for removal. Stream-name parsing strips the `:` prefix and `:$DATA` suffix returned by NTFS so the wire-format names match the Unix xattr names exposed by the existing `xattr` crate backend. Refactor the per-attribute primitives in `crates/metadata/src/xattr.rs` to take raw `&[u8]` names and dispatch to a platform backend module (`xattr_unix` or `xattr_windows`). The Unix backend continues to wrap the `xattr` crate; the new Windows backend lives in a separate file under the same `feature = "xattr"` gate so the cross-platform layer remains backend-agnostic. The public API (`read_xattrs_for_wire`, `sync_xattrs`, `apply_xattrs_from_list`) is unchanged and the upstream rsync namespace-filtering policy still applies on Linux. Unsafe FFI is contained in `xattr_windows.rs` with `#![allow(unsafe_code)]` matching the existing convention for platform wrappers in the metadata crate (alongside `acl_windows`, `ownership`, `id_lookup`). Resource management uses RAII wrappers around `FindClose` and `CloseHandle` so handles are released on every error path. Tests cover the stream-name parser, input validation in `stream_path_wide`, and a write/read/list/remove round-trip that gracefully skips when the test volume does not support ADS (e.g. FAT32 runners). Refs #1867 * style(metadata): cargo fmt * fix(metadata): make ADS xattr impl cross-compile for windows-gnu The Windows ADS xattr backend used `windows::Win32::Storage::FileSystem::{ ReadFile, WriteFile}`, which are gated behind the `Win32_System_IO` feature in `windows = "0.62"`. Cross-compiling to `x86_64-pc-windows-gnu` therefore failed with `no `ReadFile` / `WriteFile` in `Win32::Storage::FileSystem``. `FindFirstStreamW`'s `dwflags` argument also takes `Option<u32>`, but the call site passed a bare `0`. Replace the raw `ReadFile`/`WriteFile` calls with `std::fs::File` constructed from the Win32 `HANDLE` via `FromRawHandle`, so the read and write paths use stdlib I/O instead of FFI bindings that depend on an additional `windows` crate feature. The `File` takes ownership of the handle and closes it on drop, replacing the now-unused `OwnedHandle` wrapper. Wrap the reserved-must-be-zero `dwflags` argument in `Some(0)` to match the binding signature. No new Cargo features and no changes outside `crates/metadata/`. * style(metadata): cargo fmt xattr_windows imports
Documents the actual Windows feature state so users have realistic expectations: ACLs (-A), xattrs (-X), symlinks, devices, and ownership are stubbed on Windows, while permissions degrade to the read-only flag and IOCP is implemented in fast_io but not yet wired into the transfer pipeline. References tasks #1866 (Windows ACLs), #1867 (Windows xattrs), and #1868 (IOCP wiring).
…ams (#1867) (#3536) * feat(metadata): implement Windows xattrs via NTFS Alternate Data Streams (#1867) Add a Windows backend for the cross-platform xattr layer that maps each named extended attribute onto an NTFS Alternate Data Stream using the `path:streamname:$DATA` syntax. The four POSIX primitives are now backed by `FindFirstStreamW`/`FindNextStreamW` for listing, `CreateFileW` + `ReadFile`/`WriteFile` for read and write, and `DeleteFileW` for removal. Stream-name parsing strips the `:` prefix and `:$DATA` suffix returned by NTFS so the wire-format names match the Unix xattr names exposed by the existing `xattr` crate backend. Refactor the per-attribute primitives in `crates/metadata/src/xattr.rs` to take raw `&[u8]` names and dispatch to a platform backend module (`xattr_unix` or `xattr_windows`). The Unix backend continues to wrap the `xattr` crate; the new Windows backend lives in a separate file under the same `feature = "xattr"` gate so the cross-platform layer remains backend-agnostic. The public API (`read_xattrs_for_wire`, `sync_xattrs`, `apply_xattrs_from_list`) is unchanged and the upstream rsync namespace-filtering policy still applies on Linux. Unsafe FFI is contained in `xattr_windows.rs` with `#![allow(unsafe_code)]` matching the existing convention for platform wrappers in the metadata crate (alongside `acl_windows`, `ownership`, `id_lookup`). Resource management uses RAII wrappers around `FindClose` and `CloseHandle` so handles are released on every error path. Tests cover the stream-name parser, input validation in `stream_path_wide`, and a write/read/list/remove round-trip that gracefully skips when the test volume does not support ADS (e.g. FAT32 runners). Refs #1867 * style(metadata): cargo fmt * fix(metadata): make ADS xattr impl cross-compile for windows-gnu The Windows ADS xattr backend used `windows::Win32::Storage::FileSystem::{ ReadFile, WriteFile}`, which are gated behind the `Win32_System_IO` feature in `windows = "0.62"`. Cross-compiling to `x86_64-pc-windows-gnu` therefore failed with `no `ReadFile` / `WriteFile` in `Win32::Storage::FileSystem``. `FindFirstStreamW`'s `dwflags` argument also takes `Option<u32>`, but the call site passed a bare `0`. Replace the raw `ReadFile`/`WriteFile` calls with `std::fs::File` constructed from the Win32 `HANDLE` via `FromRawHandle`, so the read and write paths use stdlib I/O instead of FFI bindings that depend on an additional `windows` crate feature. The `File` takes ownership of the handle and closes it on drop, replacing the now-unused `OwnedHandle` wrapper. Wrap the reserved-must-be-zero `dwflags` argument in `Some(0)` to match the binding signature. No new Cargo features and no changes outside `crates/metadata/`. * style(metadata): cargo fmt xattr_windows imports
Summary
--compress-levelvalue when constructing derived settingsTesting
https://chatgpt.com/codex/tasks/task_e_6905e7874550832394da1cbd3e0dd0b9