ocaml / ocaml/dune

No error is raised when building an empty package not defined in the dune-project file

Open
#6,099 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

requires-team-discussion
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

It looks like somewhere between the merge of https://github.com/ocaml/dune/pull/4867 and the release of dune 3.0.0, the feature lost all its tests in https://github.com/ocaml/dune/pull/5120 and suffers from a regression:

$ cat dune-project
(lang dune 3.0)
$ touch test.opam
$ dune build # With dune >= 3.0.3 no error
$ ~/dune/dune.exe build # With 5c6eb65b149a9254dc2e9bd618df9e198a321705 we get the error
Error: The package test does not have any user defined stanzas attached to it.
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
-> required by _build/default/test.install
-> required by alias all
-> required by alias default
$ echo "(package (name test))" >> dune-project
$ dune build # now dune >= 3.0.3 shows a warning
Error: The package test does not have any user defined stanzas attached to it.
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
-> required by _build/default/test.install
-> required by alias all
-> required by alias default

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 issue with an empty dune-project and test.opam, then compare the behavior around PRs 4867 and 5120. Check how dune build handles the generated package and install target. Done means restoring the intended error or warning behavior and adding regression coverage for both cases.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.