use std::os::unix::ffi::{OsStrExt, OsStringExt};
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
use std::path::{Path, PathBuf};
-use std::sync::{Arc, Mutex};
use std::pin::Pin;
+use std::sync::{Arc, Mutex};
-use futures::future::Future;
use anyhow::{bail, format_err, Error};
+use futures::future::Future;
use nix::dir::Dir;
use nix::fcntl::OFlag;
use nix::sys::stat::Mode;
use pxar::format::Device;
use pxar::{Entry, EntryKind, Metadata};
+use proxmox_io::{sparse_copy, sparse_copy_async};
use proxmox_sys::c_result;
use proxmox_sys::fs::{create_path, CreateOptions};
-use proxmox_io::{sparse_copy, sparse_copy_async};
use proxmox_compression::zip::{ZipEncoder, ZipEntry};
use crate::pxar::Flags;
pub struct PxarExtractOptions<'a> {
- pub match_list: &'a[MatchEntry],
+ pub match_list: &'a [MatchEntry],
pub extract_match_default: bool,
pub allow_existing_dirs: bool,
pub on_error: Option<ErrorHandler>,
{
let root = decoder.open_root().await?;
let file = root
- .lookup(&path).await?
+ .lookup(&path)
+ .await?
.ok_or(format_err!("error opening '{:?}'", path.as_ref()))?;
let mut prefix = PathBuf::new();
err
})?;
- zipencoder
- .finish()
- .await
- .map_err(|err| {
- eprintln!("error during finishing of zip: {}", err);
- err
- })
+ zipencoder.finish().await.map_err(|err| {
+ eprintln!("error during finishing of zip: {}", err);
+ err
+ })
}
fn recurse_files_zip<'a, T, W>(
true,
);
zip.add_entry(entry, Some(file.contents().await?))
- .await
- .map_err(|err| format_err!("could not send file entry: {}", err))?;
+ .await
+ .map_err(|err| format_err!("could not send file entry: {}", err))?;
}
EntryKind::Hardlink(_) => {
let realfile = decoder.follow_hardlink(&file).await?;
true,
);
zip.add_entry(entry, Some(realfile.contents().await?))
- .await
- .map_err(|err| format_err!("could not send file entry: {}", err))?;
+ .await
+ .map_err(|err| format_err!("could not send file entry: {}", err))?;
}
EntryKind::Directory => {
let dir = file.enter_directory().await?;