Avoid reusing interpreter metadata when running under Rosetta (#9846)

## Summary

Closes https://github.com/astral-sh/uv/issues/9836.
This commit is contained in:
Charlie Marsh 2024-12-12 13:21:35 -05:00 committed by GitHub
parent c0f8e20a51
commit a13e3f5f69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -1,4 +1,5 @@
use std::borrow::Cow;
use std::env::consts::ARCH;
use std::io;
use std::path::{Path, PathBuf};
use std::process::{Command, ExitStatus};
@ -746,7 +747,9 @@ 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,
// 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)),