Skip to content

fix(sandbox): materialize directory dependencies as file symlinks - #16596

Closed
Alizter wants to merge 2 commits into
ocaml:mainfrom
Alizter:sandbox-file-symlinks
Closed

Alizter wants to merge 2 commits into
ocaml:mainfrom
Alizter:sandbox-file-symlinks

Conversation

@Alizter

@Alizter Alizter commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Alternative to #16587: create real sandbox directories and symlink individual files. Fixes #16547 (reproducer: #16546).

Alternative to the directory-symlink overlap fix. Use cached produced-target metadata to create real sandbox directories and link file leaves, pruning overlapping inputs and computing link prefixes once per directory. Preserve previously admitted dynamic inputs and support copying regular-file symlinks.

Signed-off-by: Ali Caglayan <[email protected]>
@rgrinberg

Copy link
Copy Markdown
Member

This also seems off:

  1. There should be a bug reproduction that does not reference package management in any way. This is an engine bug that should be reproduced with the minimum amount of dune features.

  2. The fix adds special handling for symlinking, but I don't see how the bug is avoided for hard linking. copying mode also sees to work only by accident.

  3. There's some unrelated fix to the tree copy action. What's that about?

I suggest that we take the following steps:

  1. Properly reproduce the issue (in all of its sandboxing manifestations) in a fresh PR

  2. Fix the silent overwriting in copy mode. This carelessness cost us some confusion here and is likely to cause more in the future.

  3. Fix the issue either by giving complete info to Sandbox.add_deps or by having Sandbox.add_deps handle the details. Right now, there's an attempt to split this responsibility across two places and it's only more confusing this way.

Alizter added a commit that referenced this pull request Oct 21, 2026
Allow `Io.copy_file` callers to choose exclusive creation or
overwriting. Reject existing destinations during copy and patch-back
sandbox population.

This implements [Rudi's request in
#16596](#16596 (comment))
to stop silent overwriting in copy mode before fixing the overlapping
directory dependencies behind #16547. It updates the reproduction from
#16626; resolving the overlap itself remains a separate change.
@Alizter Alizter closed this Oct 27, 2026
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.

Running a binary in a rule with a (deps (package <p>)) on it's provider package fails with a symlink error

2 participants