-
Notifications
You must be signed in to change notification settings - Fork 843
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
Building a specific target can cause bad state #2904
Comments
I believe this use case was covered with
|
It looks like But the issue still exists: |
I can indeed reproduce this, and I agree that it's a bug. Marking it as a P1 issue since it violates consistency that ought to be there. |
This reminds me of haskell/cabal#2830. And in fact I'm seeing something very similar. When I do the initial
If I modified the This is really a Cabal or GHC bug (it should generate unique package IDs if the package contents change). A simple workaround would be to aggressively unregister all users of a package when unregistering the dependency. |
The previous commit (fixing #2904) made the Maybe layer confusing and error-prone. It was too easy to end up accidentally skipping an unregister based on the two levels of Maybe wrapping. This simplifies the codebase, without any change in behavior. It would be even nicer to be able to prove statically that we always generate a dirty reason.
Please see #3047, which should fix this. |
It looks like Cabal is using the package key as the package id as well. The key depends only on the dependencies of the build, not the output, which would explain this bug. I'll try to repro against latest cabal and report upstream. |
…ister Aggressive unregister for #2904
Fixed by #3047. Cabal is saying what I thought they would: the meaning of package IDs has changed. I'm not too happy with that, but as usual we have no control over such things. |
(Using stack-1.3.2 on Arch Linux)
Steps to reproduce
Clone this sample project with two libraries: LibA, and LibB which depends on LibA.
Build with
stack build
, and run withstack exec lib-a-exe
andstack exec lib-b-exe
.Next, change a function (named
value
) in LibA, and rebuild LibA only usingstack build lib-a
. Nowlib-a-exe
uses the updated function, butlib-b-exe
still uses the old one, as expected.Now try to rebuild LibB with
stack build lib-b
orstack build
.Expected
stack should update (relink?) LibB to use the new version of LibA.
Actual
stack never rebuilds LibB, causing it to forever use the old LibA.
This was suprising for me, because I thought
stack build lib-a && stack build lib-b
was equivalent tostack build
. Instead, I found out it can result in a bad state where LibB is never rebuilt, forcing me to use one of these workarounds:Workaround
After making a change in LibA and running
stack build lib-a
, either:lib-b/.stack-work
.Alternatively, never build a specific target (e.g.
stack build lib-a
) in the first place. Always runstack build
to build all targets.The text was updated successfully, but these errors were encountered: