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

cabal install uses wrong internal library #6211

Closed
phadej opened this issue Aug 27, 2019 · 6 comments
Closed

cabal install uses wrong internal library #6211

phadej opened this issue Aug 27, 2019 · 6 comments

Comments

@phadej
Copy link
Collaborator

phadej commented Aug 27, 2019

Describe the bug

Even there are changes, somehow v2-install from local repository reuses old dependencies

To Reproduce

Take a package with internal library

$ cabal v2-install
.. edit package
$ cabal v2-install

You either get old behaviour, old build failure.

Expected behavior

The new stuff is build and installed.

System informataion

  • cabal-install-3.0

Additional context

I'm not sure whether this due hash, or some other mistake in dependency tracking.


E.g. in master, i.e. before change, install -v2 prints:

Component graph for cabal-fmt-0.1.1:
    component lib:cabal-fmt-internal
    component exe:cabal-fmt dependency lib:cabal-fmt-internal
component cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463
    include Cabal-3.0.0.0-de156fe8b3b8feb6c7f64eb52f208b7864ffac76cacc437fbd1e9a9f1d60784c
    include base-4.12.0.0
    include bytestring-0.10.8.2
    include containers-0.6.0.1
    include directory-1.3.3.0
    include filepath-1.4.2.1
    include mtl-2.2.2
    include parsec-3.1.13.0
    include pretty-1.1.3.6
unit cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463
    include Cabal-3.0.0.0-de156fe8b3b8feb6c7f64eb52f208b7864ffac76cacc437fbd1e9a9f1d60784c
    include base-4.12.0.0
    include bytestring-0.10.8.2
    include containers-0.6.0.1
    include directory-1.3.3.0
    include filepath-1.4.2.1
    include mtl-2.2.2
    include parsec-3.1.13.0
    include pretty-1.1.3.6
    CabalFmt=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt,CabalFmt.Comments=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Comments,CabalFmt.Error=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Error,CabalFmt.Fields=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Fields,CabalFmt.Fields.BuildDepends=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Fields.BuildDepends,CabalFmt.Fields.Extensions=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Fields.Extensions,CabalFmt.Fields.Modules=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Fields.Modules,CabalFmt.Fields.TestedWith=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Fields.TestedWith,CabalFmt.Monad=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Monad,CabalFmt.Options=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Options,CabalFmt.Parser=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Parser,CabalFmt.Pragma=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Pragma,CabalFmt.Refactoring=cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463:CabalFmt.Refactoring
component cabal-fmt-0.1.1-7eaac8e9e978c6a31b66c3e6aa293efe24aaca3fe871069c7940e4f3d991008a
    include base-4.12.0.0
    include bytestring-0.10.8.2
    include cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463
    include directory-1.3.3.0
    include filepath-1.4.2.1
    include optparse-applicative-0.15.0.0-9c16c7a8d6f94fd14084ef31fdd503cb9927585e0cf7cbda549fc5d14ecb6746
unit cabal-fmt-0.1.1-7eaac8e9e978c6a31b66c3e6aa293efe24aaca3fe871069c7940e4f3d991008a
    include base-4.12.0.0
    include bytestring-0.10.8.2
    include cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463
    include directory-1.3.3.0
    include filepath-1.4.2.1
    include optparse-applicative-0.15.0.0-9c16c7a8d6f94fd14084ef31fdd503cb9927585e0cf7cbda549fc5d14ecb6746
Up to date
creating /tmp/cabal-install.-98186/dist-newstyle/build
creating /tmp/cabal-install.-98186/dist-newstyle/tmp
creating /cabal/bin
Symlinking 'cabal-fmt'

Then I change branch to one with changes in both cabal-fmt-internal and cabal-fmt:

Component graph for cabal-fmt-0.1.1:
    component lib:cabal-fmt-internal
    component exe:cabal-fmt dependency lib:cabal-fmt-internal
component cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e
    include Cabal-3.0.0.0-de156fe8b3b8feb6c7f64eb52f208b7864ffac76cacc437fbd1e9a9f1d60784c
    include base-4.12.0.0
    include bytestring-0.10.8.2
    include containers-0.6.0.1
    include directory-1.3.3.0
    include filepath-1.4.2.1
    include mtl-2.2.2
    include parsec-3.1.13.0
    include pretty-1.1.3.6
unit cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e
    include Cabal-3.0.0.0-de156fe8b3b8feb6c7f64eb52f208b7864ffac76cacc437fbd1e9a9f1d60784c
    include base-4.12.0.0
    include bytestring-0.10.8.2
    include containers-0.6.0.1
    include directory-1.3.3.0
    include filepath-1.4.2.1
    include mtl-2.2.2
    include parsec-3.1.13.0
    include pretty-1.1.3.6
    CabalFmt=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt,CabalFmt.Comments=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Comments,CabalFmt.Error=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Error,CabalFmt.Fields=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Fields,CabalFmt.Fields.BuildDepends=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Fields.BuildDepends,CabalFmt.Fields.Extensions=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Fields.Extensions,CabalFmt.Fields.Modules=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Fields.Modules,CabalFmt.Fields.TestedWith=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Fields.TestedWith,CabalFmt.Monad=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Monad,CabalFmt.Options=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Options,CabalFmt.Parser=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Parser,CabalFmt.Pragma=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Pragma,CabalFmt.Refactoring=cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e:CabalFmt.Refactoring
component cabal-fmt-0.1.1-080ab3d5644ced2b698c50f756fddd9991e679713d3214f75581f130e3990a04
    include base-4.12.0.0
    include bytestring-0.10.8.2
    include cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e
    include directory-1.3.3.0
    include filepath-1.4.2.1
    include optparse-applicative-0.15.0.0-9c16c7a8d6f94fd14084ef31fdd503cb9927585e0cf7cbda549fc5d14ecb6746
unit cabal-fmt-0.1.1-080ab3d5644ced2b698c50f756fddd9991e679713d3214f75581f130e3990a04
    include base-4.12.0.0
    include bytestring-0.10.8.2
    include cabal-fmt-0.1.1-6f9e87805312081064f32c6d066fafa6bb1e489e70c93ffbf9a22460f479c13e
    include directory-1.3.3.0
    include filepath-1.4.2.1
    include optparse-applicative-0.15.0.0-9c16c7a8d6f94fd14084ef31fdd503cb9927585e0cf7cbda549fc5d14ecb6746
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built:
 - cabal-fmt-0.1.1 (exe:cabal-fmt) (requires build)

but cabal-fmt-0.1.1-080ab3d5644ced2b698c50f756fddd9991e679713d3214f75581f130e3990a04 is not compiled:

I see command:

/opt/ghc/bin/ghc --make -no-link -fbuilding-cabal-package -O -static -outputdir dist/build/cabal-fmt/cabal-fmt-tmp -odir dist/build/cabal-fmt/cabal-fmt-tmp -hidir dist/build/cabal-fmt/cabal-fmt-tmp -stubdir dist/build/cabal-fmt/cabal-fmt-tmp -i -idist/build/cabal-fmt/cabal-fmt-tmp -icli -idist/build/cabal-fmt/autogen -idist/build/global-autogen -Idist/build/cabal-fmt/autogen -Idist/build/global-autogen -Idist/build/cabal-fmt/cabal-fmt-tmp -optP-include -optPdist/build/cabal-fmt/autogen/cabal_macros.h -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /cabal/store/ghc-8.6.5/package.db -package-db dist/package.conf.inplace -package-id base-4.12.0.0 -package-id bytestring-0.10.8.2 -package-id cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463 -package-id directory-1.3.3.0 -package-id filepath-1.4.2.1 -package-id optparse-applicative-0.15.0.0-9c16c7a8d6f94fd14084ef31fdd503cb9927585e0cf7cbda549fc5d14ecb6746 -XHaskell2010 Paths_cabal_fmt cli/Main.hs -hide-all-packages -Wall

Note: -package-id cabal-fmt-0.1.1-bc3a8918cef372e66e690a735fe69b08c73bb0be40f3572dd9c25b81b4905463 which is from before branch change!

@phadej phadej changed the title Cabal calculates the hash of internal libraries wrong cabal install uses wrong internal library Aug 27, 2019
@phadej
Copy link
Collaborator Author

phadej commented Aug 27, 2019

One can try to reproduce using git@github.com:phadej/cabal-fmt.git and commits
59387f9515aa678fd59ddc426591a2b65c867e95 and cdc1fe60ab5229dd948981f7c95ef776ed7a42f2

@phadej
Copy link
Collaborator Author

phadej commented Aug 27, 2019

Also additional note: removing dist-newstyle (or not having it at all) doesn't seem to help. As far as you first v2-install one revision, and then try to install other one. (with the same version number).

@hvr
Copy link
Member

hvr commented Aug 29, 2019

for the record; I briefly discussed this with @phadej but I couldn't reproduce this one yet myself

@grayjay
Copy link
Collaborator

grayjay commented Sep 23, 2019

This issue sounds similar to #5782, since it also involves using an old version of an internal library with cabal install.

@jneira
Copy link
Member

jneira commented Jan 17, 2020

As a workaround, to be able to build and install cabal-helperin azure, i've setup azure ci to use a store-dir for build commands and other for install. They dont reuse dependencies anyway so afaiu there is no penalty in build time and disk space.

fendor added a commit to fendor/cabal-helper that referenced this issue Feb 8, 2020
Private libraries have a bunch of bugs in cabal currently:
* haskell/cabal#6211
* haskell/cabal#6483

and devs of haskell-ide-engine are encountering this bug frequently.
To mitigate this issue, remove usage of private libraries and use
a common stanza to have the same re-use as before.

This change can be undone when the mentioned issues have been resolved.
fendor added a commit to fendor/cabal-helper that referenced this issue Feb 8, 2020
Private libraries have a bunch of bugs in cabal currently:
* haskell/cabal#6211
* haskell/cabal#6483

and devs of haskell-ide-engine are encountering this bug frequently.
To mitigate this issue, remove usage of private libraries and use
a common stanza to have the same re-use as before.

This change can be undone when the mentioned issues have been resolved.
DanielG pushed a commit to DanielG/cabal-helper that referenced this issue Feb 8, 2020
Private libraries have a bunch of bugs in cabal currently:
* haskell/cabal#6211
* haskell/cabal#6483

and devs of haskell-ide-engine are encountering this bug frequently.
To mitigate this issue, remove usage of private libraries and use
a common stanza to have the same re-use as before.

This change can be undone when the mentioned issues have been resolved.
DanielG pushed a commit to DanielG/cabal-helper that referenced this issue Feb 8, 2020
Private libraries have a bunch of bugs in cabal currently:
* haskell/cabal#6211
* haskell/cabal#6483

and devs of haskell-ide-engine are encountering this bug frequently.
To mitigate this issue, remove usage of private libraries and use
a common stanza to have the same re-use as before.

This change can be undone when the mentioned issues have been resolved.
marcin-rzeznicki added a commit to marcin-rzeznicki/stackcollapse-ghc that referenced this issue May 22, 2020
Unfortunately there are lot of things that private libraries break: hie, stack repl etc.
There are bugs that need to be solved before this can be used:
 - commercialhaskell/stack#4564
 - haskell/haskell-ide-engine#1535
 - haskell/cabal#6211
@Mikolaj
Copy link
Member

Mikolaj commented May 7, 2021

I think this is fixed in cabal 3.4. Please report if you repro with 3.4 or newer cabals. In any case, closing as a duplicate of #5782.

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

5 participants