diff --git a/Cargo.lock b/Cargo.lock index a175e1e54d76d..35e45dabd6600 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -207,9 +207,9 @@ dependencies = [ [[package]] name = "astral-tokio-tar" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0036af73142caf1291d4ec8ed667d3a1145bd55c8189517bd5aa07b3167ae1e1" +checksum = "bc72b7a1945436d584d2ae0b3ecfe44545ab5e8e4a2b4e1a3c9aea6b60ee1faa" dependencies = [ "filetime", "futures-core", diff --git a/Cargo.toml b/Cargo.toml index 92c2143b122a6..8c0913c2cb7c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,7 +82,7 @@ anstream = { version = "0.6.15" } anyhow = { version = "1.0.89" } arcstr = { version = "1.2.0" } arrayvec = { version = "0.7.6" } -astral-tokio-tar = { version = "0.5.3" } +astral-tokio-tar = { version = "0.5.5" } async-channel = { version = "2.3.1" } async-compression = { version = "0.4.12", features = ["bzip2", "gzip", "xz", "zstd"] } async-trait = { version = "0.1.82" } diff --git a/crates/uv/src/commands/build_frontend.rs b/crates/uv/src/commands/build_frontend.rs index 5a24273704fbc..08b5a32df842b 100644 --- a/crates/uv/src/commands/build_frontend.rs +++ b/crates/uv/src/commands/build_frontend.rs @@ -391,9 +391,15 @@ async fn build_impl( let help = if let Error::Extract(uv_extract::Error::Tar(err)) = &err { // TODO(konsti): astral-tokio-tar should use a proper error instead of // encoding everything in strings + // NOTE(ww): We check for both messages below because the both indicate + // different external extraction scenarios; the first is for any + // absolute path outside of the target directory, and the second + // is specifically for symlinks that point outside. if err.to_string().contains("/bin/python") && std::error::Error::source(err).is_some_and(|err| { - err.to_string().ends_with("outside of the target directory") + let err = err.to_string(); + err.ends_with("outside of the target directory") + || err.ends_with("external symlinks are not allowed") }) { Some( diff --git a/crates/uv/tests/it/build.rs b/crates/uv/tests/it/build.rs index 049585240e824..b18690b527ff1 100644 --- a/crates/uv/tests/it/build.rs +++ b/crates/uv/tests/it/build.rs @@ -2078,7 +2078,7 @@ fn venv_included_in_sdist() -> Result<()> { × Failed to build `[TEMP_DIR]/` ├─▶ Invalid tar file ├─▶ failed to unpack `[CACHE_DIR]/sdists-v9/[TMP]/python` - ╰─▶ symlink destination for [PYTHON-3.12] is outside of the target directory + ╰─▶ symlink path `[PYTHON-3.12]` is absolute, but external symlinks are not allowed help: This file seems to be part of a virtual environment. Virtual environments must be excluded from source distributions. ");