Skip to content

Fix cache bug with legacy cache entries #7490

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

Merged
merged 4 commits into from
Dec 21, 2019

Conversation

sbidoul
Copy link
Member

@sbidoul sbidoul commented Dec 15, 2019

Fix an unreleased bug from #7319, in the handling of legacy cache entries.

The bug manifests itself when only a legacy cache entry exist for a given link, in which case pip would error like this:

$ pip install wrapt
Processing /home/sbi-local/.cache/pip/wheels/23/5f/62/304b411f20be41821465a82bc98baabc5e68c3cdd1eb99db71/wrapt-1.11.2-cp37-cp37m-linux_x86_64.whl
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/home/sbi-local/.cache/pip/wheels/23/5f/62/304b411f20be41821465a82bc98baabc5e68c3cdd1eb99db71/wrapt-1.11.2-cp37-cp37m-linux_x86_64.whl'

This is because _get_candidates returned cached wheel names and not their cache directory, with the cache directory later being reconstructed in _link_for_candidate. I fix this by returning a wheel_name, wheel_dir tuple so callers do not need to do any guesswork to find the directory.

@sbidoul sbidoul force-pushed the legacy-cache-bug-sbi branch 2 times, most recently from 7d781c3 to b92914a Compare December 15, 2019 21:02
@sbidoul sbidoul force-pushed the legacy-cache-bug-sbi branch from b92914a to 7b998a7 Compare December 15, 2019 22:41
@sbidoul sbidoul force-pushed the legacy-cache-bug-sbi branch from 7b998a7 to 36ff884 Compare December 15, 2019 22:43
Copy link
Member

@xavfernandez xavfernandez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 👍

(wheel.support_index_min(supported_tags), wheel_name)
(
wheel.support_index_min(supported_tags),
wheel_name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: it's unlikely that the min() call would depend on the wheel_name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least this is equivalent to the previous behavior. Alternatively, we may want to separately consider whether an sdist may produce a wheel with "build tag" that should be taken into account even in the cache.

@pradyunsg
Copy link
Member

Merging since this has multiple approving reviews.

@pradyunsg pradyunsg merged commit c06874c into pypa:master Dec 21, 2019
@sbidoul sbidoul deleted the legacy-cache-bug-sbi branch December 21, 2019 08:25
@sbidoul
Copy link
Member Author

sbidoul commented Dec 21, 2019

Thanks

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jan 24, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants