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

install --lib can create inconsistent environments when dependencies are involved #9582

Open
fgaz opened this issue Jan 2, 2024 · 2 comments

Comments

@fgaz
Copy link
Member

fgaz commented Jan 2, 2024

Describe the bug

install --lib can create inconsistent environments when packages are installed one by one (ie. when an environment is modified). This was fixed for the case of explicitly installed packages, but not for dependencies.

To Reproduce
Steps to reproduce the behavior:

foo depends on bar. Constraints simulate the evolution of the index.

$ cabal install --lib foo --constraint=bar==1

Now suppose a function f from foo returns/takes a type from bar. I install bar so I can interact with f:

$ cabal install --lib bar --constraint=bar==2

Poof, inconsistent environment. The two instances of bar don't match.
The second command succeeds because bar is not explicitly in the environment.

Expected behavior

One of

System information

  • NixOS 23.11
  • GHC 9.4.8
  • cabal 12223d7

Additional context
Add any other context about the problem here.

@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Jan 2, 2024

Poof, inconsistent environment.

Could you explain what is wrong with the resulting environment, explicitly? It’s not clear to me. There are two problems. First, we don’t have a formal definition of an inconsistent environment, and it’s good to explain what exactly is meant here. Second, you don’t explain how the running example is “inconsistent” given the definition that you will have when address the first point.

@gbaz
Copy link
Collaborator

gbaz commented Jan 2, 2024

Could you explain what is wrong with the resulting environment, explicitly?

Suppose I install foo depending on one version of containers and foo has a function that outputs a Set. But I can't work with that set because containers isn't yet installed itself (as an entry in the env file). Ok, so I install containers but now the solver gives me a different version. Now, the installed containers can't work with the result of that function in foo.

I noticed this problem here btw and suggested one approach: #8607 (comment)

But I'm wondering now if recording the hashes of all the transitive deps in the env file might be the more appropriate thing to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants