Repository navigation
fix: report a failed source unlink at FERROR_XFER - #7576
Merged
Merged
Conversation
Upstream's `successful_send()` sets no `io_error` bit at all. Every failing arm - the refused parent, the re-stat, the changed-file guard, the unlink - ends at `rsyserr(FERROR_XFER, ...)` / `rprintf(FERROR_XFER, ...)` (sender.c:442-451,455-459), and it is that LOG CODE, not a bit, that decides the exit status: `rwrite()` sets `got_xfer_error = 1` on FERROR_XFER (log.c:337-338) and, on a server, forwards the same text to the client as MSG_ERROR_XFER (log.c:357-367), which sets `got_xfer_error` over there too. `exit_cleanup()` then lifts a zero exit to RERR_PARTIAL (23) at both ends. The network sender wrote the failure to its own stderr and handed back only IOERR_GENERAL. A daemon sender therefore reported a failed `--remove-source-files` unlink to the daemon log and nowhere else: the pulling client saw neither the message nor an error, for a destructive-intent option that had silently not done its job. Route the four failure arms through the shared `emit_sender_diagnostic` drain that `record_open_failure` and `record_read_errors` already use, which is the single place `got_xfer_error` is set and the MSG_ERROR_XFER frame is framed. `remove_confirmed_source` now returns the diagnostic alongside the bits instead of printing it, so the caller - not the filesystem helper - decides where it goes. Because the text now travels to the peer, it names the file-list entry rather than the reconstructed server path, matching upstream's `f_name(file, fname)` after `change_pathname()` (sender.c:412-414); a daemon module no longer has an absolute-path prefix to leak. This is the routing half. On a daemon pull the client still exits 0, because the drain runs after the goodbye exchange and the frame is written when the client has stopped reading. Closing that gap means deciding when the sender drains its confirmations relative to the goodbye - moving it earlier would drop confirmations that arrive during the handshake - which is a separate, still-open question.
oferchen
added a commit
that referenced
this pull request
Sep 2, 2026
`## [Unreleased]` last covered the #7304-#7522 era. Measured against the 60 most recently merged pull requests, 44 were absent; of the most recent 45, 43 were absent. Nothing from #7574 onward was recorded at all. Each entry is derived from what the pull request actually landed - the merge commit and the body - not from its title. Three cases where those differ: * #7616 ships far more than the doc-alias correction its body describes: the `upstream_version` pin moves to 3.5.0 and `--version` starts naming `quic`, `sd-notify`, `vmsplice` and `send_zc`. * #7618 also adds the pull-request rustdoc-link job its body says was filed separately, which is what closes the master-only-gate recurrence. * #7602's squash carries the closed #7597 as its first commit, so the directory-obstacle half is recorded under #7602. #7587 is deliberately not recorded. Its merge commit is empty: the change had already landed as #7563, which the section already names. Entries extend the existing Keep a Changelog groups and the bold sub-groupings. Clusters that are one story carry one entry with several references: the FERROR_XFER routing and its two-phase drain (#7576, #7581), the connection-FSM close edge and the accept loop that outlives a session error (#7579, #7590), the three detaching daemon suites (#7578, #7588, #7592), the io_uring and SEND_ZC work (#7593, #7600, #7610), the citation retargets (#7601, #7603, #7604), and the accept-loop pin flake (#7615, #7620). Only `## [Unreleased]` is touched; every released section, including the 3.4.4 statements that were correct when written, is byte-identical.
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 upstream actually does
Verified against
rsync-3.5.0(the version the citation gate pins,tools/ci/citation_drift_audit.py:40 VER = "3.5.0").successful_send()sets noio_errorbit at all. Every failing arm ends atFERROR_XFER:sender.c:421-425,455-459secure-open-parentrefusalsender.c:429-430,455-459sender.c:442-451rprintf(FERROR_XFER, ...)at 447)sender.c:453-459rsyserr(FERROR_XFER, ...)at 459)It is the log code, not a bit, that carries the exit status:
log.c:337-338-case FERROR_XFER: got_xfer_error = 1;log.c:357-367-if (am_server ...) send_msg(msg, ...)forwards the sametext as
MSG_ERROR_XFER; the client'sio.c:1830re-entersrwrite(), whichsets
got_xfer_erroron the client toocleanup.c:210-218-if (exit_code == 0) { ... if (io_error & IOERR_GENERAL || got_xfer_error) exit_code = RERR_PARTIAL; }(23), andmain.c:1683if (got_xfer_error) _exit(RERR_PARTIAL);Precedence: only when
exit_code == 0; within that,RERR_PARTIALis assignedlast, so it wins over
RERR_VANISHED(24) andRERR_DEL_LIMIT(25).The bug
oc's network sender wrote the failure with
eprintln!and handed back onlyIOERR_GENERAL. Measured,--remove-source-fileswith an unlinkable source(parent
chmod 555, EACCES - not the seccomp EPERM path, the daemon logconfirms
seccomp BPF unavailable in this build):-ewrapper (client is sender)-ewrapper (server child's exit status reaches the client)The diagnostic went to the daemon log and nowhere else. A destructive-intent
option reported success while having silently not removed anything.
What this PR changes
remove_confirmed_sourceno longer prints; it returns aSourceRemovalOutcomecarrying the bits and upstream's
FERROR_XFERtext. The caller routes thattext through
emit_sender_diagnostic, the shared drainrecord_open_failureand
record_read_errorsalready use - the single placegot_xfer_erroris setand the
MSG_ERROR_XFERframe is framed. No sixth special case.Because the text now travels to the peer it names the file-list entry, not the
reconstructed server path, matching
f_name(file, fname)afterchange_pathname()(sender.c:412-414). A daemon module has no absolute-pathprefix to leak; the message is now
sender failed to remove sub/f.txt: Permission denied (13).Scope: this is the routing half
On a daemon pull the client still exits 0 after this PR. The drain
(
for wire_ndx in reader.take_success_indices()) runs afterhandle_goodbye_with_finalizer, so the frame is written when the client hasalready stopped reading. Measured by moving the drain ahead of the goodbye as a
throwaway probe: the client then prints the diagnostic and exits 23. The routing
is correct; the write window is not.
Moving the drain is not a free change - the drain sits after the goodbye
precisely because
MSG_SUCCESSframes keep arriving through the handshake, soan earlier drain would silently stop removing sources confirmed during it. That
trade-off (observability of failures vs. completeness of removals) is a separate,
still-open question and is deliberately not settled here.
Tests
remove_source_files_failure_yields_ferror_xfer_text(new) - a real EACCESunlink failure must hand back upstream's
FERROR_XFERtext, must name thefile-list entry, and must not contain the sender's path prefix. The doc
comment states why an
io_errorbit is not a substitute.sender_remove_confinement_testsnow also assert the diagnostic ishanded back (or, for the benign
ENOENTarm, that it is not).Non-vacuity, proved by restoring the pre-fix routing (
eprintln!+error_xfer: None) while keeping the type:Restored:
11 tests run: 11 passed.Gates:
cargo fmt --all -- --checkclean;cargo clippy --workspace --all-targets --all-features --no-deps -- -D warningsclean;cargo nextest run -p transfer --all-features2776 passed; the root-leveldaemon_sender_removes_sources_for_both_spellingspasses; the three topologiesthat already exited 23 still do.