-
Notifications
You must be signed in to change notification settings - Fork 696
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
Prevent dependency on private library #5848
Conversation
Oops, of course on ghc <8.8 all libraries are private 🤦♂️ |
af482b4
to
6d5ab50
Compare
Hmm, this probably requires to add |
2d0bfac
to
86daec5
Compare
This is now complete and reviewable (Sorry for the mass ping) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if we had a test that depending on a private lib fails as expected.
Adding a positive variant is possible only when GHC-8.8 is out, please make an issue about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so sure anymore we should merge this; I'm still discussing this with @fgaz
@hvr why
? |
Concerns about the narrow ghc compatibility. As it is, this patch only allows multilibs on GHC<8.8 and doesn't provide an override. If it did (for example when using Also this makes cabal-install fail after build plan construction, which is not pleasant, but the only way to solve that is to make the solver sublibrary-aware. |
This has But in fact, i'm leaning towards disabling parsing of This is because I simply don't understand all the implications of the choices, and want to error on the safe side. |
I'm fine with postponing it until 3.2. |
I think we can, and in fact should merge this, even if we end up disabling Now, should we, in another pr, disable it? well...
TL;DR: +1 for merging, -1 for disabling multilibs, I'm for adding a new flag to allow future |
OK, I'll try to review this PR this week. Sorry for being slow. |
86daec5
to
fcbe835
Compare
np Added a negative package test |
please do! :-) |
The test is failing for ghc <=8.0.* Somehow for those versions sublibraries always appear as public. I'm investigating, but I don't see any clues in the ghc changelog edit: 8.2 included Cabal 2.0 (the first version with internal libraries and backpack), so it may be that. |
ghc-pkg<8.8 cannot read the visibility field, so all libraries were reported as private, even the main (unnamed) one. This commit forces the visibility of main libraries to be "public". This commit can be reverted once we stop supporting GHC<8.8, at the condition that we keep marking main libraries as public when registering them.
Related to the previous two commits (preventing dependency on private libraries and marking main libraries as public)
f88a8ad
to
88ecdd7
Compare
OK, this should fix the older ghcs. I also added the Ping @23Skidoo |
This is intended to be used by tools like cabal-install so they can add multilibs-compatibility even to older ghcs
88ecdd7
to
3e31042
Compare
The travis failures are unrelated to this (I did not even modify ResponseFiles.hs). @23Skidoo can we merge? |
@@ -703,6 +707,13 @@ configureOptions showOrParseArgs = | |||
configUseResponseFiles | |||
(\v flags -> flags { configUseResponseFiles = v }) | |||
(boolOpt' ([], ["disable-response-files"]) ([], [])) | |||
|
|||
,option "" ["allow-depending-on-private-libs"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be added to filterConfigureFlags
as well, though since we don't set it anywhere, it's not a blocker for merging.
Merged, thanks! |
This will make Cabal error out when depending on a private library.
It does not give detailed info on which sublibrary is the culprit because that would require changing the
dependencySatisfiable
andfinalizePD
return types, and that touches A LOT of the codebase. It can be done later./cc @ezyang @phadej
TODO:
Closes #5806