WIP: [31.x] Backports

bitcoin/bitcoin: PR #36928

1 suggestion

Optional improvements

Link

[suggestion] · Backport rationale assumes local_dir timestamp normalization absent from 31.x

The copied Guix explanation relies on timestamp normalization absent from 31.x; the backport still fixes shared-archive reuse, but its target-branch trigger is timing-dependent.

Location: depends/funcs.mk:103 (head).

Details and suggested fix

The message for df4edd63b0 says host make download-* resets local-source mtimes to 2000-01-01. On 31.x, fetch_local_dir_sha256 creates the archive with plain tar and has no timestamp-normalization step, unlike the upstream helper. Checkouts sharing SOURCES_PATH can still reuse another checkout's archive when no local path is newer than it, so moving these archives to checkout-local storage remains correct. Add a short note to the PR description or backport commit message explaining that 31.x fixes this timing-dependent collision without normalizing local_dir mtimes. The upstream explanation can remain for traceability; no code change is needed.


Backport verdict: Needs clarification

Fidelity could not be established from the available evidence.

Evidence:

Limitations:

Coverage details

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

A checksum and build ID authenticate the selected archive, not its correspondence to the current checkout. The historical issue explicitly distinguishes correctly hashing a stale local tarball from selecting the intended source input.

Both pinned versions incorporate the local archive checksum into the recipe hash and downstream dependency build IDs. Moving storage concerns which checkout's snapshot is selected before those hashes are calculated; a valid stamp alone cannot establish that selection.

Source 1

The upstream proposal deliberately separates checkout-generated snapshots from shareable downloaded archives. It places local tarballs and checksum stamps together under WORK_PATH/local-sources while explicitly retaining existing mtime-based invalidation.

The pinned head implements this distinction through package-specific source_dir selection and a fetched-stamp path derived from that directory. This is a cache-ownership change, not a replacement of timestamp invalidation with content-based source-tree detection.

Source 1

Guix's fixed /bitcoin mount makes absolute checkout paths unsuitable for separating local archives in a shared source cache. The upstream proposal identifies this constraint explicitly; the pinned Guix comments explain that fixing the build path avoids host-path-dependent irreproducibility.

Different checkouts intentionally have the same container-visible path. The relevant separation must therefore come from checkout-owned storage, rather than assuming that an absolute source pathname uniquely identifies a checkout across Guix builds.

Source 1

The historical issue describes the limits of timestamp ordering: different worktrees, restored files with older or equal mtimes, clock differences, and timestamp granularity can make 'nothing newer than the archive' diverge from 'the intended source tree is unchanged.' It calls for identical trees in different worktrees to have identical archive checksums.

These are distinct requirements: checkout isolation governs whether a snapshot may be reused, while reproducible archive construction governs whether independently produced snapshots have matching identities. The upstream proposal preserves mtime invalidation, so the issue's broader expectations should not be read as guarantees newly established by the storage move.

Source 1 · Source 2

Ralph's inferences

The implementation uses a two-level performance shortcut: reuse the archive unless a local path is newer, then reuse its checksum stamp unless the archive is newer. This assumes that timestamp ordering is a useful change signal within the snapshot's owning checkout; it is not a general proof of source-tree identity.

The helper runs while computing recipe hashes. Avoiding repeated archive creation and hashing makes repeated dependency evaluation cheaper. Both pinned versions retain this helper unchanged, including deleting the checksum stamp whenever the archive is regenerated.

Normalizing source timestamps removes information that an mtime-based freshness test would otherwise use. When normalized files predate a cached archive, safe reuse must depend on that archive belonging to the same checkout, not merely on its timestamp or checksum.

This explains why timestamp normalization and shared local snapshots interact materially. The pinned head makes WORK_PATH checkout-local by default and keeps the archive and stamp in that namespace. That isolation is conditional on WORK_PATH remaining checkout-specific; normalization itself does not establish freshness.

Source 1

Guix host/container operation needs both namespace continuity and reproducible source identity: the current checkout's work directory can travel with its /bitcoin mount, while downloaded archives remain available through the separately shared SOURCES_PATH. Independently regenerated archives must still yield matching hashes if they represent the same intended input.

The pinned script prefetches sources because the build container has no network access, then shares the checkout and optional SOURCES_PATH. Relocating local archives into depends/work therefore need not imply downloading inside the container or making local snapshots globally shareable. The upstream proposal reports host/container checksum and build-ID matching, but that report is not an independently executed validation of this backport.

Source 1