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

Fix: Generate valid tar archives #276

Merged
merged 2 commits into from
Aug 1, 2023
Merged
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
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());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a drive-by change. It's the other lines below that actually make the difference

}

// 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