Skip to content

test: Reproducer for refetching packages with symlinks#14429

Open
punchagan wants to merge 1 commit intoocaml:mainfrom
punchagan:fetch-src-symlink-repro
Open

test: Reproducer for refetching packages with symlinks#14429
punchagan wants to merge 1 commit intoocaml:mainfrom
punchagan:fetch-src-symlink-repro

Conversation

@punchagan
Copy link
Copy Markdown
Collaborator

This commit adds a test demonstrating the fact that packages which contain symlinks are refetched on fresh builds. The bug was discovered via a project that depends on the menhir project.

@punchagan punchagan force-pushed the fetch-src-symlink-repro branch 3 times, most recently from 0b68354 to 3bd10a6 Compare May 6, 2026 12:09
This commit adds a test demonstrating the fact that even with the cache
packages which contain file symlinks are refetched on fresh builds. The
bug was discovered via a project that depends on the `menhir` project.

Signed-off-by: Puneeth Chaganti <punchagan@muse-amuse.in>
@punchagan punchagan force-pushed the fetch-src-symlink-repro branch from 3bd10a6 to e4bbfcf Compare May 6, 2026 12:09
@punchagan punchagan marked this pull request as ready for review May 6, 2026 12:34

The file that was fetched is in the cache. The symlink would have the same contents, so wouldn't appear separately in the cache.

$ find $DUNE_CACHE_ROOT/db/files -type f -exec md5sum {} \; | grep --quiet $CONTENT_CHECKSUM
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should use DUNE_TRACE=+cache and then check that there are cache store events that you expect. See test-cases/dune-cache for examples.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you would expect is that the source directory target gets (rightly) rejected from the cache here.

cache, it will fail, as the source is 404 now:

$ dune clean
$ export DUNE_CACHE=disabled
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This invalidates the digests of all the targets so not particularly important to test. Can be removed.

Enabling the cache again also attempts to re-download the source, since it contains a symlink:

$ dune clean
$ export DUNE_CACHE=enabled
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best set the cache as enabled at the beginning and not change it since that will just change the digest of all the targets and rebuild anyway.

@Alizter
Copy link
Copy Markdown
Collaborator

Alizter commented May 6, 2026

As we've discussed before: The caching of the downloaded mehhir sources are rejected because menhir sources contain a symlink. That's fine, but it means rerunning the entire action results in a download. A better solution would be to factor the rules so that downloading and extracting are separate. This would allow the downloading step to be cached while the extracting step would continue to be rerun, however should continue to not invalidate the rest of the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants