Skip to content

Commit e2d4891

Browse files
committed
[Bugfix] Switch tar crate to make tar.gz decompression work
1 parent a6ae3aa commit e2d4891

File tree

4 files changed

+40
-23
lines changed

4 files changed

+40
-23
lines changed

Cargo.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
[package]
44
name = "dotslash"
55
version = "0.4.1"
6-
authors = ["Michael Bolin <[email protected]>", "Andres Suarez <[email protected]>"]
6+
authors = [
7+
"Michael Bolin <[email protected]>",
8+
"Andres Suarez <[email protected]>",
9+
]
710
edition = "2021"
811
rust-version = "1.75"
912
description = "Command-line tool to facilitate fetching an executable, caching it, and then running it."
@@ -12,7 +15,13 @@ homepage = "https://dotslash-cli.com"
1215
repository = "https://github.com/facebook/dotslash"
1316
license = "MIT OR Apache-2.0"
1417
keywords = ["cli"]
15-
include = ["/LICENSE-APACHE", "/LICENSE-MIT", "/README.md", "/src/**", "/tests/**"]
18+
include = [
19+
"/LICENSE-APACHE",
20+
"/LICENSE-MIT",
21+
"/README.md",
22+
"/src/**",
23+
"/tests/**",
24+
]
1625

1726
[[test]]
1827
name = "dotslash_tests_rs"
@@ -24,12 +33,14 @@ blake3 = { version = "=1.5.0", features = ["traits-preview"] }
2433
dirs = "2.0"
2534
dunce = "1.0.2"
2635
filetime = "0.2.9"
27-
flate2 = { version = "1.0.33", features = ["rust_backend"], default-features = false }
36+
flate2 = { version = "1.0.33", features = [
37+
"rust_backend",
38+
], default-features = false }
2839
fs2 = "0.4"
2940
serde = { version = "1.0.185", features = ["derive", "rc"] }
3041
serde_jsonrc = "0.1"
3142
sha2 = "0.10.6"
32-
tar = "0.4.40"
43+
binstall-tar = "0.4.39"
3344
tempfile = "3.8"
3445
thiserror = "1.0.49"
3546
xz2 = { version = "0.1.7", features = ["static"] }
@@ -39,7 +50,10 @@ zstd = { version = "0.13", features = ["experimental", "zstdmt"] }
3950
[dev-dependencies]
4051
assert_matches = "1.5"
4152
buck-resources = "1"
42-
snapbox = { version = "0.4.16", features = ["color-auto", "diff"], default-features = false }
53+
snapbox = { version = "0.4.16", features = [
54+
"color-auto",
55+
"diff",
56+
], default-features = false }
4357

4458
[target.'cfg(target_os = "linux")'.dependencies]
4559
nix = "0.25"

src/decompress.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ pub fn untar(tar_file: &Path, destination_dir: &Path, is_tar_gz: bool) -> io::Re
4545
let file = fs_ctx::file_open(tar_file)?;
4646
if is_tar_gz {
4747
let decoder = flate2::read::GzDecoder::new(file);
48-
let archive = tar::Archive::new(decoder);
48+
let archive = binstall_tar::Archive::new(decoder);
4949
unpack(archive, &destination_dir)
5050
} else {
51-
let archive = tar::Archive::new(file);
51+
let archive = binstall_tar::Archive::new(file);
5252
unpack(archive, &destination_dir)
5353
}
5454
}
5555

56-
pub fn unpack<R: Read>(mut archive: tar::Archive<R>, destination_dir: &Path) -> io::Result<()> {
56+
pub fn unpack<R: Read>(
57+
mut archive: binstall_tar::Archive<R>,
58+
destination_dir: &Path,
59+
) -> io::Result<()> {
5760
archive.set_preserve_permissions(true);
5861
archive.set_preserve_mtime(true);
5962
archive.unpack(destination_dir)

src/download.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ use std::path::PathBuf;
1616

1717
use anyhow::format_err;
1818
use anyhow::Context as _;
19+
use binstall_tar::Archive;
1920
use serde_jsonrc::value::Value;
2021
use sha2::Digest as _;
2122
use sha2::Sha256;
22-
use tar::Archive;
2323
use xz2::read::XzDecoder;
2424
use zstd::stream::read::Decoder;
2525

0 commit comments

Comments
 (0)