Skip to content

cabal.project file format is sensitive to trailing whitespace #10957

Open
@chreekat

Description

@chreekat

Describe the bug
Whitespace at the end of a line in a cabal.project file is parsed as part of the value it's attached to.

To Reproduce

[b@kuusi:~/tmp/aoeu]$ cabal init --non-interactive --exe proj
[Info] Guessing dependencies...
[Info] Using cabal specification: 3.12
[Warn] unknown license type, you must put a copy in LICENSE yourself.
[Info] Creating fresh file CHANGELOG.md...
[Info] Creating fresh directory ./app...
[Info] Creating fresh file app/Main.hs...
[Info] Creating fresh file proj.cabal...
[Warn] No synopsis given. You should edit the .cabal file and add one.
[Info] You may want to edit the .cabal file and add a Description field.


[b@kuusi:~/tmp/aoeu]$ cat > cabal.project
packages: proj
static: True 

[b@kuusi:~/tmp/aoeu]$ cabal build proj
Error: [Cabal-7090]
Error parsing project file /home/b/tmp/aoeu/cabal.project:2:
Parse of field 'static' failed (<viewAsFieldDescr>True ): True

Expected behavior
The line static: True shouldn't cause a failure, because the trailing whitespace shouldn't be parsed as part of the field's value.

System information

  • NixOS
$ cabal -V
cabal-install version 3.12.1.0
compiled using version 3.12.1.0 of the Cabal library

Additional context

#10954 , #10951

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