Skip to content

fix(daemon): exit 4 on a refused option, not 1 - #7587

Merged
oferchen merged 1 commit into
masterfrom
fix/daemon-refusal-exit-code
Sep 1, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/daemon-refusal-exit-code

Conversation

@oferchen

@oferchen oferchen commented Sep 1, 2026

Copy link
Copy Markdown
Owner

A daemon that refuses a client option after sending @RSYNCD: OK exits 1
where upstream exits 4 (RERR_UNSUPPORTED).

Upstream

clientserver.c:1254-1268 is a single post-OK fatal branch:

if (!ret || err_msg) {
        if (err_msg) {
                ... rwrite(FERROR, ...) ...
        } else
                option_error();
        msleep(400);
        exit_cleanup(RERR_UNSUPPORTED);
}

It covers both a refused option and a failed pre-xfer exec, and it ends in
exit_cleanup(RERR_UNSUPPORTED) at :1267. That is the code the peer
observes in the MSG_ERROR_EXIT payload.

The discriminator

Not every daemon refusal maps to 4. The sibling read-only / write-only
rejection is a different decision, made later in do_server_recv() /
do_server_sender(), and it keeps RERR_SYNTAX. This change moves only the
post-OK option-refusal branch; the read-only rejection is deliberately
untouched.

Scope

FEATURE_UNAVAILABLE_EXIT_CODE -> RERR_UNSUPPORTED_EXIT_CODE at the
post-OK refusal site, with the two existing daemon integration tests updated
to assert the code the peer actually receives.

Deliberately out of scope

The @ERROR: payload-prefix divergence on the same path belongs to the
IOBUF work, which also owns the missing exit linger. Fixing the prefix at
one site while the other stays divergent would create two behaviours where
there is currently one consistent bug.

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.
@github-actions github-actions Bot added the bug Something isn't working label Sep 1, 2026
@oferchen
oferchen merged commit d32016c into master Sep 1, 2026
144 checks passed
@oferchen
oferchen deleted the fix/daemon-refusal-exit-code branch September 1, 2026 14:35
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant