haskell / cabal

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

Haddock for crypto-api-0.13.3 fails to build with Cabal 3.10.1.0 #9060

Open mrkkrp opened 1 year ago

mrkkrp commented 1 year ago

Describe the bug Haddock for crypto-api-0.13.3 fails to build with Cabal 3.10.1.0. It appears to work with older versions of Cabal, namely with 3.8.1.0.

First observed here: https://github.com/mrkkrp/req/actions/runs/5349288540/jobs/9700788692?pr=150#step:10:356

To Reproduce

I was able to reproduce by clonning crypto-api and running cabal haddock from the root of the repo (not entirely sure that it is the same failure as on CI (see link above) but it fails as well).

Expected behavior

cabal haddock should succeed and generate Haddocks.

System information

> cabal --version
cabal-install version 3.10.1.0
compiled using version 3.10.1.0 of the Cabal library
> ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.7
ffaf1 commented 1 year ago

cabal haddock for crypto-api errors with:

haddock: internal error: /home/f/.local/state/cabal/store/ghc-9.2.8/entropy-0.4.1.10-fd9c3ea180d740ecc8140c198284179cb3cf896d39d0ffa0dc35962213abb815/share/doc/html/doc-index.json: openBinaryFile: does not exist (No such file or directory)
Error: cabal: Failed to build documentation for crypto-api-0.13.3.

lsinsg that folder:

doc-index.html  entropy.haddock  haddock-bundle.min.js  index.html  linuwial.css  meta.json  quick-jump.css  synopsis.png  System-Entropy.html

See #8326.

ffaf1 commented 1 year ago

From Haddock #1488, ~it seems it shold have been fixed and backported in GHC ≥ 9.2.4, so I wonder what is happening.~

mrkkrp commented 1 year ago

Is there a workaround?

ulysses4ever commented 1 year ago

@mrkkrp there's a delicate relationship between versions inside the ghc-cabal-haddock triad. It appears that the bug disappears on GHC 9.2 + Cabal 3.8 (but you already knew it) and on GHC 9.4+ (including 9.6) + Cabal 3.10.

ulysses4ever commented 1 year ago

@coot you contributed the original fix for this issue I believe. Do you understand why GHC 9.2 with latest patches (e.g. 9.2.8) still suffers from it but only with Cabal 3.10? And more importantly, is there anything we could do (especially on the Cabal end) to make Cabal 3.10.x work with GHC 9.2? As it stands, this issue blocks the recommended badge in ghcup; we almost agreed to put it on the upcoming 3.10.2, but not anymore after we found out that the combination of 3.10 and 9.2 is still broken...

ulysses4ever commented 1 year ago

I just checked the haddock branches and the ghc-9.2 branch doesn't have the fix from https://github.com/haskell/haddock/pull/1488 ghc-9.4 (and on, i assume) does have it. @ffaf1 where did you get the info about it being

backported in GHC ≥ 9.2.4

? (Btw, thanks a lot for looking up https://github.com/haskell/haddock/pull/1488!)

The only mystery remaining is why Cabal <3.10 works...

ffaf1 commented 1 year ago

backported in GHC ≥ 9.2.4

I don’t know what I was reading, sorry for spreading misinfo.

Depending on GHCup choices, this might be something quite important.

ulysses4ever commented 1 year ago

I used GHC 9.2.5 and crypto-api to bisect it down to https://github.com/haskell/cabal/commit/6d8adf13101c4d28fef14bdec55d485feec356fd

@coot do you think we could do something to work around this issue on Cabal's side so that soon-to-be-released Cabal 3.10.2 could work well with GHC 9.2? Otherwise, people keep bumping into it as 9.2 is very popular.

ulysses4ever commented 1 year ago

In particular, this change:

     , [ "--quickjump" | isVersion 2 19
-                      , fromFlag . argQuickJump $ args ]
+                      , _ <- flagToList . argQuickJump $ args ]
ulysses4ever commented 1 year ago

In particular, it looks like that if we change

     , [ "--quickjump" | isVersion 2 19
-                      , _ <- flagToList . argQuickJump $ args ]
+                      , True <- flagToList . argQuickJump $ args ]

just like you did in the --hyperlinked-source option going next, then crypto-api does not fail anymore. Does it sound plausible to you, @coot?

ulysses4ever commented 1 year ago

I submitted a fix as described above: https://github.com/haskell/cabal/pull/9072 #9049 beats me to it.

Hopefully, we could squeeze it into 3.10.2.

ulysses4ever commented 1 year ago

@mrkkrp do you want to check yourself that the bug is fixed on master? We have the cabal-head rolling prerelease with binaries for x64 and the 3 major systems. If you use ghcup, you could get one of the binaries using

ghcup install cabal -u https://github.com/haskell/cabal/releases/download/cabal-head/cabal-head-Linux-x86_64.tar.gz head

(replace Linux with macOS or Windows as appropriate).

coot commented 1 year ago

just like you did in the --hyperlinked-source option going next, then crypto-api does not fail anymore. Does it sound plausible to you, @coot?

Yes it makes sense.