haskell / haskell/cabal

cabal.project parser strips quotation marks (i.e. `"`)

Open
#4,414 3 comments 0 reactions 1 assignee Claimed by @hvr View on GitHub
cabal-install: v2-build system type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

When using

cabal new-build '--ghc-option=-DGIT_DESCRIBE="foo-bar-doo-123"'

GHC gets passed `-DGIT_DESCRIBE="foo-bar-doo-123"` as expected

However, when writing that flag to `cabal.project.local` via

cabal new-configure '--ghc-option=-DGIT_DESCRIBE="foo-bar-doo-123"'

The following gets written to the `cabal.project.local` file:

program-options
ghc-options: -DGIT_DESCRIBE="foo-bar-doo-123"

However, now GHC gets passed ` -DGIT_DESCRIBE=foo-bar-doo-123` w/o the `"`s which is semantically different, as it is no longer a string-literal constant.

I also tried

program-options
ghc-options: -DGIT_DESCRIBE=\"foo-bar-doo-123\"

which results in

-DGIT_DESCRIBE=\foo-bar-doo-123\

----

TODO:

- [x] augment `splitArgs` (c.f. #4418)
- [ ] Make sure `cabal new-configure --ghc-options=...` ends up properly escaped in `cabal.project.local`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.