Repository navigation
fix: make receiver temp, in-place and rename failures per-file errors, as upstream - #8284
Merged
Merged
Conversation
The pipelined receiver skipped a file only when its output failed with PermissionDenied; any other errno (ENOSPC, EROFS, EISDIR, and the ENOENT an --inplace open reports after its no-create retry) aborted the run. Upstream decides by the failed operation: a temp create, in-place open or rename into place is an FERROR_XFER line and the transfer goes on to exit 23 (receiver.c:465-468, receiver.c:1242-1261, rsync.c:918-927), while a failed backup or close is RERR_FILEIO. The split now lives in one classifier keyed on the CommitOp tag each raising site attaches. In-place and device opens are tagged Open and print upstream's "open %s failed" line, and a temp create under a missing parent keeps its Mkstemp tag and real errno. A missing --inplace destination is created 0600 until its final mode is applied (receiver.c:1221-1226).
robust_rename() falls back to copying when the rename crosses devices. Upstream reports a failed copy as "copy %s -> \"%s\"" (rsync.c:919-921, ret == -2) and moves on to the next file. The copy failure is now tagged CommitOp::Copy, which the per-file classifier skips and the receiver renders with the copy verb; an inner stage tag survives the rename tag the caller wraps around it.
oferchen
force-pushed
the
fix/receiver-open-per-file
branch
from
November 3, 2026 07:09
9cd0712 to
bc95ae9
Compare
A local copy that could not create its temp file, open an --inplace destination or rename a file into place aborted after the first file with its own wording, and a missing --inplace target was reported as vanished (exit 24). rsync 3.5.1 prints the receiver line for each file (receiver.c:465-468, receiver.c:1242-1261, rsync.c:918-927) and ends with exit 23. Move the commit-op tag and CommitDisposition classifier into engine so the network receiver and the local engine share one decision and one wording (CommitOp::failure_line). The engine tags its mkstemp, open, rename and copy sites, reports skip-file failures at the per-operand and per-entry sites, and counts NotFound as vanished only when it is untagged. The oc-only Direct write retries a failed create once through the named temp path, so the reported failure is upstream mkstemp one.
A receiver that could not create the --delay-updates / --partial-dir staging directory for a completed file aborted the whole run (exit 23 on a local copy, exit 3 on a push). rsync 3.5.1 prints "Unable to create partial-dir for %s -- discarding completed file.", unlinks the temp and moves on (receiver.c:1318-1325); the line is a plain FERROR, so the exit code is unchanged. Tag the staging-dir create with CommitOp::PartialDir in both receivers and classify it as the new CommitDisposition::Discard: the network receiver sends the line as MSG_ERROR without counting a skipped file, and the local engine reports it and resolves the entry to success.
fix: discard a file whose partial-dir cannot be created, like upstream
fix: skip local-copy temp, open and rename failures per file
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
PermissionDenied. Any other errno aborted the run:ENOSPC,EROFS,ENAMETOOLONG,EISDIR, and theENOENTan--inplaceopen reports. Upstream decides by the operation that failed, never by the errno. A failed temp create (receiver.c:465-468), in-place open (receiver.c:1242-1261) or rename into place (rsync.c:918-927) is anFERROR_XFERline, and the run continues to exit 23. A failed backup or close isRERR_FILEIO. That split now lives in one place,CommitDisposition::of, keyed on theCommitOptag each raising site attaches. Two temp-create paths used to return untagged errors: a missing parent, and an exhausted name space. Both now carry theMkstemptag and keep the real errno.open %s failedwording (task 241). In-place and device opens are taggedCommitOp::Openand print upstream'srsync: [receiver] open "<path>" failed: <errno>. They used to fall through to themkstemplabel.O_WRONLY|O_CREAT, 0600does (receiver.c:1221-1226): the path arm infast_io::inplace_openand the sandbox-anchoredopenatarm. The final mode is still applied afterwards, so a finished--inplacefile ends 0644 under umask 022, matching 3.5.1.Oracle evidence
The oracle is rsync 3.5.1 built from the release tarball (
rsync version 3.5.1 protocol version 33). The distro build gave identical output. The fixture pushes filesathenbthrough a local rsh shim, so the receiver is a real--serverprocess. The destination (or--temp-dir) is 0555. Because it is the operand directory and not a file-list entry, upstream never relaxes it to u+w. Each oc line below is byte-identical to 3.5.1's after masking the temp suffix. The upstream trailer comes frommain.cand oc's fromerror.rs, as on every run.mkstemp "W/dst/.a.XXXXXX" failed: Permission denied (13), exit 23--temp-dir0555)mkstemp "W/tmp/a.XXXXXX" failed: Permission denied (13), exit 23--inplace(dst 0555)open "W/dst/a" failed: No such file or directory (2), exit 23server error: No such file or directory (os error 2), exit 3, b never tried--temp-dir, dst 0555)rename "W/tmp/a.XXXXXX" -> "a": Permission denied (13), exit 23--inplacenew file, final modeThe
--inplacecell is the live defect. TheEACCEScreate is retried withoutO_CREAT(upstream's#ifdef linuxarm), and the error that is reported is that arm'sENOENT. oc treated that errno as fatal.Tests
tests/receiver_open_failures_exit_23.rs: one e2e cell per arm. Each asserts the exact per-file lines in file-list order, exit 23, and that nothing lands. The in-place cell is Linux-only, because its errno comes from the Linux-only retry arm. Every cell skips when run as root.pipeline::receiverunit tests:commit_disposition_is_decided_by_the_operation_not_the_errno: Mkstemp, Open and Rename x {EACCES, ENOSPC, EROFS, ENAMETOOLONG, EISDIR, ENOENT} skip the file; Backup and Close abort; untagged errors propagate.an_inplace_open_failure_skips_the_file_with_the_open_wording: the failing file is skipped with the upstream line and the next file lands.temp_guard:a_missing_temp_parent_is_a_tagged_mkstemp_failure.fast_io:the_first_arm_creates_an_absent_target_owner_only,inplace_create_beneath_the_sandbox_is_owner_only.transfer+fast_ionextest run passes: 4601 passed, 3 skipped.Mutations, one per arm
commit_disposition...;an_inplace_open_failure...mkstempan_inplace_open_failure...the_first_arm_creates_an_absent_target_owner_onlyinplace_create_beneath_the_sandbox_is_owner_onlya_missing_temp_parent_is_a_tagged_mkstemp_failureNot changed (stated, not hidden)
oc-rsync src/a src/b dst/with dst 0555:failed to copy file 'W/dst/a': Permission denied (13) (code 23).--inplace: oc reportsfile has vanished: "W/dst/a" (code 24).--partial-dir/--delay-updatesstaging-dir create (clear_partial_dir_obstruction,create_dir_all_sandboxed) is still untagged, so it stays fatal. Upstream printsUnable to create partial-dir for %s -- discardingand continues (receiver.c:1316-1321).Task 274: done
robust_rename()is now taggedCommitOp::Copy. The receiver reports it as upstream'scopy %s -> "%s"(rsync.c:919-921,ret == -2), skips the file and exits 23.a_failed_exdev_copy_is_tagged_as_a_copy_of_the_temp_onto_the_destinationforces a failed copy with an injectedEXDEVrename and a missing target directory.a_failed_copy_fallback_is_reported_as_copypins the classifier, the wording and the inner-tag rule.copyverb rendered asrename.Conventional commit prefix
fix:Pre-merge checklist
cargo fmt --allrun locally.CHANGELOG.mdupdated (two Fixed entries,#8284placeholders).Folded in
This PR now also carries #8285 (local-copy per-file open failures) and #8290 (partial-dir create discard), merged into this branch so the stack lands in one CI run.