Skip to content

cabal install uses wrong internal library #6211

Closed

Description

@phadej

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!

Activity

  1. changed the title [-]Cabal calculates the hash of internal libraries wrong[/-] [+]cabal install uses wrong internal library[/+] on Aug 27, 2019
  2. phadej commented on Aug 27, 2019

    @phadej
    CollaboratorAuthor

    One can try to reproduce using [email protected]:phadej/cabal-fmt.git and commits
    59387f9515aa678fd59ddc426591a2b65c867e95 and cdc1fe60ab5229dd948981f7c95ef776ed7a42f2

  3. phadej commented on Aug 27, 2019

    @phadej
    CollaboratorAuthor

    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).

  4. hvr commented on Aug 29, 2019

    @hvr
    Member

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

  5. sebright commented on Sep 23, 2019

    @sebright
    Collaborator

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

  6. jneira commented on Jan 17, 2020

    @jneira
    Member

    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.

  7. Mikolaj commented on May 7, 2021

    @Mikolaj
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions