-
Notifications
You must be signed in to change notification settings - Fork 96
Semver validation error when prerelease version contains a floating number #194
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
Comments
@P1ng-W1n thanks for your bug report - you're right. According to SemVer 2.0.0, version 0.1.0-0f is valid - https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string |
Thanks for the confirmation.. |
Thanks for your report! 👍 Well, I'm not so sure. According to the provided link, version If I read the Backus–Naur Form Grammar for Valid SemVer Versions correctly, the pre-release cannot start with a digit. Here is the relevant part from the spec:
It seems, this is the correct behavior, right? @P1ng-W1n If you really need commit hashes in your pre-release, you need to use a character as a prefix, for example |
Hmm.. Right.. The semver description is a little bit misleading. Section 9 states that:
This truly makes 0.1.0-01 invalid (as that's clearly a number), but would also invalidate 0.1.0-0abcdef (which -I would argue- isn't a number). |
Thanks for having a deeper look into the Semver spec. 👍 If I'm not mistaken, the semver library is then in accordance to the specification. To avoid such problems, the only solution I can see is to add a non-digit prefix for the pre-release, like
That's correct. The semver library interpretes pre-release and build parts always as strings. |
Ok.. After a second (and third) reread of the referenced specification I can't see any other way to solve this either. Although I'm a little bit puzzled why that rule is in place when it comes to string type values (pre-release version), but that's more of a question related to the specification I feel. Thanks for your quick response. |
Thanks for confirming. 👍
Mee too! I don't know the reason for this. Maybe you could try to open an issue for semver itself? Would you mind if I close this issue? |
Hi @tomschr I just wanted to raise this issue over https://github.com/semver/ to conclude that question :) I'm closing the issue now. Thanks for your support once again. |
@P1ng-W1n Wonderful! ❤️ Thanks for opening the issue on semver. Much appreciated! 👍 Feel free to open another issue if you find one. 😉 |
Reopening this case, as it seems that there are at least a few use cases where this should be accepted. |
I'm working on fix.
On the other hand, 'build' part is ignored when versions are compared:
|
…ersion from semver.org Also, fix problem with invalid Python 2.7 super call.
Hi @ppkt The more I think about it, the more I have to agree with you. I can't think of a single hashing algorithm that could guarantee that the generated hash wouldn't start with a numeric zero AND that it wouldn't consist only of numbers (for example, 01234567 could also be a git hash). |
…ersion from semver.org Also, fix problem with invalid Python 2.7 super call.
Thanks for the quick fix. |
@P1ng-W1n Thanks for your contribution. 👍
Yes, we are preparing the 2.9.1 release. You can see that in the CHANGELOG.rst file in the section @scls19fr do you have any estimation? 😉 Maybe we could even simplify the release process a bit through GitHub Actions...? If you are ok with that, I could open an issue and try something out in my fork. |
I also think that a new release should occur before our 3.x.y release. |
Could someone please verify if that's intended? I can't see any restriction about this in the semver documentation.
PoC:
The text was updated successfully, but these errors were encountered: