Cache doesn't work on `opam install`
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 1.9k
- Forks
- 500
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 277
Description
Expected Behavior
Enabling the dune cache would allow speedup for (re)building packages when (re)installing them via OPAM.
Actual Behavior
The cache folders are created, but no files are getting cached.
Reproduction
export DUNE_CACHE=enabledexport XDG_CACHE_HOME=$(pwd)/dune-cacheopam install some_packages that_use_dunetree $XDG_CACHE_HOME- Note that the folders were created but no files
As we debugged with @emillon this is due to the OPAM sandbox bind-mounting the cache folder inside the sandbox, so even on the same file system the cache files can't be hardlinked.
A possible workaround is export DUNE_CACHE_STORAGE_MODE=copy and it does populate the cache with files, but it could be useful to detect this case and find a solution for it.
Specifications
- Version of
dune(output ofdune --version): 3.4.1 - Version of
ocaml(output ofocamlc --version) 4.14.0 - Operating system (distribution and version): Fedora Linux 36
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with DUNE_CACHE enabled, XDG_CACHE_HOME set, and an opam install, then inspect how Dune handles the cache when the OPAM sandbox bind-mounts it. Compare the default hardlink behavior with DUNE_CACHE_STORAGE_MODE=copy; done means cache files are stored successfully during opam installs without requiring the workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100