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

stack sdist (2.3.1) generates weird PVP bounds in .cabal file #5289

Closed
vaclavsvejcar opened this issue May 3, 2020 · 7 comments
Closed

stack sdist (2.3.1) generates weird PVP bounds in .cabal file #5289

vaclavsvejcar opened this issue May 3, 2020 · 7 comments

Comments

@vaclavsvejcar
Copy link

vaclavsvejcar commented May 3, 2020

General summary/comments (optional)

For my haskell project I use stack for building & generating tarball for Hackage. To generate PVP bounds in resulting .cabal file, I use the pvp-bounds: lower option in my stack.yaml. Everything worked fine with stack-2.1.3, but after upgrading to stack-2-3-1, running stack sdist results in following error:

Unable to parse cabal file from package /private/var/folders/fl/g3lf6zg14d7_5n2_rvs7ntgw0000gn/T/stack-450c73176363635d/headroom-0.2.2.0/headroom.cabal

- 147:17: 
unexpected Sublibrary dependency syntax used. To use this syntax the package needs to specify at least 'cabal-version: 3.0'. Alternatively, if you are depending on an internal library, you can write directly the library name as it were a package.
expecting space

When checking the generated .cabal file, I noticed that version bounds in dependencies section looks like this:

    build-depends:
        aeson : {} >=1.4.7.1,
        base : {} >=4.7 && <5,
        either : {} >=5.0.1.1,
        file-embed : {} >=0.0.11.2,

Note the {} which probably causes the issue. I tried to use Cabal 3 as suggested by changing several things in my package.yaml file gist, which suppresed all the warnings, but these {} remains in the generated .cabal file inside the distribution tarball. When trying to upload such tar to Hackage, it ends up with following error:

Invalid package

headroom-0.2.2.0/headroom.cabal:148:15: unexpected ':' expecting space, white space, opening paren, operator, comma or end of input aeson : {} >=1.4.7.1, base : {} >=4.7 && <5, either : {} >=5.0.1.1, file-embed : {} >=0.0.11.2, mustache : {} >=2.3.1, optparse-applicative : {} >=0.15.1.0, pcre-light : {} >=0.4.1.0, rio : {} >=0.1.15.1, template-haskell : {} >=2.15.0.0, time : {} >=1.9.3, yaml : {} >=0.11.3.0

Is this expected behaviour, or is it either stack or hpack bug or error in my configuration? Either way, I'm not able to generate valid distribution tarball for Hackage using stack-2.3.1.

Steps to reproduce

For example:

  1. Clone https://github.com/vaclavsvejcar/headroom
  2. Run stack sdist inside the project directory

Expected

.tar.gz distribution file that would be accepted by Hackage (as with stack-2.1.3)

Actual

Generated .tar.gz contains (probably) invalid syntax in .cabal file.

Stack version

$ stack --version
Version 2.3.1, Git revision de2a7b694f07de7e6cf17f8c92338c16286b2878 (8103 commits) x86_64 hpack-0.33.0

Method of installation

  • Official binary, downloaded from stackage.org or fpcomplete's package repository
@rblaze
Copy link

rblaze commented May 11, 2020

Affects me too, I'll have to rollback to the older stack to publish new package.

@vaclavsvejcar
Copy link
Author

vaclavsvejcar commented Jun 7, 2020

@snoyberg Can you please confirm whether this is intended behaviour or bug and in case of bug, it it's problem of stack or rather hpack? Have no idea what causes this, but it's pretty unfortunate as I'm unable to generate working tarball with stack sdist using current version of stack.

@snoyberg
Copy link
Contributor

snoyberg commented Jun 8, 2020

Most likely it's a big in the Cabal library. We use its pretty printer, and it's been buggy in the past. I'd recommend turning off the pvp-bounds option. Due to these kinds of Cabal bugs, I've considered removing the feature

@dzhus
Copy link
Contributor

dzhus commented Jun 8, 2020

The issue is in how stack uses the Cabal library – please see the PR #5309 linked above for the fix.

@sullyj3
Copy link

sullyj3 commented Oct 25, 2021

Given that #5309 was merged, does that close this issue?

@dzhus
Copy link
Contributor

dzhus commented Oct 25, 2021

@sullyj3 I think so, yes. The fix is called out in https://github.com/commercialhaskell/stack/blob/master/ChangeLog.md#v233.

@snoyberg
Copy link
Contributor

snoyberg commented Oct 26, 2021

Thanks for the ping, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants