Repository navigation
fix(daemon): exit 4 on a refused option, not 1 - #7563
Merged
Merged
Conversation
A daemon that refuses a client option sent the peer MSG_ERROR_EXIT with RERR_SYNTAX (1). Upstream ends that path in exit_cleanup(RERR_UNSUPPORTED) at clientserver.c:1267, so a client scripting on `rsync -z` (or the default-refused --write-devices / --copy-devices) being rejected saw 1 where upstream reports 4. Measured against the pinned upstream 3.5.0 daemon, same client, push direction: --write-devices upstream 4, oc 1 -> 4 refuse options=compress, -z upstream 4, oc 1 -> 4 refuse options=delete, -r --delete upstream 4, oc 1 -> 4 Upstream has one post-@rsyncd:OK fatal branch (clientserver.c:1254-1268, `if (!ret || err_msg)`), which covers both a refused option and a failed pre-xfer exec and ends in RERR_UNSUPPORTED. The sibling on that branch, handle_client_arg_rejection_post_handshake, already sent 4; the refused- option arm was the straggler, so this makes the branch uniform. The read-only push and write-only pull rejections are a different decision - made later in do_server_recv()/do_server_sender() - and keep RERR_SYNTAX; their tests stay green unchanged. The `@ERROR: ` payload prefix on the refusal text is untouched: the exit code is a separate argument to send_multiplexed_error_and_exit, and the prefix divergence is owned elsewhere.
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.
Problem
A daemon that refuses a client-requested option terminated the peer with
MSG_ERROR_EXITcarryingRERR_SYNTAX(1). Upstream reportsRERR_UNSUPPORTED(4).Upstream
clientserver.c:1254-1268is upstream's single post-@RSYNCD: OKfatalbranch:
!retisparse_arguments()failing, which is where a refused option lands(
options.c:2041-2043->create_refuse_error(opt)->goto cleanup).err_msgis a failedpre-xfer exec. Both arms exit 4.--write-devicesand
--copy-devicesreach that branch because a daemon seeds them into therefuse list unconditionally (
options.c:1057-1059parse_one_refuse_match(0, "write-devices", list_end)).RERR_UNSUPPORTEDis used for many unrelated refusals upstream, so theconstant name alone is not the argument - the citation above is the specific
site, confirmed by measurement below.
Measured, pinned upstream 3.5.0 daemon vs oc daemon, same client
Same upstream 3.5.0 client against each daemon in turn; push direction (a
pull never forwards
--write-devices,options.c:3150gates it onam_sender).--write-devices(push)refuse options = compress,-z(push)refuse options = delete,-r --delete(push)--copy-devices(pull)refuse options = compress,-z(pull)The pull rows are a client-side race inside upstream, not a daemon
divergence: upstream's receiver prints the refusal text (so it read
MSG_ERROR_XFER) and then loses to the RST, exitingRERR_SOCKETIOatio.c(907)before it can honourMSG_ERROR_EXIT. Thedaemon's own code is 4 in both directions. This change does not chase that
race.
Scope
Only the exit code. The
@ERROR:payload prefix (upstream writesrsync: The server is configured to refuse ...) is a separate divergence andis deliberately left alone - it is a different argument to
send_multiplexed_error_and_exit, and the measurement above confirms it isunchanged on both sides of the fix. The absent
rsync error: requested action not supported (code 4) at clientserver.c(1267)summary line is part of that same payload divergence and is likewise untouched.
Class, not a one-off
Three post-OK multiplexed abort sites exist in
module_access/request.rs:handle_refused_option_post_handshakeclientserver.c:1267handle_client_arg_rejection_post_handshakeclientserver.c:1267handle_access_denied_post_handshakemain.c:934/main.c:1167exit_cleanup(RERR_SYNTAX)The first two are the same upstream branch; the refused-option arm was the
straggler and this makes the branch uniform. The read-only/write-only
rejection is a genuinely different decision made later in
do_server_recv()/do_server_sender()and keepsRERR_SYNTAX.Tests
run_daemon_post_ok_refused_option_uses_multiplexed_errorandrun_daemon_refusal_lingers_so_the_peer_can_read_itnow pin theMSG_ERROR_EXITpayload atRERR_UNSUPPORTED_EXIT_CODE. Both fail on thepre-fix source (
left: 1, right: 4) and pass after. The linger test's ownheader already cited
exit_cleanup(RERR_UNSUPPORTED)while asserting 1, sothat assertion was drifting from its own citation.
refuse_emits_msg_error_xfer_post_handshakeuses the constant on both sidesof its comparison, so it is a framing test rather than a policy test; its
fixture is moved to 4 so it keeps modelling the real refusal.
Mutating the fix back reddens exactly those two tests and leaves the
read-only/write-only companions green.