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

failure to append an input to a package tarball leaves an incomplete tarball in the output location #68

Open
gjcolombo opened this issue Nov 21, 2024 · 0 comments

Comments

@gjcolombo
Copy link
Contributor

See oxidecomputer/propolis#812 for a specific case of this.

ILTM like the output archive gets created on this path, at least for zone tarballs:

// Actually build the package
timer.start("add inputs to package");
let mut archive = new_zone_archive_builder(name, output_directory).await?;
for input in inputs.0.iter() {
self.add_input_to_package(&**progress, &mut archive, input)
.await
.with_context(|| format!("Adding input {input:?}"))?;
}
timer.start("finalize archive");
let file = archive.into_inner()?.finish()?;

If one of the calls to add_input_to_package fails, the ArchiveBuilder and its enclosed tar::Builder will be dropped. Dropping the tar::Builder finalizes the archive (by calling Builder::finish) in whatever state it was in when the error occurred.

It would be nice either to delete partial package archives on failure or (as @faithanalog suggested in propolis#812) construct them in a temporary location and move them to the final location only when the archive is fully constructed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant