mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-29 06:54:10 +00:00
Make interpreter caching robust to OS upgrades (#11875)
## Summary In. https://github.com/astral-sh/uv/issues/11857, we had a case of a user that was seeing incorrect resolution results after upgrading to a newer version of macOS, since we retained cache information about the interpreter. This PR adds the OS name and version to the cache key for the interpreter. This seems to be extremely cheap, and it's nice to make this robust so that users don't run into the same confusion in the future. Closes https://github.com/astral-sh/uv/issues/11857.
This commit is contained in:
parent
cf76334d79
commit
461f4d9007
3 changed files with 9 additions and 3 deletions
|
@ -848,9 +848,13 @@ impl InterpreterInfo {
|
|||
|
||||
let cache_entry = cache.entry(
|
||||
CacheBucket::Interpreter,
|
||||
// Shard interpreter metadata by host architecture, to avoid cache collisions when
|
||||
// running universal binaries under Rosetta.
|
||||
ARCH,
|
||||
// Shard interpreter metadata by host architecture, operating system, and version, to
|
||||
// invalidate the cache (e.g.) on OS upgrades.
|
||||
cache_digest(&(
|
||||
ARCH,
|
||||
sys_info::os_type().unwrap_or_default(),
|
||||
sys_info::os_release().unwrap_or_default(),
|
||||
)),
|
||||
// We use the absolute path for the cache entry to avoid cache collisions for relative
|
||||
// paths. But we don't to query the executable with symbolic links resolved.
|
||||
format!("{}.msgpack", cache_digest(&absolute)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue