Skip to content

fix: select the basis under --whole-file as upstream does - #8325

Merged
oferchen merged 1 commit into
masterfrom
fix/basis-selection-under-whole-file
Nov 4, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/basis-selection-under-whole-file

Conversation

@oferchen

@oferchen oferchen commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Summary

Under --whole-file, and for an existing destination that also has a --partial-dir file, the receiver now selects its basis the way 3.5.1's generator does.

Upstream recv_generator() picks the basis before it looks at whole_file:

  • a --partial-dir file overrides the destination (generator.c:2270-2275);
  • --fuzzy and alt-dest bases are found for a missing destination (:2155, :2181);
  • only after that does if (read_batch || whole_file) skip the block sums (:2280, :2400);
  • ITEM_BASIS_TYPE_FOLLOWS / ITEM_XNAME_FOLLOWS still go on the wire (:2381-2386);
  • the receiver opens the named basis, so dest_mode() reads its stat (receiver.c:1158-1208).

oc returned no basis at all under -W, and it checked the destination before the partial. As a result, both the file's mode (without --perms) and the generator's request bytes differed from 3.5.1.

Changes

  • receiver/basis.rs:
    • the partial-dir file is checked first (try_partial_basis);
    • under whole-file, whole_file_basis names the partial, alt-dest or fuzzy basis without building a signature;
    • when the destination exists, nothing is named, matching upstream's statret == 0 path.
  • transfer_ops/request.rs and pipeline/pending.rs: a request with a named basis but no sums now keeps that basis (PendingTransfer::new_whole_file_against). is_delta_transfer() is now true only when sums were sent.

Verification

  • Oracle, 3.5.1 tarball server vs oc server, push, no -p:
    • every partial-dir and fuzzy cell, plain, -W and --protocol=28, now lands the same mode as 3.5.1;
    • before this change the -W partial cells gave 755 / 640 against 3.5.1's 600.
  • Wire bytes: server-to-client stream, 3.5.1 client on both runs, --checksum-seed=1, multiplex framing stripped:
    • identical to 3.5.1 for no basis, new + partial, existing + partial, and new + fuzzy;
    • the same comparison on master flags all four basis cells (master omits the basis-type byte and the fuzzy xname);
    • the partial file is removed after the transfer, as in 3.5.1.
  • Tests:
    • daemon_dest_mode_parity runs every cell with and without --whole-file and adds "existing + --partial-dir";
    • new unit tests in receiver/basis.rs and pipeline/pending.rs;
    • the targeted transfer tests pass (312).
  • Mutations: each one fails at least one test:
    • an early EMPTY under whole-file fails 2 tests;
    • checking the destination before the partial fails 1;
    • the receiver dropping the named basis fails the daemon -W cell with 0600 against 0640.

Not in this PR

  • --compare-dest / --copy-dest / --link-dest on an rsh push still land 755 against 3.5.1's 600, with and without -W. The oc rsh server never selects the alt-dir basis; that is task 546.
  • Frame boundaries differ: oc sends three 1-byte data frames where 3.5.1 sends one 3-byte frame. That is task 489.

@oferchen
oferchen force-pushed the fix/basis-selection-under-whole-file branch from ac60aa9 to 522c85a Compare November 3, 2026 23:08
@oferchen
oferchen changed the base branch from perf/skip-pre-transfer-stat-under-perms to master November 3, 2026 23:16
@github-actions github-actions Bot added the bug Something isn't working label Nov 3, 2026
@oferchen oferchen closed this Nov 4, 2026
@oferchen oferchen reopened this Nov 4, 2026
@oferchen
oferchen force-pushed the fix/basis-selection-under-whole-file branch from 522c85a to a1625fe Compare November 4, 2026 04:16
@oferchen oferchen closed this Nov 4, 2026
@oferchen oferchen reopened this Nov 4, 2026
oferchen added a commit that referenced this pull request Nov 4, 2026
…ce (#8331)

The nextest job ran out of runner disk while linking workspace test
binaries (master runs at 01:59Z and 03:35Z on 2026-11-04, and #8325's
required run). Line tables keep file:line in panics and backtraces.
@oferchen oferchen closed this Nov 4, 2026
@oferchen oferchen reopened this Nov 4, 2026
@oferchen oferchen closed this Nov 4, 2026
@oferchen oferchen reopened this Nov 4, 2026
upstream generator.c chooses the basis before the whole_file branch: a
--partial-dir file overrides the destination (:2270-2275), fuzzy and
alt-dest bases are found for a missing destination (:2155, :2181), and
only then does `if (read_batch || whole_file)` skip the block sums
(:2280, :2400). ITEM_BASIS_TYPE_FOLLOWS and ITEM_XNAME_FOLLOWS still go
on the wire (:2381-2386), and the receiver opens the named basis, so
dest_mode() reads its stat (receiver.c:1158-1208).

oc returned no basis under -W and checked the destination before the
partial. The generator now names the basis under -W without a
signature, and the receiver keeps and opens it; a transfer counts as a
delta only when block sums were sent.
@oferchen
oferchen force-pushed the fix/basis-selection-under-whole-file branch from a1625fe to 6219632 Compare November 4, 2026 06:37
@oferchen oferchen closed this Nov 4, 2026
@oferchen oferchen reopened this Nov 4, 2026
@oferchen
oferchen merged commit 0c65bdd into master Nov 4, 2026
79 of 125 checks passed
@oferchen
oferchen deleted the fix/basis-selection-under-whole-file branch November 4, 2026 07:20
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