cabal icon indicating copy to clipboard operation
cabal copied to clipboard

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

Open andreasabel opened this issue 3 years ago • 9 comments

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

andreasabel avatar Jul 23 '22 09:07 andreasabel

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

Mikolaj avatar Jul 23 '22 09:07 Mikolaj

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

andreasabel avatar Jul 23 '22 09:07 andreasabel

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

andreasabel avatar Jul 23 '22 09:07 andreasabel

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?

Mikolaj avatar Jul 23 '22 09:07 Mikolaj

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

Yes, it is 3.9.0.0.

andreasabel avatar Jul 23 '22 09:07 andreasabel

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

ulysses4ever avatar Aug 10 '22 15:08 ulysses4ever

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?

andreasabel avatar Aug 10 '22 17:08 andreasabel

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

ulysses4ever avatar Aug 10 '22 17:08 ulysses4ever

Oh, sorry, now I see it

ulysses4ever avatar Aug 10 '22 17:08 ulysses4ever

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.

mpickering avatar Nov 13 '23 17:11 mpickering