Skip to content

fix: refuse --checksum with a none file checksum, exit 4 like 3.5.1 - #8262

Merged
oferchen merged 4 commits into
masterfrom
fix/checksum-choice-none
Oct 29, 2026
Merged

oferchen merged 4 commits into
masterfrom
fix/checksum-choice-none

Conversation

@oferchen

@oferchen oferchen commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

-c --checksum-choice=none now fails the way 3.5.1 does: exit 4 with Invalid checksum-choice for --checksum: none (0). Upstream's file_checksum() has no CSUM_NONE arm, so it lands in the default case and exits RERR_UNSUPPORTED (checksum.c:548-551). oc mapped none to MD4, transferred, and exited 0.

  • The file checksum is the second comma component when there is one (checksum.c:192-205). So md5,none and auto,none are refused, while none,md5 and --checksum-choice=none without -c still transfer.
  • The refusal happens where upstream's does: at the first regular file the sender opens and would checksum (flist.c:1815-1816, checksum.c:426-430). A source with no readable regular file is copied.
  • Network senders refuse in the generator's flist checksum: the rsh server, the daemon, and a push client. The new ServerConfig::file_checksum_choice field carries the whole-file sum, parsed from the spec's second comma component.
  • A local copy has no flist pass, so it scans its sources for a regular file that opens, but only when -c is combined with a none file sum.
  • The rsh server now splits a --checksum-choice spec like upstream does, so md5,none and auto,md5 are accepted instead of rejected as unknown names.

Measured against 3.5.1

Cell 3.5.1 oc before oc after
local -ac --cc=none 4 + message 0, transferred 4 + message
local -ac --cc=md5,none 4 0 4
local -ac --cc=none,md5 0 0 0
local -a --cc=none (no -c) 0 0 0
pull, 3.5.1 client / 3.5.1 server 12 - -
pull, oc client / 3.5.1 server 12 not measured 12
pull, 3.5.1 client / oc server 12 not measured 12

Known differences, not changed here

  • Message layout. Upstream prints the message and the rsync error: ... (code 4) trailer as two lines; oc prints one combined line, as its other option refusals do (task Add negotiation prologue display helpers #213).
  • 3.5.1 client pulling from an oc server. The client exits 4 where a 3.5.1 server makes it exit 12. A 3.5.1 sender never flushes the MSG_ERROR_EXIT it queues (cleanup.c:250-254, io.c:1073-1075), so its client sees the connection close. The oc server's message also does not reach that client's stderr. Both are error-exit residuals (Handle undecided negotiation prologues gracefully #482).
  • Local copy scan. It does not apply filters, so a source whose only regular files are excluded is refused here and copied by 3.5.1.

Test plan

  • tests/checksum_choice_none_refused.rs, with oracle cells against a real 3.5.1 that self-skip when it isn't installed:
    • the local matrix;
    • a source without regular files exits 0;
    • a push refuses in the local sender with 3.5.1's exit code and text;
    • pulls, run as md5,none so only the file-sum refusal can stop them;
    • a 3.5.1 client pulling from an oc daemon matches a 3.5.1 daemon.
  • Unit tests for validate_file_checksum and the local source scan.
  • Mutations, each failing a cell:
    • the generator refusal;
    • the walk's fatal arm;
    • the local scan (forced true, and bypassed);
    • the daemon, rsh-server and push wiring.
  • cargo clippy --workspace --all-targets --all-features -D warnings, plus no-default clippy for core/transfer/protocol/daemon; cargo fmt --all -- --check
  • cargo nextest run -p core -p cli -p transfer -p daemon -p protocol -p bin --all-features: 19300 passed, 128 skipped
  • CI

Conventional commit prefix

  • fix:

Pre-merge checklist

  • Conventional commit prefix on PR title matches the change category.
  • No references to internal tooling or non-human authoring aids; hyphens, not em-dashes.

Upstream's file_checksum() has no CSUM_NONE arm. When --checksum asks
it for a "none" file checksum, it falls to the default case, prints
"Invalid checksum-choice for --checksum: none (0)" and exits
RERR_UNSUPPORTED (checksum.c:548-551). The file checksum is the second
comma component when one is given, so md5,none is refused and none,md5
is not. oc instead mapped none to MD4 and transferred with exit 0.

Only the sender computes file checksums, so the refusal sits where oc
is the sender. That is the client for a local copy or a push, and the
--server sender for a pull. A pulling client leaves the refusal to the
remote sender, like upstream. Every client/server pairing then exits
with the code a 3.5.1 client gets from a 3.5.1 server.

The new oracle test runs each cell against a real 3.5.1 when one is
installed. Mutations that drop the client check, drop the server check,
or apply the client check to pulls each fail it.
@github-actions github-actions Bot added the bug Something isn't working label Oct 28, 2026
The first cut refused `-c --checksum-choice=none` before the walk, so a
source with no regular file exited 4 where 3.5.1 exits 0. It also left
an oc daemon sender accepting the combination.

Upstream refuses inside file_checksum(). The sender's make_file() calls
it for every regular file under --checksum (flist.c:1815-1816). It
opens the file first: one that cannot be opened gets a zero sum
(checksum.c:426-430). Only then does it reach the default case that
refuses `none` (checksum.c:548-551).

The refusal now sits at that point on each kind of oc sender:

- Network senders, which cover the rsh server, the daemon and a push
  client. ServerConfig carries the whole-file checksum as
  file_checksum_choice. ChecksumAlgorithm::parse_file_choice reads it
  as the part after the first comma, or the whole spec when there is
  none. compute_flist_checksum refuses once the file has opened, and
  the walk ends the run on that error (Unsupported, exit 4) instead of
  skipping the entry.
- The rsh server's spec is split the same way, so `md5,none` and
  `auto,md5` are no longer rejected as unknown names.
- A local copy has no file-list pass. It scans the sources for a
  regular file that opens, with the same descent as the sender, and
  only when the configuration is the refused one.

New oracle cells against 3.5.1:
- a source without regular files is copied (exit 0);
- a 3.5.1 client pulling from an oc daemon ends as it does from a 3.5.1
  daemon;
- a push refuses in the local sender with 3.5.1's exit and text;
- the pull runs as `md5,none`, so only the file-sum refusal can stop
  it. An oc client must show the oc server's refusal.

Each of these mutations fails a cell:
- the generator refusal;
- the walk's fatal arm;
- the local scan, forced true or bypassed;
- the daemon, server and push wiring.

A 3.5.1 client pulling from an oc server still exits 4 where 3.5.1
exits 12. Upstream's sender never flushes the MSG_ERROR_EXIT it queues
(cleanup.c:250-254, io.c:1073-1075). The oc server's message also does
not reach that client's stderr. Both are left to the error-exit work.
Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop
failing on the master test-harness race: on EPERM for our own child, SIGKILL
the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the
child already leads its own group. The content is identical to #8253, so the
two merge without conflict.
# Conflicts:
#	crates/core/src/client/run/mod.rs
@oferchen oferchen closed this Oct 29, 2026
@oferchen oferchen reopened this Oct 29, 2026
@oferchen oferchen closed this Oct 29, 2026
@oferchen oferchen reopened this Oct 29, 2026
@oferchen
oferchen merged commit 3d8e23c into master Oct 29, 2026
102 of 175 checks passed
@oferchen
oferchen deleted the fix/checksum-choice-none branch October 29, 2026 15:24
oferchen added a commit that referenced this pull request Nov 4, 2026
Add the missing Unreleased lines for #8245 and #8262. Bring the release
template to 3.5.1 and protocols 28-33, replace its SEC-1-era security
table with a pointer to the CHANGELOG CVE index, add the Alpine .apk row
and a QUIC section, and pin the CHANGELOG, SECURITY and compare links to
the release tag. Remove RELEASE_NOTES_BETA.md, a v0.6.2-era draft that no
workflow reads, and point the beta runbook at the release the tag push
creates.
oferchen added a commit that referenced this pull request Nov 4, 2026
* docs: refresh the release template and changelog for 0.6.5

Add the missing Unreleased lines for #8245 and #8262. Bring the release
template to 3.5.1 and protocols 28-33, replace its SEC-1-era security
table with a pointer to the CHANGELOG CVE index, add the Alpine .apk row
and a QUIC section, and pin the CHANGELOG, SECURITY and compare links to
the release tag. Remove RELEASE_NOTES_BETA.md, a v0.6.2-era draft that no
workflow reads, and point the beta runbook at the release the tag push
creates.

* ci: fill {{PREV_VERSION}} in release notes and fix the benchmark duplicate guard
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