Skip to content

Cabal check incorrectly assumes package has -Wall -Werror #8257

@turion

Description

@turion

Describe the bug

In some cases (I believe when ghc-options: -Werror is given), cabal check reports a warning about 'ghc-options: -Wall -Werror', although -Wall is not set. This makes it, for example, impossible to upload such a package to hackage (see haskell/hackage-server#1088).

To Reproduce
Steps to reproduce the behavior:

$ mkdir tmp
$ cd tmp
$ cabal init
$ echo "    ghc-options: -W -Werror" >> tmp.cabal
$ cabal check
Warning: These warnings may cause trouble when distributing the package:
Warning: No 'category' field.
Warning: The following errors will cause portability problems on other
environments:
Warning: No 'synopsis' or 'description' field.
Warning: The 'license' field is missing or is NONE.
Warning: 'ghc-options: -Wall -Werror' makes the package very easy to break
with future GHC versions because new GHC versions often add new warnings. Use
just 'ghc-options: -Wall' instead. Alternatively, if you want to use this,
make it conditional based on a Cabal configuration flag (with 'manual: True'
and 'default: False') and enable that flag during development.
Warning: Hackage would reject this package.

Let us disregard the warnings about the missing fields, those are fine. I'm worried about Warning: 'ghc-options: -Wall -Werror' makes the package very easy to break [...].

Expected behavior

Either no warning, or a correct warning message (e.g. warning about -Werror together with any enabled warning flag). I think it's fairer to have no warning here. -W -Werror is less likely to break in future GHC versions than -Wall -Werror, and should be allowed. (Maybe even good practice.)

System information

  • Operating system: NixOS unstable
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.0.2

$ cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.3.0 of the Cabal library 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions