Skip to content

feat: symlinks in directory targets - #12613

Closed
Alizter wants to merge 2 commits into
ocaml:mainfrom
Alizter:push-poklntzrmvnz
Closed

Alizter wants to merge 2 commits into
ocaml:mainfrom
Alizter:push-poklntzrmvnz

Conversation

@Alizter

@Alizter Alizter commented Oct 22, 2025 •

Copy link
Copy Markdown
Collaborator

Fixes #9873

Aims to supersede #10426

We allow symbolic links to appear inside directory targets with some limitations. Symbolic links are not permitted to point outside of the directory target they are inside. We also forbid symbolic links to absolute directories from occurring inside directory targets.

We allow symlinks to appear inside directory targets with some
limitations. Symlinks are not permitted to point outside of the
directory target they are inside.

Signed-off-by: Ali Caglayan <[email protected]>
| Error No_such_file -> report_user_error []
| Error Broken_symlink -> report_user_error [ Pp.text "Broken symbolic link" ]
| Error Cyclic_symlink -> report_user_error [ Pp.text "Cyclic symbolic link" ]
| Error (Symlink_escapes_target path) ->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When is this code path possible?

@Alizter Alizter changed the title test: symlinks in directory targets feat: symlinks in directory targets Oct 28, 2025
@Alizter

Alizter commented Nov 13, 2025

Copy link
Copy Markdown
Collaborator Author

After some discussion about this it seems supporting directory symlinks inside directory targets might need a little bit more thinking and design than we can spare at the moment.

Coming back to the original issue #9873, it only seems to occur with pathological examples. I have yet to see a package where a directory symlink is a critical part of the build and dune does not offer a sound work-around. Many packages that appear in practice can therefore be patched in our pkg overlays, as we have done for ocamlbuild.

If the need arises in the future that a commonly used package needs this feature, then it would be enough motivation to rethink the solution here.

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.

Error with directory symlink: Unexpected file kind "S_DIR"

2 participants