openSUSE / libsolv

Library for solving packages and reading repositories
http://en.opensuse.org/openSUSE:Libzypp_satsolver
Other
509 stars 151 forks source link

Conda package with an incorrect subdir makes repo unreadable. #529

Closed calebzulawski closed 11 months ago

calebzulawski commented 1 year ago

I think this is the line in question: https://github.com/openSUSE/libsolv/blob/5dc4f81fda718df26f8f5dda343a71d34cf555b4/ext/repo_conda.c#L314-L319

In my situation, I have a custom subdir linux-64-foo, but one broken package has the subdir listed as linux-64. This package makes the entire repo unreadable. I think instead of a hard error, this should be a warning so the repo can still be used.

Also see mamba-org/mamba#2363

mlschroe commented 1 year ago

Yes, we certainly should not return an error here. I think conda just ignores the package subdir in this case. Is that correct?

wolfv commented 1 year ago

I think the other way around, it would ignore the global subdir and use the package subdir.

mlschroe commented 1 year ago

Yeah, that would make more sense. However the code in subdir_data.py contains

meta_in_common = {  # just need to make this once, then apply with .update()
            'arch': repodata.get('info', {}).get('arch'),
            'channel': self.channel,
            'platform': repodata.get('info', {}).get('platform'),
            'schannel': schannel,
            'subdir': subdir,
        }

...

info.update(meta_in_common)

I think that this means it overwrites the subdir from the package.

mlschroe commented 1 year ago

Oh, see issue #502

calebzulawski commented 1 year ago

Just curious, what happens if they're (accidentally) not equal and the package subdir overrides the global subdir? In my situation, and others I believe, the package is actually in the wrong subdirectory, so it won't be possible to download it from the subdir indicated in the package either.

jpedrick commented 1 year ago

It would be great if one way or another this would either skip the package and print an error, or overwrite the subdir for the package. Returning an error here ruins a lot of people's days until the remote repo can be fixed.

The conda classic solver works, so it would make sense to replicate whatever they do even if it's wrong by some POV.

Personally, I would expect and want a warning and the mismatched packages skipped as that would force the mismatch to be noticed/fixed, but wouldn't disrupt users who are uninterested in the broken package.

mlschroe commented 11 months ago

I changed the code so that it overwrites the package subdir with the info subdir.