Is there an existing issue for this?
- I have searched the existing issues
Current behaviour
Depends caches packages using $(package)_local_dir as a tarball in SOURCES_PATH. The tarball is currently recreated only when find -newer
reports a path newer than the cached archive.
This does not reliably identify directory contents:
- Two worktrees sharing
SOURCES_PATHcan contain different source trees. - A tarball created by one worktree may be newer than every path in another.
- Deleting a file leaves no path whose mtime can be checked.
- Changed or restored files may have older or equal mtimes.
- Timestamp granularity and clock differences make ordering unreliable.
native_libmultiprocess is currently the only package using local_dir.
A shared SOURCES_PATH may contain e.g. src-ipc-libmultiprocess.tar generated from another worktree. If none of the current worktree's paths are newer, Depends reuses that archive.
The fetched stamp then correctly hashes the stale archive, and its checksum correctly affects the package build ID. However, the package is built from the wrong explicit source input.
Clearing BASE_CACHE or disabling Guix substitutes does not help because the stale input remains in SOURCES_PATH.
Expected behaviour
Local source identity should change when any of the following changes:
- A file is added, removed, or modified.
- File permissions, including the executable bit, change.
- A symlink target changes.
- An empty directory is added or removed.
Filesystem timestamps, ownership paths, and absolute worktree locations should not determine the identity. Identical trees in separate worktrees should produce the same archive checksum.
Different trees using the same shared SOURCES_PATH should be able to coexist.
Steps to reproduce
Tricky to define clearly here, but I'll try:
- Have two Bitcoin Core worktrees on different branches.
- Both worktrees use the same Depends
SOURCES_PATH. - The branches contain different versions of
src/ipc/libmultiprocess. - Both worktrees already exist before either build starts, so their source-file mtimes are older than the next archive created.
- Build Depends in worktree A. This creates
src-ipc-libmultiprocess.tarin the shared source cache. - Then build Depends in worktree B.
- The cached tarball is newer than every path in worktree B, so
find -newerreports no changes. - Depends reuses worktree A’s tarball even though worktree B has different contents.
- The checksum and build ID are calculated correctly—but for A’s stale archive.
- Worktree B therefore reproducibly builds the wrong libmultiprocess source.
The same problem can happen without two worktrees when a file is deleted or restored with an older mtime: the directory contents changed, but find -newer cannot detect it.
Relevant log output
No response
How did you obtain Bitcoin Core
Compiled from source
What version of Bitcoin Core are you using?
master branch, pr-35261
Operating system and version
NixOS 26.05
Machine specifications
No response