Skip to content

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

Open

Description

@fgaz

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.

Activity

  1. ulysses4ever commented on Jan 2, 2024

    @ulysses4ever
    Collaborator

    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.

  2. gbaz commented on Jan 2, 2024

    @gbaz
    Collaborator

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions