Skip to content

Conversation

ulysses4ever
Copy link
Collaborator

@ulysses4ever ulysses4ever commented Jun 30, 2022

The problem described below was solved by nuking the store. All good now. Fixing #7462.


I hoped that implementing #7462 should be a breath. Alas, an obvious fix turns into a disfunctional cabal haddock: it keeps failing with

  67% (  2 /  3) in 'MyLib'
  Missing documentation for:
    Module header
haddock: internal error: /home/artem/.cabal/store/ghc-9.0.2/acme-cadre-0.1-084e219a2f22159b817e45921b58427b54e7a20f5f1736c7acdba987d88cc4e2/share/doc/html/doc-index.json: openBinaryFile: does not exist (No such file or directory)

For a simple project like this:

❯ cat t7462.cabal
cabal-version:      2.4
name:               t7462
version:            0.1.0.0
author:             Artem Pelenitsyn
maintainer:         [email protected]
extra-source-files: CHANGELOG.md

library
    exposed-modules:  MyLib
    build-depends:    base ^>=4.15.1.0
                    , acme-cadre
    hs-source-dirs:   src
    default-language: Haskell2010

❯ cat src/MyLib.hs 
module MyLib  where
import Acme.Cadre

-- | Some 'car' magic
someFunc :: IO ()
someFunc = putStrLn $ "someFunc" ++ (show $ car (1,2))

-- | Not very different from 'someFunc'
otherFunc :: IO ()
otherFunc = putStrLn "otherFunc"

Putting up this draft in case someone can spot the problem...


Please include the following checklist in your PR:

Please also shortly describe how you tested your change. Bonus points for added tests!

@andreasabel
Copy link
Member

@ulysses4ever : Maybe good to report this internal error upstream...

@ulysses4ever
Copy link
Collaborator Author

@andreasabel fair, but my fear is that it's my change breaking cabal is to blame, not haddock itself. Haddock complains that it can't find something in the cabal store. So I assume the change broke some invariant, which, in turn, made cabal to call haddock with a non-existent input.

I'm very surprised that the CI is green. I wonder how good its testing of cabal haddock with external dependencies is. Because for me this breaks the simplest thing with an external dep possible (as explained in the OP).

@ulysses4ever ulysses4ever added the attention: needs-help Help wanted with this issue/PR label Jul 1, 2022
@ulysses4ever
Copy link
Collaborator Author

Okay, after applying the nuclear option -- nuking the store -- I get it working fine. Time to think about a test, I guess.

@ulysses4ever ulysses4ever removed the attention: needs-help Help wanted with this issue/PR label Jul 1, 2022
@ulysses4ever ulysses4ever force-pushed the enable-doc branch 2 times, most recently from 8c7696e to 5e0802a Compare July 2, 2022 00:51
@ulysses4ever
Copy link
Collaborator Author

ulysses4ever commented Jul 3, 2022

Thanks to ffaf1, I managed a test. Should be good now.

Okay, I'm having trouble with a test.

Goal: have a package A with haddocks mentioning an entity from an external package with no HTML haddocks built. Calling cabal haddock on A would warn about missing references before this patch and otherwise (finish clean) with the patch.

The question is: how do I depend on an external package in a test? I only see examples of depending on boot packages, which all have HTML haddocks included, so not qualified for the goal. Depending on random Hackage package doesn't seem possible in a test (cabal-tests fails).

Any ideas?

@ulysses4ever ulysses4ever added the attention: needs-help Help wanted with this issue/PR label Jul 3, 2022
@ulysses4ever ulysses4ever marked this pull request as ready for review July 3, 2022 21:05
@ulysses4ever ulysses4ever removed the attention: needs-help Help wanted with this issue/PR label Jul 3, 2022
@ulysses4ever ulysses4ever force-pushed the enable-doc branch 2 times, most recently from bdecafb to ccf99e0 Compare July 4, 2022 00:06
Copy link
Member

@Mikolaj Mikolaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. How about a changelog file?

@ulysses4ever
Copy link
Collaborator Author

@Mikolaj forgot to stage it... fixed.

Copy link
Member

@Mikolaj Mikolaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thank you.

@ulysses4ever ulysses4ever force-pushed the enable-doc branch 2 times, most recently from da68c28 to d633250 Compare July 4, 2022 15:48
@ulysses4ever ulysses4ever marked this pull request as draft July 4, 2022 15:52
@ulysses4ever
Copy link
Collaborator Author

ulysses4ever commented Jul 4, 2022

Oh, I messed up git branches. Will take some time to recover, it seems. All good now.

@ulysses4ever ulysses4ever linked an issue Jul 4, 2022 that may be closed by this pull request
@ulysses4ever ulysses4ever marked this pull request as ready for review July 4, 2022 16:00
@Mikolaj Mikolaj requested a review from Kleidukos July 6, 2022 08:21
@ulysses4ever ulysses4ever added merge me Tell Mergify Bot to merge and removed attention: needs-review labels Jul 6, 2022
where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
cliConfig = commandLineFlagsToProjectConfig globalFlags flags mempty -- ClientInstallFlags, not needed here
flags' = flags { installFlags = installFlags { installDocumentation = Flag True } }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be that this unconditional setting leads to --disable-doc being ignored?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think you're right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attention: needs-backport in the future e.g., to a point release after the main release cabal-install: cmd/haddock merge me Tell Mergify Bot to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: enable --enable-documentation by default

4 participants