Skip to content

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

Closed

Description

@peti

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.

Activity

  1. peti commented on Jan 7, 2017

    @peti
    CollaboratorAuthor

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

  2. sopvop commented on Jan 10, 2017

    @sopvop
    Collaborator

    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.

  3. 23Skidoo commented on Oct 15, 2017

    @23Skidoo
    Member
  4. added a commit that references this issue on Oct 15, 2017
    2d2acd8
  5. added a commit that references this issue on Oct 15, 2017
    f1a4887
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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