From 2b59f44328a9639bb065b89750ce169e7938d0d8 Mon Sep 17 00:00:00 2001 From: "John H. Ayad" Date: Tue, 1 Aug 2023 16:42:19 +0100 Subject: [PATCH] Fix: Generate valid tar archives (#276) * Fix: Generate valid tar archives * unused --- crates/rattler_package_streaming/src/write.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/rattler_package_streaming/src/write.rs b/crates/rattler_package_streaming/src/write.rs index ecb516f22..3c08f1bc3 100644 --- a/crates/rattler_package_streaming/src/write.rs +++ b/crates/rattler_package_streaming/src/write.rs @@ -238,7 +238,7 @@ fn prepare_header( header.set_device_major(0)?; if let Some(timestamp) = timestamp { - header.set_mtime(timestamp.timestamp() as u64); + header.set_mtime(timestamp.timestamp().unsigned_abs()); } // let file_size = stat.len(); @@ -264,10 +264,10 @@ fn append_path_to_archive( .map_err(|err| trace_file_error(&base_path.join(path), err))?; if header.entry_type().is_file() { - let file = fs::File::open(base_path.join(path)) + let mut file = fs::File::open(base_path.join(path)) .map_err(|err| trace_file_error(&base_path.join(path), err))?; - archive.append_data(&mut header, path, file)?; + archive.append_file(path, &mut file)?; } else if header.entry_type().is_symlink() || header.entry_type().is_hard_link() { let target = fs::read_link(base_path.join(path)) .map_err(|err| trace_file_error(&base_path.join(path), err))?;