ocaml / ocaml/dune

Dune should not look up other sub-directories when given `-p`

Open
#2,913 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build package management
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

When investigating the issue ligo's developers have here https://github.com/ocaml/dune/issues/2131#issuecomment-550475432 with @rgrinberg, we discovered that, when given a directory containing two sub-directories with two projects like so:

+ /
  - dune-project
  + project-a/
    - dune-project
    - project-a.opam
    - [...]
  + project-b/
    - dune-project
    - project-b.opam
    - [...]

dune build @install, even when given -p project-a, will scan for every packages used by project-b, thus, if opam install some of them at the same time, a race condition can occur in the same way as it happened in https://github.com/ocaml/dune/issues/2131

Here is a sample of the strace for dune build -p ocplib-resto with this archive:

stat("/home/kit_ty_kate/.opam/4.07.1/lib/ocaml/stdlib.dune", 0x7ffed0b53020) = -1 ENOENT (No such file or directory)
stat("/home/kit_ty_kate/.opam/4.07.1/lib/tezos-protocol-environment-sigs/dune-package", 0x7ffed0b530c0) = -1 ENOENT (No such file or directory)
stat("/home/kit_ty_kate/.opam/4.07.1/lib/tezos-protocol-environment-sigs/META", 0x7ffed0b530a0) = -1 ENOENT (No such file or directory)
stat("/home/kit_ty_kate/.opam/4.07.1/lib/META.tezos-protocol-environment-sigs", 0x7ffed0b530a0) = -1 ENOENT (No such file or directory)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the dune build @install and dune build -p project-a commands with two nested projects, then trace how Dune discovers projects and packages. Done means selecting project-a no longer scans or looks up packages from project-b, while the reported build still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.