Skip to content

Commit

Permalink
Fix: Generate valid tar archives (#276)
Browse files Browse the repository at this point in the history
* Fix: Generate valid tar archives

* unused
  • Loading branch information
johnhany97 authored Aug 1, 2023
1 parent cede9c1 commit 2b59f44
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/rattler_package_streaming/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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))?;
Expand Down

0 comments on commit 2b59f44

Please sign in to comment.