-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix crashes in MatchSpec, VersionSpec parsing #12014
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 crashes in MatchSpec, VersionSpec parsing #12014
Conversation
We require contributors to sign our Contributor License Agreement and we don't have one on file for @pkmooreanaconda. In order for us to review and merge your code, please e-sign the Contributor License Agreement PDF. We then need to manually verify your signature. We will ping the bot to refresh the PR status when we have confirmed your signature. |
@conda-bot check |
36f1683
to
3f8282d
Compare
6129258
to
21b4967
Compare
21b4967
to
6105560
Compare
23da2cf
to
f32280c
Compare
@pkmooreanaconda I just noticed that your GPG isn't uploaded on GitHub, making your commits unverified, could you rectify that? |
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.
Minor nits, since we don't want to change behavior here let's move the =
discussion into a new issue/spike.
Co-authored-by: Ken Odegard <kodegard@anaconda.com>
Will research this issue outside of this PR.
* Fix regex related crash in MatchSpec * Fix crash related to mishandling of local version separator * Fix crash related to mishandling of "==" * Clean up news item, small format string fixes Co-authored-by: Ken Odegard <kodegard@anaconda.com>
Description
This PR attempts to address the set of crashes referenced in #11999. These fixes are intended to be minimal in order to reduce the chances of unintended MatchSpec behavior changes. The changes can be split into three commits:
Regex-In-MatchSpec related fixes: These fixes wrap attempts to compile regular expressions built from user input in order to catch regular expressions and raise InvalidMatchSpec with an informative error message instead.
version.py fix: Fix a bug in handling the "local version separator (+)." I've made a minimal correction to this code which makes versions like "+", "+a", "+1", and "+1.2" invalid. These cases are invalid because it doesn't make sense to only specify a local version. Cases like "1.2+", "1+", "a+" are already caught as invalid.
"==" fix: "==" was unintentionally treated differently than "<=" and ">=" due to some weird translation code (link). This meant that cases line "numpy<=" and "numpy>=" would raise an error while "numpy==" would crash. I made a small fix to bypass the translation code in the "numpy==" case so invalid version "==" can reach the existing error handling code like its friends. The way this is handled is very weird. We allow the strings "<=", ">=" and (now) "==" to be considered versions for a while after parsing and catch them later on with an "invalid operator" error. But that's a job for another time.
Checklist
news
directory (using the template) for the next release's release notes?