-
Notifications
You must be signed in to change notification settings - Fork 697
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
Include the GHC "Project Unit Id" in the cabal store path #9326
Conversation
63c7fc3
to
23b1e7a
Compare
This design seems reasonable, perhaps worth spending a moment to make sure it does not backfire with some unexpected consequences I am a bit surprised to see how far down we need to bring I'll have another look tomorrow or early next week. |
23b1e7a
to
0d51bf4
Compare
Does anything rely on the shape of the hashes? Some 3rd party tool? |
0d51bf4
to
af3645e
Compare
Of the two proposed tickets to address this, I think this is the cleaner one conceptually, though the amount of code necessarily touched is unfortunate. |
As we discuss this topic, I noticed today that the platform is present in the cabal hash but not in the store path. This is different from what we do with Perhaps this is something to consider togheter with the abi-hash. Edit: On a second thought. I think I'd prefer adding the platform to the path, just like we do with dist-newstyle, and adding the ghc abi hash to cabal hash, rather that to the store path. This has a simple structure and a clear meaning to the user. A power user can still delete all cached entries from a particular GHC by grepping for the GHC ABI tag. cabal-install could also provide some store-management commands to help. |
This PR changes the store path, not the hashes. Am I misunderstanding? |
Apologies if I keep commenting. I was under the impression we were going to include a full hash, while GHC does not actually provide one but only |
Stack indexes like this: The hashing is here: https://github.com/commercialhaskell/stack/blob/bffa6d8cd33620fdf962d1d16fca0eb92cea7549/src/Stack/Build/Source.hs#L144-L183 |
I'm a power user and I have no idea how to do that. I don't want to think about nix hashes at all. I want to delete directories. We should add the hashes to the nix store AND the path. There's no sensible sharing of artifacts possible between two different GHC ABIs. Directory structure is unix interface. |
Let's make a summary. The goal is to prevent cabal from linking togheter two packages compiled with incompatible binary distributions of GHC. Given cabal only tracks the compiler id in the package hash, it is not able to tell the difference between them; and it will use a package compiled with bindist1 as a dependency of a package being compiled with bindist2. After some discussions, the proposed solution seems to be the following:
The platform is just like The current implementation creates
This feels like a roundabout way (stripping the prefix and putting it back later) and making the assumption that
I would be ok with this approach. On the other hand. I am thinking that the problem might magically disappear in GHC 9.8.1 anyway (note that the above does not solve anything for GHC < 9.8.1 since before 9.8.1 GHC does not report a I am suggesting this because in the GHC 9.8.1 bindist the boot packages have hashes in their unit-id:
which automatically become part of
Could this be enough to prevent the binary compatibility issues we want to avoid? @bgamari @Ericson2314 @angerman can you comment from the GHC side of things? |
Let's not try to be too smart. It is the right thing to do to isolate compilers that have zero ABI compatibility. For GHCs that don't provide Unit ID, we can employ similar hashing like stack. I linked it above. |
😒 I don't think I have said or suggested anything smart. I was trying to define what you mean by "compilers that have zero ABI compatibility".
I still don't know how that is computed. If we want to be very sure what about using 🤷 I won't contribute to this any further. I will be ok with whatever solution is accepted. |
I think relying on boot libraries abi hashes is somewhat "smart" (we do that in the HLS wrapper script in fact, but because there was no exposed GHC ABI at that time). We also don't know exactly how that will pan out if we ever have proper decoupling of GHC and base (reinstallable base). |
- This allows the use of several **API incompatible builds of the same version of GHC** without corrupting the cabal store. - This relies on the "Project Unit Id" which is available since GHC 9.8.1, older versions of GHC do not benefit from this change. [fixes haskell#8114]
af3645e
to
f8ed54c
Compare
I think @andreabedini is right to observe that including the compiler ABI hash in the package hash would be sufficient to fix this problem. Remember, If we remember the purpose of the separating out the build artifact in per-version directories is based on the incorrect assumption that there will only be one, compatible ghc version installed and used on your system the natural progression of this idea is to do what is done in this MR and increase the resolution of this distinction to distinguish between GHC's of the same version but different ABI. I agree with Julian that it's more ergonomic to maintain the per-compiler directories for manually gc-ing build artifacts. Therefore big 👍 from me on this direction of travel. |
Anything which can be done to move this PR forwards? |
@sol thanks for putting this forward. Would it be okay for me to try and take it over the finish line? I agree with @mpickering's summary of the discussion:
|
This complements the previous commit in order to fix haskell#9326
This complements the previous commit in order to fix haskell#9326
This complements the previous commit in order to fix haskell#9326
This complements the previous commit in order to fix haskell#9326
This complements the previous commit in order to fix haskell#9326
This complements the previous commit in order to fix haskell#9326
This complements the previous commit in order to fix haskell#9326
This complements the previous commit in order to fix haskell#9326
This complements the previous commit in order to fix haskell#9326
Yes, please. |
This complements the previous commit in order to fix haskell#9326
This complements the previous commit in order to fix haskell#9326
This PR is an alternative to #9325. It changes the store path from e.g.
[...]store/ghc-9.8.1
to[..]store/ghc-9.8.1-f7d8
.[fixes #8114]