Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break cycle between Dir and Entry (dune 3.7) #18

Merged
merged 1 commit into from
Feb 25, 2023

Conversation

emillon
Copy link
Contributor

@emillon emillon commented Feb 16, 2023

Hi!

While preparing dune 3.7 we noticed that this library used to build, but does not anymore.
After investigating, there is a dependency cycle in lib: entry.ml depends on Dir, and dir.mli depends on Entry.

Dune used to be OK with that, but the new dependency analysis algorithm in 3.7 makes tighter checks and (correctly) detects it. It's kinda OK in that particular case because Dir only uses a type alias for Entry, but dune can not reliably detect this. So arguably chamelon used to rely on a bug in dune.

So this PR adds an extra Entry0 module with just the type definition, in a way that splits the cycle and makes it compatible with dune 3.7.

A alternative would be to expand the type alias in dir.mli.

@emillon
Copy link
Contributor Author

emillon commented Feb 16, 2023

(see discussion in ocaml/dune#7018)

There is a dependency cycle in `lib`: `entry.ml` depends on `Dir`, and
`dir.mli` depends on `Entry`.

Dune used to be OK with that, but the new dependency analysis algorithm
in 3.7 makes tighter checks and (correctly) detects it. It's kinda OK in
that particular case because `Dir` only uses a type alias from `Entry`,
but dune can not reliably detect this.

So this PR adds an extra `Entry0` module with just the type definition,
in a way that splits the cycle and makes it compatible with dune 3.7.
@emillon emillon force-pushed the split-dependency-cycle branch from b4ffdd1 to 8e9c0b5 Compare February 16, 2023 12:35
emillon added a commit to emillon/opam-repository that referenced this pull request Feb 20, 2023
Two packages got broken by dune 3.7: commons and chamelon. They were
relying on behavior in dune's dependency cycle detection that we
classified as a bug (see ocaml/dune#7018).

Since the latest versions are affected, we sent patches upstream:
yomimono/chamelon#18, semgrep/semgrep#7173.
@yomimono
Copy link
Owner

Thanks, @emillon !

@yomimono yomimono merged commit 2041c05 into yomimono:main Feb 25, 2023
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.

2 participants