Skip to content

Serialise RSYNC_PARTIAL_DIR CLI tests with ENV_LOCK - #2152

Merged
oferchen merged 1 commit into
masterfrom
implement-rsync-3.4.1-behavioral-parity
Nov 14, 2025
Merged

oferchen merged 1 commit into
masterfrom
implement-rsync-3.4.1-behavioral-parity

Conversation

@oferchen

@oferchen oferchen commented Nov 14, 2025 •

Copy link
Copy Markdown
Owner

Summary

  • guard the RSYNC_PARTIAL_DIR parsing tests with the shared environment mutex to prevent cross-test races

Testing

  • cargo test --workspace --lib --tests -- --nocapture

[Codex Task](

@oferchen
oferchen merged commit dc41bc1 into master Nov 14, 2025
@oferchen
oferchen deleted the implement-rsync-3.4.1-behavioral-parity branch November 14, 2025 14:42
oferchen added a commit that referenced this pull request May 14, 2026
Darwin ships a BSD-style sendfile(2) syscall, but the dispatch in
crates/fast_io/src/sendfile.rs only branched on Linux and fell
through to a read/write loop on every other unix target. The macOS
fast_io audit at docs/audits/macos-fastio-fallback.md flagged this
as one of two unshipped wins identified during the post-merge
review of PR #4008.

This change adds a target_os = "macos" arm in send_file_to_fd and
send_file_to_fd_with_policy that calls libc::sendfile with the
Darwin signature:

    int sendfile(int fd, int s, off_t offset, off_t *len,
                 struct sf_hdtr *hdtr, int flags);

The implementation handles the in/out `len` parameter (bytes to
send -> bytes actually sent), treats a return of 0 as success, and
preserves the "transfer from the current file position" contract
by querying the source offset with lseek(SEEK_CUR) and advancing
the position with lseek(SEEK_SET) after the transfer. Partial
sends on EAGAIN/EINTR are reported as forward progress so the
socket peer always sees a consistent prefix.

Non-socket destinations (pipes, regular files) fail with
ENOTSOCK; the dispatch transparently falls back to the buffered
read/write loop in that case, matching the behaviour Linux
already had for non-sendfile-capable targets.

Tests gated to target_os = "macos" exercise the new path through
a SOCK_STREAM socketpair (native sendfile fast path), the public
dispatch entry point, and a pipe destination that must fall back
to read/write.

Refs #2152.
oferchen added a commit that referenced this pull request May 18, 2026
Darwin ships a BSD-style sendfile(2) syscall, but the dispatch in
crates/fast_io/src/sendfile.rs only branched on Linux and fell
through to a read/write loop on every other unix target. The macOS
fast_io audit at docs/audits/macos-fastio-fallback.md flagged this
as one of two unshipped wins identified during the post-merge
review of PR #4008.

This change adds a target_os = "macos" arm in send_file_to_fd and
send_file_to_fd_with_policy that calls libc::sendfile with the
Darwin signature:

    int sendfile(int fd, int s, off_t offset, off_t *len,
                 struct sf_hdtr *hdtr, int flags);

The implementation handles the in/out `len` parameter (bytes to
send -> bytes actually sent), treats a return of 0 as success, and
preserves the "transfer from the current file position" contract
by querying the source offset with lseek(SEEK_CUR) and advancing
the position with lseek(SEEK_SET) after the transfer. Partial
sends on EAGAIN/EINTR are reported as forward progress so the
socket peer always sees a consistent prefix.

Non-socket destinations (pipes, regular files) fail with
ENOTSOCK; the dispatch transparently falls back to the buffered
read/write loop in that case, matching the behaviour Linux
already had for non-sendfile-capable targets.

Tests gated to target_os = "macos" exercise the new path through
a SOCK_STREAM socketpair (native sendfile fast path), the public
dispatch entry point, and a pipe destination that must fall back
to read/write.

Refs #2152.
oferchen added a commit that referenced this pull request May 18, 2026
Darwin ships a BSD-style sendfile(2) syscall, but the dispatch in
crates/fast_io/src/sendfile.rs only branched on Linux and fell
through to a read/write loop on every other unix target. The macOS
fast_io audit at docs/audits/macos-fastio-fallback.md flagged this
as one of two unshipped wins identified during the post-merge
review of PR #4008.

This change adds a target_os = "macos" arm in send_file_to_fd and
send_file_to_fd_with_policy that calls libc::sendfile with the
Darwin signature:

    int sendfile(int fd, int s, off_t offset, off_t *len,
                 struct sf_hdtr *hdtr, int flags);

The implementation handles the in/out `len` parameter (bytes to
send -> bytes actually sent), treats a return of 0 as success, and
preserves the "transfer from the current file position" contract
by querying the source offset with lseek(SEEK_CUR) and advancing
the position with lseek(SEEK_SET) after the transfer. Partial
sends on EAGAIN/EINTR are reported as forward progress so the
socket peer always sees a consistent prefix.

Non-socket destinations (pipes, regular files) fail with
ENOTSOCK; the dispatch transparently falls back to the buffered
read/write loop in that case, matching the behaviour Linux
already had for non-sendfile-capable targets.

Tests gated to target_os = "macos" exercise the new path through
a SOCK_STREAM socketpair (native sendfile fast path), the public
dispatch entry point, and a pipe destination that must fall back
to read/write.

Refs #2152.
oferchen added a commit that referenced this pull request Aug 24, 2026
Darwin ships a BSD-style sendfile(2) syscall, but the dispatch in
crates/fast_io/src/sendfile.rs only branched on Linux and fell
through to a read/write loop on every other unix target. The macOS
fast_io audit at docs/audits/macos-fastio-fallback.md flagged this
as one of two unshipped wins identified during the post-merge
review of PR #4008.

This change adds a target_os = "macos" arm in send_file_to_fd and
send_file_to_fd_with_policy that calls libc::sendfile with the
Darwin signature:

    int sendfile(int fd, int s, off_t offset, off_t *len,
                 struct sf_hdtr *hdtr, int flags);

The implementation handles the in/out `len` parameter (bytes to
send -> bytes actually sent), treats a return of 0 as success, and
preserves the "transfer from the current file position" contract
by querying the source offset with lseek(SEEK_CUR) and advancing
the position with lseek(SEEK_SET) after the transfer. Partial
sends on EAGAIN/EINTR are reported as forward progress so the
socket peer always sees a consistent prefix.

Non-socket destinations (pipes, regular files) fail with
ENOTSOCK; the dispatch transparently falls back to the buffered
read/write loop in that case, matching the behaviour Linux
already had for non-sendfile-capable targets.

Tests gated to target_os = "macos" exercise the new path through
a SOCK_STREAM socketpair (native sendfile fast path), the public
dispatch entry point, and a pipe destination that must fall back
to read/write.

Refs #2152.
oferchen added a commit that referenced this pull request Aug 24, 2026
Darwin ships a BSD-style sendfile(2) syscall, but the dispatch in
crates/fast_io/src/sendfile.rs only branched on Linux and fell
through to a read/write loop on every other unix target. The macOS
fast_io audit at docs/audits/macos-fastio-fallback.md flagged this
as one of two unshipped wins identified during the post-merge
review of PR #4008.

This change adds a target_os = "macos" arm in send_file_to_fd and
send_file_to_fd_with_policy that calls libc::sendfile with the
Darwin signature:

    int sendfile(int fd, int s, off_t offset, off_t *len,
                 struct sf_hdtr *hdtr, int flags);

The implementation handles the in/out `len` parameter (bytes to
send -> bytes actually sent), treats a return of 0 as success, and
preserves the "transfer from the current file position" contract
by querying the source offset with lseek(SEEK_CUR) and advancing
the position with lseek(SEEK_SET) after the transfer. Partial
sends on EAGAIN/EINTR are reported as forward progress so the
socket peer always sees a consistent prefix.

Non-socket destinations (pipes, regular files) fail with
ENOTSOCK; the dispatch transparently falls back to the buffered
read/write loop in that case, matching the behaviour Linux
already had for non-sendfile-capable targets.

Tests gated to target_os = "macos" exercise the new path through
a SOCK_STREAM socketpair (native sendfile fast path), the public
dispatch entry point, and a pipe destination that must fall back
to read/write.

Refs #2152.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant