Skip to content

cabal new-haddock regression (setup: internal error when calculating transitive package dependencies.) #5423

Open
@RyanGlScott

Description

@RyanGlScott

I originally noticed this issue when trying to upgrade singletons' Travis setup to use cabal-install-head. That is:

$ /opt/cabal/head/bin/cabal --version
cabal-install version 2.3.0.0
compiled using version 2.3.0.0 of the Cabal library

I've prepared a more minimal reproduction at https://github.com/RyanGlScott/cabal-gh5423. To reproduce the issue, do the following:

$ git clone https://github.com/RyanGlScott/cabal-gh5423
$ cd cabal-gh5423/
$ /opt/cabal/head/bin/cabal new-haddock cabal-gh5423:tests
Resolving dependencies...
Build profile: -w ghc-8.4.3 -O1
In order, the following will be built (use -v for more details):
 - cabal-gh5423-0.1 (first run)
[1 of 1] Compiling Main             ( /home/rgscott/Documents/Hacking/Haskell/cabal-gh5423/dist-newstyle/build/x86_64-linux/ghc-8.4.3/cabal-gh5423-0.1/setup/setup.hs, /home/rgscott/Documents/Hacking/Haskell/cabal-gh5423/dist-newstyle/build/x86_64-linux/ghc-8.4.3/cabal-gh5423-0.1/setup/Main.o )
Linking /home/rgscott/Documents/Hacking/Haskell/cabal-gh5423/dist-newstyle/build/x86_64-linux/ghc-8.4.3/cabal-gh5423-0.1/setup/setup ...
Configuring cabal-gh5423-0.1...
Found dependency closure
Preprocessing library for cabal-gh5423-0.1..
Running Haddock on library for cabal-gh5423-0.1..
Haddock coverage:
   0% (  0 /  1) in 'CabalSandbox'
  Missing documentation for:
    Module header
Documentation created:
/home/rgscott/Documents/Hacking/Haskell/cabal-gh5423/dist-newstyle/build/x86_64-linux/ghc-8.4.3/cabal-gh5423-0.1/doc/html/cabal-gh5423/index.html
Preprocessing test suite 'cabal-gh5423-tests' for cabal-gh5423-0.1..
Running Haddock on test suite 'cabal-gh5423-tests' for cabal-gh5423-0.1..
setup: internal error when calculating transitive package dependencies.
Debug info: []

cabal: Failed to build documentation for cabal-gh5423-0.1.

cabal-gh5423 is a package with a library, test suite, and custom-setup script that looks like:

module Main (main) where

import Distribution.PackageDescription
import Distribution.Simple
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.PackageIndex

main :: IO ()
main = defaultMainWithHooks simpleUserHooks
  { haddockHook = \pkg lbi hooks flags -> do
      blah pkg lbi
      haddockHook simpleUserHooks pkg lbi hooks flags
  }

blah :: PackageDescription -> LocalBuildInfo -> IO ()
blah pkg lbi =
  withLibLBI pkg lbi $ \_ libCLBI -> do
    let libDeps = map fst $ componentPackageDeps libCLBI
    case dependencyClosure (installedPkgs lbi) libDeps of
      Left p  -> p `seq` putStrLn "Found dependency closure"
      Right _ -> error "Broken dependency closure"

(In reality, singletons actually uses the computed dependency closure for something useful, but I've elided this for the sake of keeping things simple.)

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