Skip to content

Pretty-printer loses necessary quotes in ghc-options #2661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
peti opened this issue Jun 17, 2015 · 3 comments
Closed

Pretty-printer loses necessary quotes in ghc-options #2661

peti opened this issue Jun 17, 2015 · 3 comments

Comments

@peti
Copy link
Collaborator

peti commented Jun 17, 2015

The Cabal file http://hackage.haskell.org/package/serversession-backend-persistent-1.0/serversession-backend-persistent.cabal defines the following ghc-options flags:

ghc-options:     -Wall -threaded "-with-rtsopts=-N -s -M1G -c" -rtsopts

When round-tripped through the Cabal library, however, the outcome will be:

ghc-options: -Wall -threaded -with-rtsopts=-N -s -M1G -c -rtsopts

The quotation marks -- which are essential for the build to succeed -- are lost.

To reproduce this error, process the Cabal file given above with the following code:

import Distribution.PackageDescription.Parse
import Distribution.PackageDescription.PrettyPrint
import Distribution.Verbosity
import System.Environment

main :: IO ()
main = getArgs >>= mapM_ (\cabalFile -> readPackageDescription silent cabalFile >>= writeGenericPackageDescription cabalFile)

This error occurs with Cabal-1.22.2.0, but older versions (like Cabal 1.20.x) seem to have the same issue.

@peti
Copy link
Collaborator Author

peti commented Jan 7, 2017

This bug is still present in current Git versions of Cabal 1.25.0.0. 😞

@sopvop
Copy link
Collaborator

sopvop commented Jan 10, 2017

I think this is a the relevant line for Parsec based parser.
And this one is for current parser.
I think conditionally Showing each arg as a haskell string on any isSpace predicate should fix this problem.

@23Skidoo
Copy link
Member

/cc @phadej

@phadej phadej closed this as completed in 2d2acd8 Oct 15, 2017
phadej added a commit that referenced this issue Oct 15, 2017
Fixes #2661. Add a regression test, issue is already fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants