Skip to content

cabal build fails with warning, return code 0 when failing to build dependency documentation #7517

@robx

Description

@robx

Describe the bug

When calling cabal build on a project with:

  • a dependency some-lib with malformatted haddock comments
  • a cabal.project that asks for documentation to be built for all packages

the command fails pretty unclearly with a "Warning" and zero exit code.

To Reproduce
(I had a pretty messy concrete example, this is breaking it down to what
I believe is a minimal case, but I haven't actually verified this live.)

$ cd /src/some-lib
$ cabal v2-haddock
...
cabal: Failed to build documentation for some-lib-0.1
$ cd /src/main-proj
$ cat cabal.project.local
package *
  documentation: true
$ cabal v2-build
In order, the following will be built (use -v for more details):
 - some-lib-0.1 (lib:some-lib) (requires build)
 - main-proj-0.1 (lib) (first run)
Starting     some-lib-0.1 (all, legacy fallback)
Building     some-lib-0.1 (all, legacy fallback)
Haddock      some-lib-0.1 (all, legacy fallback)
Warning: Failed to build documentation for some-lib-0.1 (which is required by main-proj-0.1).
$ echo $?
0

Expected behavior

cabal build should fail explicitly with an error. I.e., output Error: instead of Warning: , and exit with a non-zero code.

System information

  • Operating system: macos
  • cabal version 3.4.0.0
  • ghc 8.10.2

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