Skip to content

Commit

Permalink
Auto merge of #14632 - xzfc:tar-0.4.42, r=weihanglo
Browse files Browse the repository at this point in the history
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 everywhere the `tar::Builder` is used.

Closes #14594. CC: `@weihanglo,` `@alexcrichton.`
  • Loading branch information
bors committed Oct 2, 2024
2 parents ac3de0b + 0c74d24 commit d9c14e6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
1 change: 1 addition & 0 deletions crates/cargo-test-support/src/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions crates/cargo-test-support/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit d9c14e6

Please sign in to comment.