1 suggestion
Optional improvements
[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:
- Upstream 47be6cda3bdf917b2c0fff3e1c932a7fab9b9781 (#36927) → 7ec0b1563b7a68b5de8032eb7dad2f82cce6bbee: same one-line removal of
"errors": {"dev": true}from the dev-mode preset. At head, CMakePresets.json no longer has anerrorskey in any preset. - Upstream 3d92fe8bbdf8c0b5e14ad824c792c53a697137a7 (#36927) → daacf03e0ac8983a50f8c6692dfbf3f86fd89ce4:
-Werror=devis removed from ci-test-each-commit-exec.py (matches the base file), ci-windows.py and ci/test/03_test_script.sh. The range-diff differences come from 31.x code: it uses"--preset", "vs2026"plus GENERATE_OPTIONS, and it doesn't quote-DCMAKE_INSTALL_PREFIX. The resulting code at head is correct. - At head, the only remaining
-Werror=devis in contrib/guix/libexec/build.sh:250. Upstream 3d92fe8 also keeps-Werror=devin its Guix scripts (build_*_gui.sh), so leaving Guix alone (it uses a pinned CMake) matches upstream scope. - Upstream 01491f22b2c77d632e8503cc446140d1ab6ccc21 (#35765) → df4edd63b0b3273d9dbb10d10bd5ebc36eb76406: the Makefile, funcs.mk and packages.md changes are the same as upstream. Head depends/Makefile:70 adds
base_local_source_dir=$(WORK_PATH)/local-sources. Head funcs.mk:103 and :113 choose the source directory per package and set the fetched-stamp path, matching upstream funcs.mk:107/117. - The funcs.mk line offset (98 vs 102) is because 31.x's
fetch_local_dir_sha256does not have upstream's later mtime normalization and sorted tar listing (build_TOUCH,LC_ALL=C sort,--no-recursion). The backported hunks don't touch those lines or depend on them. - Supporting code in 31.x is the same as upstream: the
$(1)_fetchedrule (head funcs.mk:248-253),check_or_remove_sources(Makefile:249-254) andfetch_local_dir_sha256all use$($(1)_source_dir)or$($(1)_fetched). They therefore follow the new local-sources location without further changes.cleanremoves WORK_PATH, and depends/.gitignore already ignoreswork/. - Guix in 31.x: guix-build runs
make download-*on the host (guix-build:304-306) and mounts$PWDat /bitcoin (line 446). So the tarball and stamp under depends/work/local-sources are the same files inside the container. Stamps hold relative filenames because sha256sum runs aftercdinto source_dir. The bug being fixed still exists in 31.x:native_libmultiprocess.mk:2useslocal_dir=../src/ipc/libmultiprocess, which gives the same tarball name in every checkout. - No test files were changed upstream, so there are no tests to carry over.
- ce734ea690716932c70bba7fd5c717e90d00768e is release preparation not taken from upstream. It adds Build entries for #35765 and #36927 (the
[32.x]prefix is dropped) and credits fanquake and Ryan Ofsky, who wrote the backported commits.
Limitations:
- I didn't run any builds, CI or Guix builds. Whether depends, CMake configure and Guix work on 31.x was checked by reading the source, not by running anything.
- The df4edd6 commit message is copied from upstream. It says the host
make download-*step sets local-dir mtimes to 2000-01-01, but 31.x'sfetch_local_dir_sha256does not do this (nobuild_TOUCHand no such date in the tree). The fix still addresses the shared-SOURCES_PATH collision on 31.x, but the bug may reproduce less reliably there than the message suggests. - Changing funcs.mk and the Makefile changes the meta_depends hashes, so every depends package will rebuild once. This is expected and matches upstream.
- Minor: in the release-notes credits,
fanquakeis listed beforeEugene Siegel, so the list is not in alphabetical order. This is cosmetic and is usually fixed when the release notes are finalized. - I only checked the upstream source at the given original commits. I didn't look at the related 32.x and 30.x backports (#36984, #36929) to compare how other branches were adapted.
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.
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.
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.
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.
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.
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.