Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Switch tar crate to make tar.gz decompression work #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Cargo.lock

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

24 changes: 19 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
[package]
name = "dotslash"
version = "0.4.1"
authors = ["Michael Bolin <[email protected]>", "Andres Suarez <[email protected]>"]
authors = [
"Michael Bolin <[email protected]>",
"Andres Suarez <[email protected]>",
]
edition = "2021"
rust-version = "1.75"
description = "Command-line tool to facilitate fetching an executable, caching it, and then running it."
Expand All @@ -12,7 +15,13 @@ homepage = "https://dotslash-cli.com"
repository = "https://github.com/facebook/dotslash"
license = "MIT OR Apache-2.0"
keywords = ["cli"]
include = ["/LICENSE-APACHE", "/LICENSE-MIT", "/README.md", "/src/**", "/tests/**"]
include = [
"/LICENSE-APACHE",
"/LICENSE-MIT",
"/README.md",
"/src/**",
"/tests/**",
]

[[test]]
name = "dotslash_tests_rs"
Expand All @@ -24,12 +33,14 @@ blake3 = { version = "=1.5.0", features = ["traits-preview"] }
dirs = "2.0"
dunce = "1.0.2"
filetime = "0.2.9"
flate2 = { version = "1.0.33", features = ["rust_backend"], default-features = false }
flate2 = { version = "1.0.33", features = [
"rust_backend",
], default-features = false }
fs2 = "0.4"
serde = { version = "1.0.185", features = ["derive", "rc"] }
serde_jsonrc = "0.1"
sha2 = "0.10.6"
tar = "0.4.40"
binstall-tar = "0.4.39"
tempfile = "3.8"
thiserror = "1.0.49"
xz2 = { version = "0.1.7", features = ["static"] }
Expand All @@ -39,7 +50,10 @@ zstd = { version = "0.13", features = ["experimental", "zstdmt"] }
[dev-dependencies]
assert_matches = "1.5"
buck-resources = "1"
snapbox = { version = "0.4.16", features = ["color-auto", "diff"], default-features = false }
snapbox = { version = "0.4.16", features = [
"color-auto",
"diff",
], default-features = false }

[target.'cfg(target_os = "linux")'.dependencies]
nix = "0.25"
Expand Down
9 changes: 6 additions & 3 deletions src/decompress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,18 @@ pub fn untar(tar_file: &Path, destination_dir: &Path, is_tar_gz: bool) -> io::Re
let file = fs_ctx::file_open(tar_file)?;
if is_tar_gz {
let decoder = flate2::read::GzDecoder::new(file);
let archive = tar::Archive::new(decoder);
let archive = binstall_tar::Archive::new(decoder);
unpack(archive, &destination_dir)
} else {
let archive = tar::Archive::new(file);
let archive = binstall_tar::Archive::new(file);
unpack(archive, &destination_dir)
}
}

pub fn unpack<R: Read>(mut archive: tar::Archive<R>, destination_dir: &Path) -> io::Result<()> {
pub fn unpack<R: Read>(
mut archive: binstall_tar::Archive<R>,
destination_dir: &Path,
) -> io::Result<()> {
archive.set_preserve_permissions(true);
archive.set_preserve_mtime(true);
archive.unpack(destination_dir)
Expand Down
2 changes: 1 addition & 1 deletion src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ use std::path::PathBuf;

use anyhow::format_err;
use anyhow::Context as _;
use binstall_tar::Archive;
use serde_jsonrc::value::Value;
use sha2::Digest as _;
use sha2::Sha256;
use tar::Archive;
use xz2::read::XzDecoder;
use zstd::stream::read::Decoder;

Expand Down