Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symlinks in directory targets don't go in shared cache #11523

Open
emillon opened this issue Mar 10, 2025 · 2 comments
Open

symlinks in directory targets don't go in shared cache #11523

emillon opened this issue Mar 10, 2025 · 2 comments
Labels
bug shared-cache Shared artefacts cache

Comments

@emillon
Copy link
Collaborator

emillon commented Mar 10, 2025

When a directory target contains a symlink, it prevents it from going to the shared cache:

  $ export DUNE_CACHE_ROOT=$PWD/.cache
  $ export DUNE_CACHE=enabled

  $ cat > dune-project << EOF
  > (lang dune 3.0)
  > (using directory-targets 0.1)
  > EOF

  $ cat > dune << EOF
  > (rule
  >  (target (dir d))
  >  (action
  >   (progn
  >    (run mkdir -p d)
  >    (chdir d
  >     (progn
  >      (echo building)
  >      (run touch target)
  >      (run ln -s target symlink))))))
  > EOF

  $ dune build d
  building

  $ dune clean

  $ dune build d
  building

In this example, the rule is executed the second time (we can see it with the
echo). If we remove the run ln ... action, it is correctly cached (second
echo is not visible).

I would expect this rule to be able to go to the shared cache; maybe with some
restrictions about the symlink targets.

This seems to prevent some pkg rules to cache correctly, for example
ocp-indent.1.8.1 has some symlinks and it gets redownloaded after dune clean.

@emillon emillon added the shared-cache Shared artefacts cache label Mar 10, 2025
emillon added a commit to emillon/dune that referenced this issue Mar 10, 2025
@ejgallego
Copy link
Collaborator

@emillon do you know if this is this a recent bug or one that has been present since longer?

@maiste maiste added the bug label Mar 10, 2025
maiste pushed a commit that referenced this issue Mar 11, 2025
@emillon
Copy link
Collaborator Author

emillon commented Mar 12, 2025

@ejgallego the current behavior is present in dune 3.13.0 which introduced caching for directory targets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug shared-cache Shared artefacts cache
Projects
None yet
Development

No branches or pull requests

3 participants