forked from proxmox-mirrors/proxmox-backup
update pbs-client to nix 0.29 and rustyline 0.14
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
4e3f57529c
commit
2a7012f96b
@ -306,7 +306,7 @@ async fn restore_command(target: String, pattern: Option<String>) -> Result<(),
|
||||
/// here:
|
||||
pub struct Shell {
|
||||
/// Readline instance handling input and callbacks
|
||||
rl: rustyline::Editor<CliHelper>,
|
||||
rl: rustyline::Editor<CliHelper, rustyline::history::MemHistory>,
|
||||
|
||||
/// Interactive prompt.
|
||||
prompt: String,
|
||||
@ -352,7 +352,10 @@ impl Shell {
|
||||
archive: Accessor,
|
||||
) -> Result<Self, Error> {
|
||||
let cli_helper = CliHelper::new(catalog_shell_cli());
|
||||
let mut rl = rustyline::Editor::<CliHelper>::new();
|
||||
let mut rl = rustyline::Editor::<CliHelper, _>::with_history(
|
||||
rustyline::Config::default(),
|
||||
rustyline::history::MemHistory::new(),
|
||||
)?;
|
||||
rl.set_helper(Some(cli_helper));
|
||||
|
||||
let mut position = Vec::new();
|
||||
@ -426,7 +429,7 @@ impl Shell {
|
||||
let _ =
|
||||
cli::handle_command_future(helper.cmd_def(), "", args, cli::CliEnvironment::new())
|
||||
.await;
|
||||
this.rl.add_history_entry(line);
|
||||
let _ = this.rl.add_history_entry(line);
|
||||
this.update_prompt();
|
||||
}
|
||||
Ok(())
|
||||
|
@ -630,7 +630,11 @@ impl Archiver {
|
||||
let mut stat_results: Option<FileStat> = None;
|
||||
|
||||
let get_file_mode = || {
|
||||
nix::sys::stat::fstatat(dir_fd, file_name, nix::fcntl::AtFlags::AT_SYMLINK_NOFOLLOW)
|
||||
nix::sys::stat::fstatat(
|
||||
Some(dir_fd),
|
||||
file_name,
|
||||
nix::fcntl::AtFlags::AT_SYMLINK_NOFOLLOW,
|
||||
)
|
||||
};
|
||||
|
||||
let match_result = self
|
||||
@ -1309,7 +1313,7 @@ impl Archiver {
|
||||
file_name: &Path,
|
||||
metadata: &Metadata,
|
||||
) -> Result<(), Error> {
|
||||
let dest = match nix::fcntl::readlinkat(fd.as_raw_fd(), &b""[..]) {
|
||||
let dest = match nix::fcntl::readlinkat(Some(fd.as_raw_fd()), &b""[..]) {
|
||||
Ok(dest) => dest,
|
||||
Err(Errno::ESTALE) => {
|
||||
self.report_stale_file_handle(None);
|
||||
|
@ -41,7 +41,7 @@ impl PxarDir {
|
||||
allow_existing_dirs: bool,
|
||||
) -> Result<BorrowedFd, Error> {
|
||||
if let Err(err) = mkdirat(
|
||||
parent,
|
||||
Some(parent),
|
||||
self.file_name.as_os_str(),
|
||||
perms_from_metadata(&self.metadata)?,
|
||||
) {
|
||||
@ -55,7 +55,7 @@ impl PxarDir {
|
||||
|
||||
fn open_dir(&mut self, parent: RawFd) -> Result<BorrowedFd, Error> {
|
||||
let dir = Dir::openat(
|
||||
parent,
|
||||
Some(parent),
|
||||
self.file_name.as_os_str(),
|
||||
OFlag::O_DIRECTORY | OFlag::O_CLOEXEC,
|
||||
Mode::empty(),
|
||||
|
@ -627,7 +627,7 @@ impl Extractor {
|
||||
target.as_c_str(),
|
||||
Some(parent),
|
||||
file_name,
|
||||
nix::unistd::LinkatFlags::NoSymlinkFollow,
|
||||
nix::fcntl::AtFlags::AT_SYMLINK_NOFOLLOW,
|
||||
)
|
||||
};
|
||||
|
||||
@ -697,8 +697,13 @@ impl Extractor {
|
||||
}
|
||||
let mut file = unsafe {
|
||||
std::fs::File::from_raw_fd(
|
||||
nix::fcntl::openat(parent, file_name, oflags, Mode::from_bits(0o600).unwrap())
|
||||
.with_context(|| format!("failed to create file {file_name:?}"))?,
|
||||
nix::fcntl::openat(
|
||||
Some(parent),
|
||||
file_name,
|
||||
oflags,
|
||||
Mode::from_bits(0o600).unwrap(),
|
||||
)
|
||||
.with_context(|| format!("failed to create file {file_name:?}"))?,
|
||||
)
|
||||
};
|
||||
|
||||
@ -722,7 +727,7 @@ impl Extractor {
|
||||
}
|
||||
|
||||
if result.seeked_last {
|
||||
while match nix::unistd::ftruncate(file.as_raw_fd(), size as i64) {
|
||||
while match nix::unistd::ftruncate(&file, size as i64) {
|
||||
Ok(_) => false,
|
||||
Err(nix::errno::Errno::EINTR) => true,
|
||||
Err(err) => return Err(err).context("error setting file size"),
|
||||
@ -758,8 +763,13 @@ impl Extractor {
|
||||
}
|
||||
let mut file = tokio::fs::File::from_std(unsafe {
|
||||
std::fs::File::from_raw_fd(
|
||||
nix::fcntl::openat(parent, file_name, oflags, Mode::from_bits(0o600).unwrap())
|
||||
.with_context(|| format!("failed to create file {file_name:?}"))?,
|
||||
nix::fcntl::openat(
|
||||
Some(parent),
|
||||
file_name,
|
||||
oflags,
|
||||
Mode::from_bits(0o600).unwrap(),
|
||||
)
|
||||
.with_context(|| format!("failed to create file {file_name:?}"))?,
|
||||
)
|
||||
});
|
||||
|
||||
@ -784,7 +794,7 @@ impl Extractor {
|
||||
}
|
||||
|
||||
if result.seeked_last {
|
||||
while match nix::unistd::ftruncate(file.as_raw_fd(), size as i64) {
|
||||
while match nix::unistd::ftruncate(&file, size as i64) {
|
||||
Ok(_) => false,
|
||||
Err(nix::errno::Errno::EINTR) => true,
|
||||
Err(err) => return Err(err).context("error setting file size"),
|
||||
|
@ -1,3 +1,4 @@
|
||||
use std::os::fd::{AsRawFd, IntoRawFd};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
@ -76,10 +77,11 @@ impl tower_service::Service<Uri> for VsockConnector {
|
||||
)?;
|
||||
|
||||
let sock_addr = VsockAddr::new(cid, port as u32);
|
||||
connect(sock_fd, &sock_addr)?;
|
||||
connect(sock_fd.as_raw_fd(), &sock_addr)?;
|
||||
|
||||
// connect sync, but set nonblock after (tokio requires it)
|
||||
let std_stream = unsafe { std::os::unix::net::UnixStream::from_raw_fd(sock_fd) };
|
||||
let std_stream =
|
||||
unsafe { std::os::unix::net::UnixStream::from_raw_fd(sock_fd.into_raw_fd()) };
|
||||
std_stream.set_nonblocking(true)?;
|
||||
|
||||
let stream = tokio::net::UnixStream::from_std(std_stream)?;
|
||||
|
Loading…
Reference in New Issue
Block a user