haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.62k stars 691 forks source link

Assertion failure on `cabal build/haddock --enable-doc` #8313

Open andreasabel opened 2 years ago

andreasabel commented 2 years ago

Using GHC 9.2.3 and cabal master:

$ cabal haddock --haddock-for-hackage --enable-doc
Warning: this is a debug build of cabal-install with assertions enabled.
Resolving dependencies...
Build profile: -w ghc-9.2.3 -O0
In order, the following will be built (use -v for more details):
 - OneTuple-0.3.1 (lib) (requires build)
 ...
 - generically-0.1 (lib) (requires build)
Assertion failed
CallStack (from HasCallStack):
  assert, called at src/Distribution/Client/ProjectPlanning.hs:246:5 in cabal-install-3.9.0.0-inplace:Distribution.Client.ProjectPlanning

Also triggered by cabal build --enable-doc.

It is this assertion https://github.com/haskell/cabal/blob/23536274bb7baabe5c33140620471e897cf34cf2/cabal-install/src/Distribution/Client/ProjectPlanning.hs#L242-L248

Here is the packed up directory in which I can reproduce the bug: cabal-assertion-failed.zip (I hope it can be reproduced even without my .cabal directory...)

Mikolaj commented 2 years ago

Possibly related: #6659, #6006 and the tickets mentioned in the latter.

andreasabel commented 2 years ago

Indeed, looks like #6006. The new thing is that even a plain cabal haddock fails, since it includes --enable-documentation by default now.

andreasabel commented 2 years ago

Could we have a flag --ingore-assertions to force cabal to continue?

Mikolaj commented 2 years ago

Could we have a flag --ingore-assertions to force cabal to continue?

We'd need our own assert, but yes, should not be hard. This is in a dev build with assertions enabled, right? Not 3.8RC1?

andreasabel commented 2 years ago

This is in a dev build with assertions enabled, right? Not 3.8RC1?

Yes, it is 3.9.0.0.

ulysses4ever commented 2 years ago

Fail to repro with the current master (dd312ec). It does reproduces still.

andreasabel commented 2 years ago

Fail to repro with the current master (dd312ec).

@ulysses4ever : I can reproduce this with latest master and also GHC 9.2.4. Did you unzip my project and tried it there?

ulysses4ever commented 2 years ago

I tried to build OneTuple and generically. What is "your project"?

ulysses4ever commented 2 years ago

Oh, sorry, now I see it

mpickering commented 11 months ago

I have tracked down the failure to the setDocumentation function in pruneInstallPlanPass1.

The essential issue is that pruneInstallPlanPass1 can't modify anything in an elaborated package which affects the hash, and by disabling documentation at this point you affect the hash of the package.