From 0c74d2449d51ba43c238293f75e176661d8fd24f Mon Sep 17 00:00:00 2001 From: xzfc Date: Tue, 24 Sep 2024 21:17:08 +0000 Subject: [PATCH] chore(deps): update tar to 0.4.42 The new version of tar enables the creation of sparse tar archives by default. The ability to read such sparse entries was added in tar 0.4.6, which has been in use starting from Cargo 0.13 and Rust 1.12. Additionally, `docker cp` doesn't support sparse tar entries in the GNU format. For compatibility with older versions of Rust and Cargo, as well as with `docker cp`, this commit disables sparse archive creation in the corresponding cases where the `tar::Builder` is used. See #14594. --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- crates/cargo-test-support/src/containers.rs | 1 + crates/cargo-test-support/src/registry.rs | 1 + src/cargo/ops/cargo_package.rs | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 06c2c5a0453..aa88e03af98 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3371,9 +3371,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" +checksum = "4ff6c40d3aedb5e06b57c6f669ad17ab063dd1e63d977c6a88e7f4dfa4f04020" dependencies = [ "filetime", "libc", diff --git a/Cargo.toml b/Cargo.toml index 9682e216dc1..c62dc28df49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -94,7 +94,7 @@ shell-escape = "0.1.5" similar = "2.6.0" supports-hyperlinks = "3.0.0" snapbox = { version = "0.6.17", features = ["diff", "dir", "term-svg", "regex", "json"] } -tar = { version = "0.4.41", default-features = false } +tar = { version = "0.4.42", default-features = false } tempfile = "3.10.1" thiserror = "1.0.63" time = { version = "0.3.36", features = ["parsing", "formatting", "serde"] } diff --git a/crates/cargo-test-support/src/containers.rs b/crates/cargo-test-support/src/containers.rs index 22fd5fd855e..4ce6e1d5048 100644 --- a/crates/cargo-test-support/src/containers.rs +++ b/crates/cargo-test-support/src/containers.rs @@ -122,6 +122,7 @@ impl Container { return; } let mut ar = tar::Builder::new(Vec::new()); + ar.sparse(false); let files = std::mem::replace(&mut self.files, Vec::new()); for mut file in files { ar.append_data(&mut file.header, &file.path, file.contents.as_slice()) diff --git a/crates/cargo-test-support/src/registry.rs b/crates/cargo-test-support/src/registry.rs index 5af522a38cc..9e0bc9e3ed9 100644 --- a/crates/cargo-test-support/src/registry.rs +++ b/crates/cargo-test-support/src/registry.rs @@ -1513,6 +1513,7 @@ impl Package { t!(fs::create_dir_all(dst.parent().unwrap())); let f = t!(File::create(&dst)); let mut a = Builder::new(GzEncoder::new(f, Compression::none())); + a.sparse(false); if !self .files diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 04708584027..239e5af2afb 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -903,6 +903,7 @@ fn tar( // Put all package files into a compressed archive. let mut ar = Builder::new(encoder); + ar.sparse(false); let gctx = ws.gctx(); let base_name = format!("{}-{}", pkg.name(), pkg.version());