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.
This commit is contained in:
xzfc 2024-09-24 21:17:08 +00:00
parent fd5f1a05c1
commit 0c74d2449d
5 changed files with 6 additions and 3 deletions

4
Cargo.lock generated
View File

@ -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",

View File

@ -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"] }

View File

@ -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())

View File

@ -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

View File

@ -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());