Skip to content

fix(pkg): resolve symlinks from (install) action #13239

Merged
Alizter merged 2 commits intoocaml:mainfrom
Alizter:push-stqwvouvzytt
Jan 20, 2026
Merged

fix(pkg): resolve symlinks from (install) action #13239
Alizter merged 2 commits intoocaml:mainfrom
Alizter:push-stqwvouvzytt

Conversation

@Alizter
Copy link
Copy Markdown
Collaborator

@Alizter Alizter commented Jan 8, 2026

The reloctable compiler, like the other OCaml compilers, has symlinks in it's installation layout. These need to be resolved before we declare them inside the directory target or else the reloctable compiler cannot be cached. This work is tracked in #13229.

In the second commit we introduce a general mechanism to comb through the targets of the install layout for a package and resolve these symlinks by replacing them with a hardlink, falling back to a copy if that is not possible.

We add quite a few tests to exercise the numerous edge cases that come up.

  • TODO describe tests a bit more

@Alizter Alizter marked this pull request as draft January 8, 2026 16:06
@Alizter Alizter mentioned this pull request Jan 8, 2026
14 tasks
Comment thread test/blackbox-tests/test-cases/pkg/install-symlinks/dir-symlink.t Outdated
@Alizter Alizter force-pushed the push-stqwvouvzytt branch from cc94c92 to c2de6fc Compare January 8, 2026 22:28
Comment thread src/dune_rules/pkg_rules.ml Outdated
@Alizter Alizter force-pushed the push-stqwvouvzytt branch 2 times, most recently from 87f7705 to 4402331 Compare January 14, 2026 15:10
@Alizter Alizter force-pushed the push-stqwvouvzytt branch 2 times, most recently from f4b854f to 1ca083a Compare January 16, 2026 13:38
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
@Alizter Alizter marked this pull request as ready for review January 19, 2026 08:20
Comment on lines +3 to +6
CR-someday Alizter: This behavior is questionable. We convert the symlink to a
hardlink pointing to an external file, which ties the build output to external
content. If the external file changes, the target would be stale. Consider
whether we should leave such symlinks as-is, copy the file, or error instead.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This won't affect the cache, since we reject all symlinks there, but I am still unsure if this is good to accpt. At the end of the day, it probably won't matter much.

@Alizter Alizter requested a review from rgrinberg January 19, 2026 08:22
@Alizter Alizter merged commit bfb1d4f into ocaml:main Jan 20, 2026
28 checks passed
@Alizter Alizter deleted the push-stqwvouvzytt branch January 20, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants