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

Cabal looks inside subdirectories, but only with later GHC #6739

Closed
tomjaguarpaw opened this issue Apr 25, 2020 · 7 comments · Fixed by #6740
Closed

Cabal looks inside subdirectories, but only with later GHC #6739

tomjaguarpaw opened this issue Apr 25, 2020 · 7 comments · Fixed by #6740
Milestone

Comments

@tomjaguarpaw
Copy link
Member

Describe the bug

I have a "top-level" directory that contains opaleye.cabal. The directory contains a subdirectory called opaleye-sqlite which contains opaleye-sqlite.cabal. The latter is, by design, not buildable.

If I run cabal v2-configure --with-ghc=<8.4.4> then all is well. It builds opaleye.cabal as expected.

If I run cabal v2-configure --with-ghc=<8.6.5> then it also tries to build opaleye-sqlite.cabal. I don't want it to! The build fails, as expected.

...
cabal: Could not resolve dependencies:
[__0] trying: opaleye-0.6.7004.2 (user goal)
[__1] trying: transformers-0.5.6.2/installed-0.5.6.2 (dependency of opaleye)
[__2] trying: contravariant-1.5.2 (dependency of opaleye)
[__3] trying: base-4.12.0.0/installed-4.12.0.0 (dependency of opaleye)
[__4] next goal: opaleye-sqlite (user goal)
[__4] rejecting: opaleye-sqlite-0.0.1.0 (conflict: contravariant==1.5.2,
opaleye-sqlite => contravariant>=1.2 && <1.5)
[__4] skipping: opaleye-sqlite-0.0.0.1, opaleye-sqlite-0.0.0.0 (has the same
characteristics that caused the previous version to fail: excludes
'contravariant' version 1.5.2)
[__4] fail (backjumping, conflict set: contravariant, opaleye-sqlite)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: contravariant, transformers, base,
opaleye, opaleye-sqlite
Try running with --minimize-conflict-set to improve the error message.

To Reproduce

  • Clone Opaleye from https://github.com/tomjaguarpaw/haskell-opaleye
  • Run cabal v2-configure --with-ghc=<your GHC 8.4.4>. It will succeed.
  • Run cabal v2-configure --with-ghc=<your GHC 8.6.5>. It will fail with the error above.
  • rm opaleye-sqlite/opaleye-sqlite.cabal
  • Run cabal v2-configure --with-ghc=<your GHC 8.6.5>. It will succeed, because it no longer tries to build opaleye-sqlite/opaleye-sqlite.cabal.

Expected behavior

I expected that when using GHC 8.6.5 it only try to build opaleye.cabal (like it did with GHC 8.4.4) not opaleye-sqlite/opaleye-sqlite.cabal too.

It seems to be looking into subdirectories, and I'm not sure why. I'm also not sure why this depends on GHC version!

System information
Debian Linux 10.3, cabal 3.2.0.0 via ghcp, ghc 8.4.4 from Debian, ghc 8.6.5 from ghcup

@phadej
Copy link
Collaborator

phadej commented Apr 25, 2020 via email

@tomjaguarpaw
Copy link
Member Author

I can confirm that your workaround works. Thank you! I was so confused. Could you clarify a few things for me?

  1. Why do I see this behaviour on GHC 8.6.5 but not GHC 8.4.4?

  2. Are you suggesting removing the optional-packages field from the implicit cabal.project (i.e. when that file does not exist)? If so, wouldn't that break the workflows of people who are relying on that?

@hasufell
Copy link
Member

Why do I see this behaviour on GHC 8.6.5 but not GHC 8.4.4?

I can confirm this behavior and it was indeed the primary source of confusion.

@phadej
Copy link
Collaborator

phadej commented Apr 25, 2020 via email

@tomjaguarpaw
Copy link
Member Author

I still don't understand. How does that cause a difference between two GHC versions?

@phadej
Copy link
Collaborator

phadej commented Apr 25, 2020 via email

@tomjaguarpaw
Copy link
Member Author

Ah, very interesting! I didn't even consider the possibility that it was correct behaviour all along! Thanks, your explanations have been very helpful.

hasufell added a commit to hasufell/cabal that referenced this issue Apr 25, 2020
hasufell added a commit to hasufell/cabal that referenced this issue Apr 25, 2020
@phadej phadej added this to the 3.4.0.0-rc1 milestone Jul 13, 2020
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 a pull request may close this issue.

3 participants