haskell / haskell/cabal

new-haddock always fails on GHC 7.10.3/7.2.2/7.0.4 for Custom setup packages when Haddock is not on the PATH

Open
#6,214 8 comments 0 reactions 0 assignees View on GitHub
cabal-install: cmd/haddock Cabal: custom Cabal: stanza/custom-setup
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
Attempting to run `new-haddock` on any package that uses `build-type: Custom` will result in an error when:

* One uses GHC 7.10.3, 7.2.2, or 7.0.4. (I'm not sure why only these versions of GHC are affected, but they are.)
* The `haddock` executable is not on one's `PATH`.

**To Reproduce**
First, make sure that `haddock` is not on your `PATH`:

```
$ type haddock
-bash: type: haddock: not found
```

Next, grab your favorite package that uses `build-type: Custom`. I prefer [`lca`](https://github.com/ekmett/lca), as it has very minimal dependencies:

```
$ git clone https://github.com/ekmett/lca lca
$ cd lca/
$ git reset --hard e9e15d8c4e3f28f3f35f560e2e1a669b9c9fb3df # For reproducibility
```

Now run `new-haddock`:

```
$ /opt/cabal/3.0/bin/cabal new-haddock -w /opt/ghc/7.10.3/bin/ghc
Resolving dependencies...
Build profile: -w ghc-7.10.3 -O1
In order, the following will be built (use -v for more details):
- lca-0.3.1 (first run)
[1 of 1] Compiling Main ( /home/rgscott/Documents/Hacking/Haskell/travis-maintenance/checkout/ekmett/lca/dist-newstyle/build/x86_64-linux/ghc-7.10.3/lca-0.3.1/setup/setup.hs, /home/rgscott/Documents/Hacking/Haskell/travis-maintenance/checkout/ekmett/lca/dist-newstyle/build/x86_64-linux/ghc-7.10.3/lca-0.3.1/setup/Main.o )
Linking /home/rgscott/Documents/Hacking/Haskell/travis-maintenance/checkout/ekmett/lca/dist-newstyle/build/x86_64-linux/ghc-7.10.3/lca-0.3.1/setup/setup ...
Warning: lca.cabal: Ignoring unknown section type: custom-setup
Configuring lca-0.3.1...
Running Haddock for lca-0.3.1...
setup: The program 'haddock' version >=2.0 is required but it could not be
found.
cabal: Failed to build documentation for lca-0.3.1.

$ echo $?
1
```

**Expected behavior**
I would expect the Haddocks to build, like they do when I use GHC 8.8.1 instead:

```
$ /opt/cabal/3.0/bin/cabal new-haddock -w /opt/ghc/8.8.1/bin/ghc
Resolving dependencies...
Build profile: -w ghc-8.8.1 -O1
In order, the following will be built (use -v for more details):
- lca-0.3.1 (first run)
[1 of 1] Compiling Main ( /home/rgscott/Documents/Hacking/Haskell/travis-maintenance/checkout/ekmett/lca/dist-newstyle/build/x86_64-linux/ghc-8.8.1/lca-0.3.1/setup/setup.hs, /home/rgscott/Documents/Hacking/Haskell/travis-maintenance/checkout/ekmett/lca/dist-newstyle/build/x86_64-linux/ghc-8.8.1/lca-0.3.1/setup/Main.o )
Linking /home/rgscott/Documents/Hacking/Haskell/travis-maintenance/checkout/ekmett/lca/dist-newstyle/build/x86_64-linux/ghc-8.8.1/lca-0.3.1/setup/setup ...
Configuring lca-0.3.1...
Preprocessing library for lca-0.3.1..
Running Haddock on library for lca-0.3.1..
Haddock coverage:
100% ( 2 / 2) in 'Data.LCA.View'
100% ( 16 / 16) in 'Data.LCA.Online.Naive'
100% ( 24 / 24) in 'Data.LCA.Online.Monoidal'
100% ( 16 / 16) in 'Data.LCA.Online'
Documentation created:
/home/rgscott/Documents/Hacking/Haskell/travis-maintenance/checkout/ekmett/lca/dist-newstyle/build/x86_64-linux/ghc-8.8.1/lca-0.3.1/doc/html/lca/index.html
```

**System informataion**
- 64-bit Ubuntu Linux
- ```
$ /opt/cabal/3.0/bin/cabal --version
cabal-install version 3.0.0.0
compiled using version 3.0.0.0 of the Cabal library
```

**Additional context**
Note that this problem "did not happen" on `cabal-install-2.4` because the error code was swallowed (due to #5977).

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `cabal new-haddock` with the `lca` package, a Custom setup, GHC 7.10.3, 7.2.2, or 7.0.4, and no `haddock` on PATH. Trace the `new-haddock` handling for Custom setup packages and compare it with GHC 8.8.1 behavior. Done means Haddock builds successfully without requiring a separate PATH executable, while preserving the expected failure behavior when appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.