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

Refine MatchSpec validation to avoid incompatibilities with libmamba's parser #421

Merged
merged 5 commits into from
Jan 10, 2024

Conversation

jaimergp
Copy link
Contributor

@jaimergp jaimergp commented Jan 9, 2024

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 a MatchSpec object that gets rendered as package-name[url="package-url"].

libmamba only supports some key values in the brackets, so we were rejecting url with a InvalidSpecError. 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 ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@jaimergp
Copy link
Contributor Author

Failing as expected. Submitting fix now.

@jaimergp jaimergp marked this pull request as ready for review January 10, 2024 09:18
@jezdez jezdez merged commit 974ffe1 into main Jan 10, 2024
71 checks passed
@jezdez jezdez deleted the drop-unknown-channel branch January 10, 2024 16:32
@therc
Copy link

therc commented Jan 24, 2024

Would this also fix the error

InvalidMatchSpec: Invalid spec 'conda-forge/linux-64::_libgcc_mutex==0.1=conda_forge[md5=d7c89558ba9fa0495403155b64376d81]': Libmamba only supports a subset of the MatchSpec interface for now. You can only use ('name', 'version', 'build', 'channel', 'subdir'), but you tried to use ('md5',).

assuming that "md5" would/could be dropped, too?

This was while trying to install another unrelated package. _libgcc_mutex shows as

_libgcc_mutex 0.1 conda_forge conda-forge

and was originally installed through a lockfile (which is where I suspect md5 comes from).

@jaimergp
Copy link
Contributor Author

Hm, maybe not (yet). We are only dropping the url field. Can you open a new issue so we can take a look? It's weird that the md5 hash ends up in the matchspec.

@nhsavage
Copy link

new issue opened at #427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed [bot] added once the contributor has signed the CLA
Projects
Archived in project
5 participants