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

Warn on leading zeros in version digits for old cabal spec #5093

Closed
wants to merge 2 commits into from

Conversation

phadej
Copy link
Collaborator

@phadej phadej commented Feb 1, 2018

Fixes #5092

Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

Please also shortly describe how you tested your change. Bonus points for added tests!

@23Skidoo
Copy link
Member

23Skidoo commented Feb 1, 2018

LGTM.

toNumber :: CabalParsing m => [Int] -> m Int
toNumber [0] = return 0
toNumber xs@(0:_) = do
parsecWarning PWTVersionLeadingZeros "Version digit with leading zero. Use cabal-version: 1.24 or later to write such versions. For more information see https://github.com/haskell/cabal/issues/5092"
Copy link
Member

@hvr hvr Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit more tricky; while technically cabal 1.24 happily copes with this, cabal 1.22 would not, as cabal 1.22 would still try to parse future spec versions, and then choke on unexpected syntax.

So as far as cabal check's category of "inacceptable things for distribution via hackage" errors is concerned, we should probably require at least cabal-version:2.0 (which are not visible to cabal-1.22 clients c.f. #4899 ); or we may consider leading zeroes a mistake, and prevent them from being used by any new .cabal file uploaded to hackage (i.e. not even for cabal-version:2.0 or :2.2).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change the cutoff to 2.0.

If we want to completely prevent them from Hackage is something I don't feel confident to decide right now (even it will affect only few packages)

@23Skidoo
Copy link
Member

23Skidoo commented Feb 1, 2018

The new test fails on AppVeyor.

@23Skidoo
Copy link
Member

23Skidoo commented Feb 1, 2018

The only remaining failure here was meta: .check files were not included in extra-source-files. Fixed that and merged manually in b36cf3c.

@23Skidoo 23Skidoo closed this Feb 1, 2018
@phadej
Copy link
Collaborator Author

phadej commented Feb 2, 2018

@23Skidoo thanks!

@phadej phadej deleted the version-leading-zeros branch February 2, 2018 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants