Reputation: 796
I've seen this message pop up a couple times when running cabal v1-install
with a suggestion to use --force-reinstalls
to install anyway. As I don't know that much about cabal, I'm not sure why a package would break due to a reinstall. Could someone please fill me in on the backstory behind this message?
Upvotes: 2
Views: 142
Reputation: 34378
Note for future readers: this discussion is about historical matters. For practical purposes, you can safely ignore all of that if you are using Cabal 3.
The problem had to do with transitive dependencies. For instance, suppose we had the following three packages installed at specific versions:
A-1.0
;B-1.0
, which depends on A
; andC-1.0
, which depends on B
, but not explicitly on A
.Then, we would install A-1.1
, which seemingly would work fine:
A-1.1
would be installed, but the older A-1.0
version would be kept around, solely for the sake of other packages built using it;B-1.0
would keep using A-1.0
; andC-1.0
would keep using B-1.0
.However, there would be trouble if we, for whatever reason, attempted to reinstall B-1.0
(as opposed to, say, update to B-1.1
):
A-1.1
and A-1.0
would still be available for other packages needing them;B-1.0
, however, would be rebuilt against A-1.1
, there being no way of keeping around a second installation of the same version of B
; andC-1.0
, which was built against the replaced B-1.0
(which depended on A-1.0
), would now be broken.v1-install
provided a safeguard against this kind of dangerous reinstall. Using --force-reinstalls
would disable that safeguard.
For a detailed explanation of the surrounding issues, see Albert Y. C. Lai's Storage and Identification of Cabalized Packages (in particular, the example I used here is essentially a summary of its Corollary: The Pigeon Drop Con section).
While Cabal 1, in its later versions, was able to, in the scenario above, detect that the reinstall changed B
even though the version number remained the same (which is what made the safeguard possible), it couldn't keep around the two variants of B-1.0
simultaneously. Cabal 3, on the other hand, is able to do that, which eliminates the problem.
Upvotes: 2