Skip to content

ghc-pkg dump unexpected line wrapping change between ghc 8.6 and 8.8

Summary

Line wrapping and alignments somehow changed when calling ghc-pkg dump between ghc 8.6 and 8.8.

This breaks naive parsers of the ghc-pkg dump output. For example: https://github.com/tweag/rules_haskell/issues/1165

Steps to reproduce

I'm using nix to install ghc 8.6 and 8.8 with the hackage package data-default-instances-old-locale which have a long name.

Here I'm dumping two package databases:

$ nix-shell -p "haskell.packages.ghc865.ghcWithPackages(p: [p.data-default-instances-old-locale])"
[nix-shell:~]$ ghc-pkg dump > pkg865
$ nix-shell -p "haskell.packages.ghc881.ghcWithPackages(p: [p.data-default-instances-old-locale])"
[nix-shell:~]$ ghc-pkg dump > pkg881

And here I'm comparing the outputs around the data-default-instances-old-locale id entries:

$ cat pkg865| grep -A5 'name:.*data-default-instances-old-locale'                        
name: data-default-instances-old-locale
version: 0.0.1
id: data-default-instances-old-locale-0.0.1-GRzcBvmea5LLGj3CNDMpIw
key: data-default-instances-old-locale-0.0.1-GRzcBvmea5LLGj3CNDMpIw
license: BSD-3-Clause
maintainer: <l.mai@web.de>
$ cat pkg881| grep -A5 'name:.*data-default-instances-old-locale'
name:                 data-default-instances-old-locale
version:              0.0.1
visibility:           public
id:
    data-default-instances-old-locale-0.0.1-26yQMJ7x0xCF8E8NsOHD2F

Please observe that the fields are now aligned and that a newline is inserted inside the id field description.

Expected behavior

Behavior should not change, or we need a way to disable line wrapping and "fancy" formatting. The output of ghc-pkg is supposed to be consumed by tools and should be as stable and predictable as possible.

Environment

  • GHC version used: 8.6.5 and 8.8.1

Optional:

  • Operating System: Linux
  • System Architecture: x86_64
Edited by Guillaume Bouchard
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information