Skip to content
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

Fix corrupted config file header for non-ASCII package names #5804

Merged
merged 2 commits into from
Mar 4, 2019

Commits on Mar 3, 2019

  1. Fix corrupted config file header for non-ASCII package names

    The config-state header is a human readable line prepended to the
    binary serialisation which looks like
    
        Saved package config for pkgname-1.2.3 written by Cabal-2.5.0.0 using ghc-8.6
    
    However, the functions generating and parsing this header didn't take into
    account that package names are not limited to the ASCII subset and blindly used
    the ByteString `pack` function which truncates away the high bits of the `Char`
    code point resulting in a corrupted header with a non-sensical package-name.
    
    The fix is simply to serialise the package-name with the UTF-8 encoding which
    works nicely with the rest of the UTF-8 unaware string handling functions.
    Hence the fix is a lot shorter than this commit message.
    
    Fixes haskell#2557
    hvr committed Mar 3, 2019
    Configuration menu
    Copy the full SHA
    c7af89d View commit details
    Browse the repository at this point in the history
  2. Extend Distribution.Simple.Utils.rewriteFileEx from ASCII to UTF-8 …

    …encoding
    
    This takes care of knock-off effects of haskell#2557
    
    Specifically, the `Paths_*.hs` and `cabal_macros.h` files would result being incorrectly
    by a `rewriteFileEx` which isn't UTF-8 capable.
    
    Now the `cabal_macros.h` file is written out exactly like the `.h` file generated
    internally by `ghc` is generated; note however that standard CPP doesn't support
    non-ASCII characters in CPP symbols and will thus not work with a standard CPP
    preprocessor.
    hvr committed Mar 3, 2019
    Configuration menu
    Copy the full SHA
    89ab049 View commit details
    Browse the repository at this point in the history