diff --git a/Cargo.lock b/Cargo.lock index b8e232255..f01e3bfbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,6 +32,22 @@ version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +[[package]] +name = "astral-tokio-tar" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec179a06c1769b1e42e1e2cbe74c7dcdb3d6383c838454d063eaac5bbb7ebbe5" +dependencies = [ + "filetime", + "futures-core", + "libc", + "portable-atomic", + "rustc-hash", + "tokio", + "tokio-stream", + "xattr", +] + [[package]] name = "async-compression" version = "0.4.18" @@ -101,12 +117,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.7.0" @@ -906,6 +916,7 @@ name = "libpkgx" version = "0.7.1" dependencies = [ "anyhow", + "astral-tokio-tar", "async-compression", "dirs-next", "fs2", @@ -923,7 +934,6 @@ dependencies = [ "tempfile", "tokio", "tokio-stream", - "tokio-tar", "tokio-util", ] @@ -933,9 +943,9 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.7.0", + "bitflags", "libc", - "redox_syscall 0.5.8", + "redox_syscall", ] [[package]] @@ -1062,7 +1072,7 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225e7cfe711e0ba79a68baeddb2982723e4235247aefce1482f2f16c27865b66" dependencies = [ - "bitflags 2.7.0", + "bitflags", "cfg-if", "cfg_aliases", "libc", @@ -1089,7 +1099,7 @@ version = "0.10.72" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" dependencies = [ - "bitflags 2.7.0", + "bitflags", "cfg-if", "foreign-types", "libc", @@ -1161,7 +1171,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.8", + "redox_syscall", "smallvec", "windows-targets 0.52.6", ] @@ -1243,7 +1253,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.5.8", + "socket2 0.6.2", "thiserror 2.0.18", "tokio", "tracing", @@ -1281,9 +1291,9 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.5.8", + "socket2 0.6.2", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1324,22 +1334,13 @@ dependencies = [ "getrandom 0.3.1", ] -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.7.0", + "bitflags", ] [[package]] @@ -1454,7 +1455,7 @@ version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1c93dd1c9683b438c392c492109cb702b8090b2bfc8fed6f6e4eb4523f17af3" dependencies = [ - "bitflags 2.7.0", + "bitflags", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -1481,7 +1482,7 @@ version = "0.38.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" dependencies = [ - "bitflags 2.7.0", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -1605,7 +1606,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.7.0", + "bitflags", "core-foundation 0.9.4", "core-foundation-sys", "libc", @@ -1618,7 +1619,7 @@ version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef" dependencies = [ - "bitflags 2.7.0", + "bitflags", "core-foundation 0.10.1", "core-foundation-sys", "libc", @@ -1954,21 +1955,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-tar" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5714c010ca3e5c27114c1cdeb9d14641ace49874aa5626d7149e47aedace75" -dependencies = [ - "filetime", - "futures-core", - "libc", - "redox_syscall 0.3.5", - "tokio", - "tokio-stream", - "xattr", -] - [[package]] name = "tokio-util" version = "0.7.13" @@ -2550,7 +2536,7 @@ version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" dependencies = [ - "bitflags 2.7.0", + "bitflags", ] [[package]] diff --git a/crates/lib/Cargo.toml b/crates/lib/Cargo.toml index 75b39d63c..4c199ab56 100644 --- a/crates/lib/Cargo.toml +++ b/crates/lib/Cargo.toml @@ -24,7 +24,7 @@ rusqlite = "0.38.0" regex = "1.11.1" reqwest = { version = "0.13", features = ["stream", "blocking"] } async-compression = { version = "0.4", features = ["tokio", "gzip", "xz"] } -tokio-tar = "0.3.1" +astral-tokio-tar = "0.5.6" tokio-util = { version = "0.7.13", features = ["compat"] } futures = "0.3.31" lazy_static = "1.5.0" diff --git a/crates/lib/src/install.rs b/crates/lib/src/install.rs index ca6441398..b98c82f6a 100644 --- a/crates/lib/src/install.rs +++ b/crates/lib/src/install.rs @@ -6,7 +6,7 @@ use std::{ }; use tempfile::tempdir_in; use tokio::task; -use tokio_tar::Archive; +use tokio_tar::ArchiveBuilder; // Compatibility trait lets us call `compat()` on a futures::io::AsyncRead // to convert it into a tokio::io::AsyncRead. @@ -108,7 +108,9 @@ where let temp_dir = tempdir_in(config.pkgx_dir.join(&pkg.project))?; // Step 4: Extract the tar archive - let mut archive = Archive::new(decoder); + let mut archive = ArchiveBuilder::new(decoder) + .set_preserve_permissions(true) + .build(); archive.unpack(&temp_dir).await?; // Step 5: atomically move from temp dir to installation location diff --git a/crates/lib/src/sync.rs b/crates/lib/src/sync.rs index f5df20954..65f5694e8 100644 --- a/crates/lib/src/sync.rs +++ b/crates/lib/src/sync.rs @@ -4,7 +4,7 @@ use fs2::FileExt; use futures::TryStreamExt; use rusqlite::Connection; use std::{error::Error, fs::OpenOptions, path::PathBuf}; -use tokio_tar::Archive; +use tokio_tar::ArchiveBuilder; use tokio_util::compat::FuturesAsyncReadCompatExt; #[allow(clippy::all)] @@ -64,7 +64,9 @@ async fn download_and_extract_pantry(url: &str, dest: &PathBuf) -> Result<(), Bo let decoder = XzDecoder::new(stream); // Step 3: Extract the tar archive - let mut archive = Archive::new(decoder); + let mut archive = ArchiveBuilder::new(decoder) + .set_preserve_permissions(true) + .build(); archive.unpack(dest).await?; Ok(())