Skip to content

Commit

Permalink
Avoid reusing interpreter metadata when running under Rosetta (#9846)
Browse files Browse the repository at this point in the history
## Summary

Closes #9836.
  • Loading branch information
charliermarsh authored Dec 12, 2024
1 parent c0f8e20 commit a13e3f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/uv-cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ impl CacheBucket {
Self::SourceDistributions => "sdists-v6",
Self::FlatIndex => "flat-index-v2",
Self::Git => "git-v0",
Self::Interpreter => "interpreter-v3",
Self::Interpreter => "interpreter-v4",
// Note that when bumping this, you'll also need to bump it
// in crates/uv/tests/cache_clean.rs.
Self::Simple => "simple-v14",
Expand Down
5 changes: 4 additions & 1 deletion crates/uv-python/src/interpreter.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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)),
Expand Down

0 comments on commit a13e3f5

Please sign in to comment.