Refine MatchSpec
validation to avoid incompatibilities with libmamba's parser
#421
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Closes #418
We were a bit too strict with some auto-generated
MatchSpec
. The issue above includes an environment where a user has installed a package via URL or path. In this case,conda
generates aMatchSpec
object that gets rendered aspackage-name[url="package-url"]
.libmamba only supports some key values in the brackets, so we were rejecting
url
with aInvalidSpecError
. However,url
here is superfluous so we can simply drop it from the passed string.This uncovered a new matchspec that makes libmamba segfault:
<unknown>/noarch::test-package
. We will also anticipate that and drop it before the string is generated because, again, it doesn't add any useful info for the solver and it's only an artifact of not knowing from which channel test-package was installed (because it came from a URL).Note that if the URL happens to be a channel URL (e.g.
conda.anaconda.org/conda-forge/noarch/package-version-build.tar.bz2
),conda
DOES recognize it as a valid channel and that doesn't crash. It only reproduces if the tarball is in a non-channel-like location.Checklist - did you ...
news
directory (using the template) for the next release's release notes?