-
Notifications
You must be signed in to change notification settings - Fork 704
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
Conversation
LGTM. |
Cabal/Distribution/Types/Version.hs
Outdated
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" |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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)
The new test fails on AppVeyor. |
e8bb04f
to
1cdf003
Compare
The only remaining failure here was meta: |
@23Skidoo thanks! |
Fixes #5092
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!