Repository navigation
fix(receiver): abort with 11 when a commit-path backup fails - #7582
Merged
Merged
Conversation
Upstream treats an unplaceable backup as fatal, not as a per-file skip: finish_transfer() answers `!make_backup(fname, False)` with `exit_cleanup(RERR_FILEIO)` (rsync.c:897-900), and `_exit_cleanup()` is NORETURN (cleanup.c:103). The errno never enters that decision - EACCES is as fatal as anything else - and the code is 11 rather than 23 because cleanup.c:113-117 keeps the first code handed to exit_cleanup() while the RERR_PARTIAL fallback at cleanup.c:210-218 is guarded on `exit_code == 0`. oc classified every permission-denied commit failure as recoverable, so a failed backup was reported and the receiver moved to the next file, ending the run at 23. Measured over a 20-file batch with an unwritable --backup-dir: upstream rsync 3.5.0 reports one failure and exits 11; oc reported all twenty and exited 23. Continuing is the half that matters - the receiver keeps walking a batch whose backup area is known to be unusable, so every later -b file rides on a backup that cannot be placed. The two drain sites in the pipelined receiver were byte-identical copies of that decision; they now share one `absorb_commit_error` that splits on the operation rather than the errno, keeping the per-file `mkstemp` failure (receiver.c:452-455) recoverable as before. The commit-op tag already carried by the error also selects RERR_FILEIO in the exit-code mapper, so the usual EACCES no longer grades as FileSelect. A fatal drain now flushes the diagnostic it queued before returning, mirroring the io_flush() upstream reaches on its way out (cleanup.c:242-253); a bare `?` dropped the line that says why the run stopped. The remote-server (push) direction stops at the first file as it should but still reports 12: the server's fatal exit is not carried back to the client, which is a separate gap in server exit propagation.
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.
What
A commit-path backup that cannot be placed is fatal upstream. oc treated it as a per-file skip.
Upstream
finish_transfer(),rsync.c:897-900:cleanup.c:103-_exit_cleanup()isNORETURN, so this is an abort. The errno never enters the decision.cleanup.c:113-117- the first code handed toexit_cleanup()wins.cleanup.c:210-218- theRERR_PARTIALfallback is guarded onexit_code == 0, so 11 outranks the 23 an accumulatedgot_xfer_errorwould otherwise produce.receiver.c:452-455- the contrasting per-file failure: a deniedmkstemp()is reported andrecv_files()moves on. oc already matched this one and still does.Measured
20-file batch, existing backdated destinations,
--backup-dirwhose leafmkdiris denied (mode 555 parent).The exit code is the visible half; the abort is the one with consequences. Skipping and continuing keeps the receiver walking a batch whose backup area is already known to be unusable, so every later
-bfile proceeds on a backup that cannot be placed.Change
drain_ready_resultsanddrain_all_resultsheld byte-identical copies of the continue-vs-abort decision. They now share oneabsorb_commit_error, which splits on the operation (the commit-op tag the error already carries) rather than on the errno.The same tag selects
RERR_FILEIOinExitCode::from_io_error, so the usualEACCESno longer falls through thePermissionDenied => FileSelectarm and reports 3.A fatal drain now flushes what it queued for the peer before returning. A bare
?returned ahead ofemit_peer_messages, dropping thekeep_backup failed: <path>line that says why the run stopped; upstream loses nothing there because_exit_cleanup()reachesio_flush(MSG_FLUSH)on its way out (cleanup.c:242-253).Test
tests/commit_backup_failure_is_fatal.rsasserts both halves in one cell - the exit code and that the last file of the batch was never reached - plus a non-vacuity twin that transfers the whole batch through a writable--backup-dir.Non-vacuity by mutation, each half reverted in turn:
fatal_backup = false): "the transfer must stop at the first unplaceable backup, but it reached f19, the last file of the batch (20 of 20 files reported)" - exactly the pre-fix behaviour.left: Some(3),right: Some(11), while the abort still happens.The cell is a pull through a real
--serverprocess, so the local side is the receiver and the path under test is the network receiver's, not the engine's local-copy executor.Known residuals, deliberately not in scope
--serverprocess, whose fatal exit is not carried back:crates/cli/src/frontend/server/run.rsreturns a flat1for every server error and noMSG_ERROR_EXITis emitted anywhere, so the client grades the run by the truncated stream it observes. Fixing that is server-side exit propagation, not backup handling.LocalCopyError::exit_code()maps everyIokind to 23 generically - a separate change with a much wider surface.Verification
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features --no-deps -- -D warningscargo nextest run -p transfer --all-features- 2775 passedcargo nextest run -p core --all-features- 2835 passedcargo nextest run -p bin --all-features- 517 passedcargo nextest run -p engine -p cli -p daemon --all-features- 10813 passedtools/ci/citation_drift_audit.py- exit 0tools/no_placeholders.sh- exit 0