From e08252cad7b565176d50616bb7db0345fa72e19e Mon Sep 17 00:00:00 2001 From: Noa Date: Wed, 8 Feb 2023 18:32:35 -0600 Subject: [PATCH 1/3] Use nix for more things --- Cargo.lock | 25 +++++- Cargo.toml | 2 +- stdlib/src/posixsubprocess.rs | 9 ++- stdlib/src/socket.rs | 123 +++++++---------------------- vm/src/stdlib/posix.rs | 40 ++++------ vm/src/stdlib/time.rs | 141 ++++++++++++---------------------- 6 files changed, 118 insertions(+), 222 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e177c9773..32afa5b21 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1349,7 +1349,20 @@ dependencies = [ "bitflags", "cfg-if", "libc", - "memoffset 0.6.5", +] + +[[package]] +name = "nix" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +dependencies = [ + "bitflags", + "cfg-if", + "libc", + "memoffset 0.7.1", + "pin-utils", + "static_assertions", ] [[package]] @@ -1611,6 +1624,12 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.26" @@ -2120,7 +2139,7 @@ dependencies = [ "memchr", "memmap2", "mt19937", - "nix 0.24.2", + "nix 0.26.2", "num-bigint", "num-complex", "num-integer", @@ -2188,7 +2207,7 @@ dependencies = [ "log", "memchr", "memoffset 0.6.5", - "nix 0.24.2", + "nix 0.26.2", "num-bigint", "num-complex", "num-integer", diff --git a/Cargo.toml b/Cargo.toml index 3ea9c165e..f305420ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ insta = "1.14.0" itertools = "0.10.3" libc = "0.2.133" log = "0.4.16" -nix = "0.24" +nix = "0.26" num-complex = "0.4.0" num-bigint = "0.4.3" num-integer = "0.1.44" diff --git a/stdlib/src/posixsubprocess.rs b/stdlib/src/posixsubprocess.rs index a1ea0c134..ad3d89227 100644 --- a/stdlib/src/posixsubprocess.rs +++ b/stdlib/src/posixsubprocess.rs @@ -177,6 +177,8 @@ fn exec_inner(args: &ForkExecArgs, procargs: ProcArgs) -> nix::Result { let mut first_err = None; for exec in args.exec_list.as_slice() { + // not using nix's versions of these functions because those allocate the char-ptr array, + // and we can't allocate if let Some(envp) = procargs.envp { unsafe { libc::execve(exec.s.as_ptr(), procargs.argv.as_ptr(), envp.as_ptr()) }; } else { @@ -195,9 +197,8 @@ fn close_fds(above: i32, keep: &[i32]) -> nix::Result<()> { use nix::{dir::Dir, fcntl::OFlag}; // TODO: close fds by brute force if readdir doesn't work: // https://github.com/python/cpython/blob/3.8/Modules/_posixsubprocess.c#L220 - let path = unsafe { CStr::from_bytes_with_nul_unchecked(FD_DIR_NAME) }; let mut dir = Dir::open( - path, + FD_DIR_NAME, OFlag::O_RDONLY | OFlag::O_DIRECTORY, nix::sys::stat::Mode::empty(), )?; @@ -219,10 +220,10 @@ fn close_fds(above: i32, keep: &[i32]) -> nix::Result<()> { target_os = "openbsd", target_vendor = "apple", ))] -const FD_DIR_NAME: &[u8] = b"/dev/fd\0"; +const FD_DIR_NAME: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"/dev/fd\0") }; #[cfg(any(target_os = "linux", target_os = "android"))] -const FD_DIR_NAME: &[u8] = b"/proc/self/fd\0"; +const FD_DIR_NAME: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"/proc/self/fd\0") }; #[cfg(not(target_os = "redox"))] fn pos_int_from_ascii(name: &CStr) -> Option { diff --git a/stdlib/src/socket.rs b/stdlib/src/socket.rs index 8b9d4fb0c..d513b93e2 100644 --- a/stdlib/src/socket.rs +++ b/stdlib/src/socket.rs @@ -891,53 +891,8 @@ mod _socket { use std::os::unix::ffi::OsStrExt; let buf = crate::vm::function::ArgStrOrBytesLike::try_from_object(vm, addr)?; let path = &*buf.borrow_bytes(); - if cfg!(any(target_os = "linux", target_os = "android")) - && path.first() == Some(&0) - { - use libc::{sa_family_t, socklen_t}; - use {socket2::SockAddr, std::ptr}; - unsafe { - // based on SockAddr::unix - // TODO: upstream or fix socklen check for SockAddr::unix()? - SockAddr::init(|storage, len| { - // Safety: `SockAddr::init` zeros the address, which is a valid - // representation. - let storage: &mut libc::sockaddr_un = &mut *storage.cast(); - let len: &mut socklen_t = &mut *len; - - let bytes = path; - if bytes.len() > storage.sun_path.len() { - return Err(io::Error::new( - io::ErrorKind::InvalidInput, - "path must be shorter than SUN_LEN", - )); - } - - storage.sun_family = libc::AF_UNIX as sa_family_t; - // Safety: `bytes` and `addr.sun_path` are not overlapping and - // both point to valid memory. - // `SockAddr::init` zeroes the memory, so the path is already - // null terminated. - ptr::copy_nonoverlapping( - bytes.as_ptr(), - storage.sun_path.as_mut_ptr() as *mut u8, - bytes.len(), - ); - - let base = storage as *const _ as usize; - let path = &storage.sun_path as *const _ as usize; - let sun_path_offset = path - base; - let length = sun_path_offset + bytes.len(); - *len = length as socklen_t; - - Ok(()) - }) - } - .map(|(_, addr)| addr) - } else { - socket2::SockAddr::unix(ffi::OsStr::from_bytes(path)) - } - .map_err(|_| vm.new_os_error("AF_UNIX path too long".to_owned()).into()) + socket2::SockAddr::unix(ffi::OsStr::from_bytes(path)) + .map_err(|_| vm.new_os_error("AF_UNIX path too long".to_owned()).into()) } c::AF_INET => { let tuple: PyTupleRef = addr.downcast().map_err(|obj| { @@ -1087,20 +1042,7 @@ mod _socket { _ => {} } if socket_kind == -1 { - // TODO: when socket2 cuts a new release, type will be available on all os - // socket_kind = sock.r#type().map_err(|e| e.into_pyexception(vm))?.into(); - let res = unsafe { - c::getsockopt( - sock_fileno(&sock) as _, - c::SOL_SOCKET, - c::SO_TYPE, - &mut socket_kind as *mut libc::c_int as *mut _, - &mut (std::mem::size_of::() as _), - ) - }; - if res < 0 { - return Err(crate::common::os::errno().into()); - } + socket_kind = sock.r#type().map_err(|e| e.into_pyexception(vm))?.into(); } cfg_if::cfg_if! { if #[cfg(any( @@ -1601,30 +1543,23 @@ mod _socket { if let Some(addr) = addr.as_socket() { return get_ip_addr_tuple(&addr, vm); } - match addr.family() as i32 { - #[cfg(unix)] - libc::AF_UNIX => { - let addr_len = addr.len() as usize; - let unix_addr = unsafe { &*(addr.as_ptr() as *const libc::sockaddr_un) }; - let path_u8 = unsafe { &*(&unix_addr.sun_path[..] as *const [_] as *const [u8]) }; - let sun_path_offset = - &unix_addr.sun_path as *const _ as usize - unix_addr as *const _ as usize; - if cfg!(any(target_os = "linux", target_os = "android")) - && addr_len > sun_path_offset - && unix_addr.sun_path[0] == 0 - { - let abstractaddrlen = addr_len - sun_path_offset; - let abstractpath = &path_u8[..abstractaddrlen]; - vm.ctx.new_bytes(abstractpath.to_vec()).into() - } else { - let len = memchr::memchr(b'\0', path_u8).unwrap_or(path_u8.len()); - let path = &path_u8[..len]; - vm.ctx.new_str(String::from_utf8_lossy(path)).into() - } + #[cfg(unix)] + use nix::sys::socket::{SockaddrLike, UnixAddr}; + #[cfg(unix)] + if let Some(unix_addr) = unsafe { UnixAddr::from_raw(addr.as_ptr(), Some(addr.len())) } { + use std::os::unix::ffi::OsStrExt; + #[cfg(any(target_os = "android", target_os = "linux"))] + if let Some(abstractpath) = unix_addr.as_abstract() { + return vm.ctx.new_bytes([b"\0", abstractpath].concat()).into(); } - // TODO: support more address families - _ => (String::new(), 0).to_pyobject(vm), + // necessary on macos + let path = ffi::OsStr::as_bytes(unix_addr.path().unwrap_or("".as_ref()).as_ref()); + let nul_pos = memchr::memchr(b'\0', path).unwrap_or(path.len()); + let path = ffi::OsStr::from_bytes(&path[..nul_pos]); + return vm.ctx.new_str(path.to_string_lossy()).into(); } + // TODO: support more address families + (String::new(), 0).to_pyobject(vm) } #[pyfunction] @@ -1764,25 +1699,19 @@ mod _socket { let fd = sock_fileno(sock); #[cfg(unix)] { - let mut pollfd = libc::pollfd { - fd, - events: match kind { - SelectKind::Read => libc::POLLIN, - SelectKind::Write => libc::POLLOUT, - SelectKind::Connect => libc::POLLOUT | libc::POLLERR, - }, - revents: 0, + use nix::poll::*; + let events = match kind { + SelectKind::Read => PollFlags::POLLIN, + SelectKind::Write => PollFlags::POLLOUT, + SelectKind::Connect => PollFlags::POLLOUT | PollFlags::POLLERR, }; + let mut pollfd = [PollFd::new(fd, events)]; let timeout = match interval { Some(d) => d.as_millis() as _, None => -1, }; - let ret = unsafe { libc::poll(&mut pollfd, 1, timeout) }; - if ret < 0 { - Err(io::Error::last_os_error()) - } else { - Ok(ret == 0) - } + let ret = poll(&mut pollfd, timeout)?; + Ok(ret == 0) } #[cfg(windows)] { diff --git a/vm/src/stdlib/posix.rs b/vm/src/stdlib/posix.rs index 2d16d0b42..7f14b2db5 100644 --- a/vm/src/stdlib/posix.rs +++ b/vm/src/stdlib/posix.rs @@ -1091,13 +1091,9 @@ pub mod module { #[pyfunction] fn ttyname(fd: i32, vm: &VirtualMachine) -> PyResult { - let name = unsafe { libc::ttyname(fd) }; - if name.is_null() { - Err(errno_err(vm)) - } else { - let name = unsafe { CStr::from_ptr(name) }.to_str().unwrap(); - Ok(vm.ctx.new_str(name).into()) - } + let name = unistd::ttyname(fd).map_err(|e| e.into_pyexception(vm))?; + let name = name.into_os_string().into_string().unwrap(); + Ok(vm.ctx.new_str(name).into()) } #[pyfunction] @@ -1129,30 +1125,24 @@ pub mod module { #[cfg(any(target_os = "android", target_os = "linux", target_os = "openbsd"))] #[pyfunction] fn getresuid(vm: &VirtualMachine) -> PyResult<(u32, u32, u32)> { - let mut ruid = 0; - let mut euid = 0; - let mut suid = 0; - let ret = unsafe { libc::getresuid(&mut ruid, &mut euid, &mut suid) }; - if ret == 0 { - Ok((ruid, euid, suid)) - } else { - Err(errno_err(vm)) - } + let ret = unistd::getresuid().map_err(|e| e.into_pyexception(vm))?; + Ok(( + ret.real.as_raw(), + ret.effective.as_raw(), + ret.saved.as_raw(), + )) } // cfg from nix #[cfg(any(target_os = "android", target_os = "linux", target_os = "openbsd"))] #[pyfunction] fn getresgid(vm: &VirtualMachine) -> PyResult<(u32, u32, u32)> { - let mut rgid = 0; - let mut egid = 0; - let mut sgid = 0; - let ret = unsafe { libc::getresgid(&mut rgid, &mut egid, &mut sgid) }; - if ret == 0 { - Ok((rgid, egid, sgid)) - } else { - Err(errno_err(vm)) - } + let ret = unistd::getresgid().map_err(|e| e.into_pyexception(vm))?; + Ok(( + ret.real.as_raw(), + ret.effective.as_raw(), + ret.saved.as_raw(), + )) } // cfg from nix diff --git a/vm/src/stdlib/time.rs b/vm/src/stdlib/time.rs index a9ab54174..fbf7538bb 100644 --- a/vm/src/stdlib/time.rs +++ b/vm/src/stdlib/time.rs @@ -389,11 +389,11 @@ mod unix { use super::{SEC_TO_NS, US_TO_NS}; #[cfg_attr(target_os = "macos", allow(unused_imports))] use crate::{ - builtins::{try_bigint_to_f64, PyFloat, PyIntRef, PyNamespace, PyStrRef}, - function::Either, - stdlib::os, - PyRef, PyResult, VirtualMachine, + builtins::{PyNamespace, PyStrRef}, + convert::IntoPyException, + PyObject, PyRef, PyResult, TryFromBorrowedObject, VirtualMachine, }; + use nix::{sys::time::TimeSpec, time::ClockId}; use std::time::Duration; #[cfg(target_os = "solaris")] @@ -425,83 +425,62 @@ mod unix { #[pyattr] use libc::{CLOCK_PROF, CLOCK_UPTIME}; - fn get_clock_time(clk_id: PyIntRef, vm: &VirtualMachine) -> PyResult { - let mut timespec = std::mem::MaybeUninit::uninit(); - let ts: libc::timespec = unsafe { - if libc::clock_gettime(clk_id.try_to_primitive(vm)?, timespec.as_mut_ptr()) == -1 { - return Err(os::errno_err(vm)); - } - timespec.assume_init() - }; - Ok(Duration::new(ts.tv_sec as u64, ts.tv_nsec as u32)) + impl TryFromBorrowedObject for ClockId { + fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult { + obj.try_to_value(vm).map(ClockId::from_raw) + } + } + + fn get_clock_time(clk_id: ClockId, vm: &VirtualMachine) -> PyResult { + let ts = nix::time::clock_gettime(clk_id).map_err(|e| e.into_pyexception(vm))?; + Ok(ts.into()) } #[pyfunction] - fn clock_gettime(clk_id: PyIntRef, vm: &VirtualMachine) -> PyResult { + fn clock_gettime(clk_id: ClockId, vm: &VirtualMachine) -> PyResult { get_clock_time(clk_id, vm).map(|d| d.as_secs_f64()) } #[pyfunction] - fn clock_gettime_ns(clk_id: PyIntRef, vm: &VirtualMachine) -> PyResult { + fn clock_gettime_ns(clk_id: ClockId, vm: &VirtualMachine) -> PyResult { get_clock_time(clk_id, vm).map(|d| d.as_nanos()) } #[cfg(not(target_os = "redox"))] #[pyfunction] - fn clock_getres(clk_id: PyIntRef, vm: &VirtualMachine) -> PyResult { - let mut timespec = std::mem::MaybeUninit::uninit(); - let ts: libc::timespec = unsafe { - if libc::clock_getres(clk_id.try_to_primitive(vm)?, timespec.as_mut_ptr()) == -1 { - return Err(os::errno_err(vm)); - } - timespec.assume_init() - }; - Ok(Duration::new(ts.tv_sec as u64, ts.tv_nsec as u32).as_secs_f64()) + fn clock_getres(clk_id: ClockId, vm: &VirtualMachine) -> PyResult { + let ts = nix::time::clock_getres(clk_id).map_err(|e| e.into_pyexception(vm))?; + Ok(Duration::from(ts).as_secs_f64()) } #[cfg(not(target_os = "redox"))] - #[cfg(any(not(target_vendor = "apple"), target_os = "macos"))] - fn set_clock_time( - clk_id: PyIntRef, - timespec: libc::timespec, - vm: &VirtualMachine, - ) -> PyResult<()> { - let res = unsafe { libc::clock_settime(clk_id.try_to_primitive(vm)?, ×pec) }; - if res == -1 { - return Err(os::errno_err(vm)); - } - Ok(()) + #[cfg(not(target_vendor = "apple"))] + fn set_clock_time(clk_id: ClockId, timespec: TimeSpec, vm: &VirtualMachine) -> PyResult<()> { + nix::time::clock_settime(clk_id, timespec).map_err(|e| e.into_pyexception(vm)) + } + + #[cfg(not(target_os = "redox"))] + #[cfg(target_os = "macos")] + fn set_clock_time(clk_id: ClockId, timespec: TimeSpec, vm: &VirtualMachine) -> PyResult<()> { + // idk why nix disables clock_settime on macos + let ret = unsafe { libc::clock_settime(clk_id.as_raw(), timespec.as_ref()) }; + nix::Error::result(ret) + .map(drop) + .map_err(|e| e.into_pyexception(vm)) } #[cfg(not(target_os = "redox"))] #[cfg(any(not(target_vendor = "apple"), target_os = "macos"))] #[pyfunction] - fn clock_settime( - clk_id: PyIntRef, - time: Either, PyIntRef>, - vm: &VirtualMachine, - ) -> PyResult<()> { - let time = match time { - Either::A(f) => f.to_f64(), - Either::B(z) => try_bigint_to_f64(z.as_bigint(), vm)?, - }; - let nanos = time.fract() * (SEC_TO_NS as f64); - let ts = libc::timespec { - tv_sec: time.floor() as libc::time_t, - tv_nsec: nanos as _, - }; - set_clock_time(clk_id, ts, vm) + fn clock_settime(clk_id: ClockId, time: Duration, vm: &VirtualMachine) -> PyResult<()> { + set_clock_time(clk_id, time.into(), vm) } #[cfg(not(target_os = "redox"))] #[cfg(any(not(target_vendor = "apple"), target_os = "macos"))] #[pyfunction] - fn clock_settime_ns(clk_id: PyIntRef, time: PyIntRef, vm: &VirtualMachine) -> PyResult<()> { - let time: libc::time_t = time.try_to_primitive(vm)?; - let ts = libc::timespec { - tv_sec: time / (SEC_TO_NS as libc::time_t), - tv_nsec: time.rem_euclid(SEC_TO_NS as libc::time_t) as _, - }; + fn clock_settime_ns(clk_id: ClockId, time: libc::time_t, vm: &VirtualMachine) -> PyResult<()> { + let ts = Duration::from_nanos(time as _).into(); set_clock_time(clk_id, ts, vm) } @@ -522,25 +501,25 @@ mod unix { false, "time.clock_gettime(CLOCK_MONOTONIC)", true, - clock_getres(vm.ctx.new_int(CLOCK_MONOTONIC), vm)?, + clock_getres(ClockId::CLOCK_MONOTONIC, vm)?, ), "process_time" => ( false, "time.clock_gettime(CLOCK_PROCESS_CPUTIME_ID)", true, - clock_getres(vm.ctx.new_int(CLOCK_PROCESS_CPUTIME_ID), vm)?, + clock_getres(ClockId::CLOCK_PROCESS_CPUTIME_ID, vm)?, ), "thread_time" => ( false, "time.clock_gettime(CLOCK_THREAD_CPUTIME_ID)", true, - clock_getres(vm.ctx.new_int(CLOCK_THREAD_CPUTIME_ID), vm)?, + clock_getres(ClockId::CLOCK_THREAD_CPUTIME_ID, vm)?, ), "time" => ( true, "time.clock_gettime(CLOCK_REALTIME)", false, - clock_getres(vm.ctx.new_int(CLOCK_REALTIME), vm)?, + clock_getres(ClockId::CLOCK_REALTIME, vm)?, ), _ => return Err(vm.new_value_error("unknown clock".to_owned())), }; @@ -568,22 +547,19 @@ mod unix { } pub(super) fn get_monotonic_time(vm: &VirtualMachine) -> PyResult { - get_clock_time(vm.ctx.new_int(CLOCK_MONOTONIC), vm) + get_clock_time(ClockId::CLOCK_MONOTONIC, vm) } pub(super) fn get_perf_time(vm: &VirtualMachine) -> PyResult { - get_clock_time(vm.ctx.new_int(CLOCK_MONOTONIC), vm) + get_clock_time(ClockId::CLOCK_MONOTONIC, vm) } #[pyfunction] fn sleep(dur: Duration, vm: &VirtualMachine) -> PyResult<()> { // this is basically std::thread::sleep, but that catches interrupts and we don't want to; - let mut ts = libc::timespec { - tv_sec: std::cmp::min(libc::time_t::max_value() as u64, dur.as_secs()) as libc::time_t, - tv_nsec: dur.subsec_nanos() as _, - }; - let res = unsafe { libc::nanosleep(&ts, &mut ts) }; + let ts = TimeSpec::from(dur); + let res = unsafe { libc::nanosleep(ts.as_ref(), std::ptr::null_mut()) }; let interrupted = res == -1 && nix::errno::errno() == libc::EINTR; if interrupted { @@ -600,14 +576,7 @@ mod unix { target_os = "redox" )))] pub(super) fn get_thread_time(vm: &VirtualMachine) -> PyResult { - let time: libc::timespec = unsafe { - let mut time = std::mem::MaybeUninit::uninit(); - if libc::clock_gettime(CLOCK_THREAD_CPUTIME_ID, time.as_mut_ptr()) == -1 { - return Err(vm.new_os_error("Failed to get clock time".to_owned())); - } - time.assume_init() - }; - Ok(Duration::new(time.tv_sec as u64, time.tv_nsec as u32)) + get_clock_time(ClockId::CLOCK_THREAD_CPUTIME_ID, vm) } #[cfg(target_os = "solaris")] @@ -622,14 +591,7 @@ mod unix { target_os = "openbsd", )))] pub(super) fn get_process_time(vm: &VirtualMachine) -> PyResult { - let time: libc::timespec = unsafe { - let mut time = std::mem::MaybeUninit::uninit(); - if libc::clock_gettime(CLOCK_PROCESS_CPUTIME_ID, time.as_mut_ptr()) == -1 { - return Err(vm.new_os_error("Failed to get clock time".to_owned())); - } - time.assume_init() - }; - Ok(Duration::new(time.tv_sec as u64, time.tv_nsec as u32)) + get_clock_time(ClockId::CLOCK_PROCESS_CPUTIME_ID, vm) } #[cfg(any( @@ -639,6 +601,7 @@ mod unix { target_os = "openbsd", ))] pub(super) fn get_process_time(vm: &VirtualMachine) -> PyResult { + use nix::sys::resource::{getrusage, UsageWho}; fn from_timeval(tv: libc::timeval, vm: &VirtualMachine) -> PyResult { (|tv: libc::timeval| { let t = tv.tv_sec.checked_mul(SEC_TO_NS)?; @@ -649,15 +612,9 @@ mod unix { vm.new_overflow_error("timestamp too large to convert to i64".to_owned()) }) } - let ru: libc::rusage = unsafe { - let mut ru = std::mem::MaybeUninit::uninit(); - if libc::getrusage(libc::RUSAGE_SELF, ru.as_mut_ptr()) == -1 { - return Err(vm.new_os_error("Failed to get clock time".to_owned())); - } - ru.assume_init() - }; - let utime = from_timeval(ru.ru_utime, vm)?; - let stime = from_timeval(ru.ru_stime, vm)?; + let ru = getrusage(UsageWho::RUSAGE_SELF).map_err(|e| e.into_pyexception(vm))?; + let utime = from_timeval(ru.user_time().into(), vm)?; + let stime = from_timeval(ru.system_time().into(), vm)?; Ok(Duration::from_nanos((utime + stime) as u64)) } From d9e3f9ca683c7da8425bf1ee35c03b16c6e828f1 Mon Sep 17 00:00:00 2001 From: Noa Date: Thu, 16 Feb 2023 12:17:14 -0600 Subject: [PATCH 2/3] Tidy up ssl a little --- stdlib/src/ssl.rs | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/stdlib/src/ssl.rs b/stdlib/src/ssl.rs index f964c443b..c7726203c 100644 --- a/stdlib/src/ssl.rs +++ b/stdlib/src/ssl.rs @@ -26,7 +26,9 @@ mod _ssl { use crate::{ common::{ ascii, - lock::{PyMutex, PyRwLock, PyRwLockWriteGuard}, + lock::{ + PyMappedRwLockReadGuard, PyMutex, PyRwLock, PyRwLockReadGuard, PyRwLockWriteGuard, + }, }, socket::{self, PySocket}, vm::{ @@ -504,12 +506,8 @@ mod _ssl { fn builder(&self) -> PyRwLockWriteGuard<'_, SslContextBuilder> { self.ctx.write() } - fn exec_ctx(&self, func: F) -> R - where - F: Fn(&ssl::SslContextRef) -> R, - { - let c = self.ctx.read(); - func(builder_as_ctx(&c)) + fn ctx(&self) -> PyMappedRwLockReadGuard<'_, ssl::SslContextRef> { + PyRwLockReadGuard::map(self.ctx.read(), builder_as_ctx) } #[pygetset] @@ -554,7 +552,7 @@ mod _ssl { } #[pygetset] fn verify_mode(&self) -> i32 { - let mode = self.exec_ctx(|ctx| ctx.verify_mode()); + let mode = self.ctx().verify_mode(); if mode == SslVerifyMode::NONE { CertRequirements::None.into() } else if mode == SslVerifyMode::PEER { @@ -703,16 +701,15 @@ mod _ssl { vm: &VirtualMachine, ) -> PyResult> { let binary_form = binary_form.unwrap_or(false); - self.exec_ctx(|ctx| { - let certs = ctx - .cert_store() - .objects() - .iter() - .filter_map(|obj| obj.x509()) - .map(|cert| cert_to_py(vm, cert, binary_form)) - .collect::, _>>()?; - Ok(certs) - }) + let certs = self + .ctx() + .cert_store() + .objects() + .iter() + .filter_map(|obj| obj.x509()) + .map(|cert| cert_to_py(vm, cert, binary_form)) + .collect::, _>>()?; + Ok(certs) } #[pymethod] @@ -746,9 +743,7 @@ mod _ssl { args: WrapSocketArgs, vm: &VirtualMachine, ) -> PyResult { - let mut ssl = zelf - .exec_ctx(ssl::Ssl::new) - .map_err(|e| convert_openssl_error(vm, e))?; + let mut ssl = ssl::Ssl::new(&zelf.ctx()).map_err(|e| convert_openssl_error(vm, e))?; let socket_type = if args.server_side { ssl.set_accept_state(); From abe8cfdf1c886580bd7283e7d7ed21982c9b36fc Mon Sep 17 00:00:00 2001 From: Noa Date: Thu, 16 Feb 2023 12:21:15 -0600 Subject: [PATCH 3/3] Run cargo-update --- Cargo.lock | 438 ++++++++++++++++++++++++++++------------------------- 1 file changed, 234 insertions(+), 204 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 32afa5b21..0c36cd785 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -60,9 +60,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "approx" @@ -109,7 +109,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -158,9 +158,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake2" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ "digest", ] @@ -183,14 +183,13 @@ dependencies = [ "lazy_static 1.4.0", "memchr", "regex-automata", - "serde", ] [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byteorder" @@ -237,9 +236,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.77" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -279,9 +278,9 @@ dependencies = [ [[package]] name = "clipboard-win" -version = "4.4.2" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4ab1b92798304eedc095b53942963240037c0516452cb11aeba709d420b2219" +checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" dependencies = [ "error-code", "str-buf", @@ -300,15 +299,14 @@ dependencies = [ [[package]] name = "console" -version = "0.15.2" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c" +checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" dependencies = [ "encode_unicode", "lazy_static 1.4.0", "libc", - "terminal_size", - "winapi", + "windows-sys 0.42.0", ] [[package]] @@ -580,13 +578,12 @@ dependencies = [ [[package]] name = "csv" -version = "1.1.6" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +checksum = "af91f40b7355f82b0a891f50e70399475945bb0b0da4f1700ce60761c9d3e359" dependencies = [ - "bstr", "csv-core", - "itoa 0.4.8", + "itoa", "ryu", "serde", ] @@ -602,9 +599,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.82" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" +checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" dependencies = [ "cc", "cxxbridge-flags", @@ -614,9 +611,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.82" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" +checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" dependencies = [ "cc", "codespan-reporting", @@ -629,15 +626,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.82" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" +checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" [[package]] name = "cxxbridge-macro" -version = "1.0.82" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" +checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" dependencies = [ "proc-macro2", "quote", @@ -696,9 +693,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "ena" @@ -771,13 +768,13 @@ checksum = "de853764b47027c2e862a995c34978ffa63c1501f2e15f987ba11bd4f9bba193" [[package]] name = "fd-lock" -version = "3.0.8" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb21c69b9fea5e15dbc1049e4b77145dd0ba1c84019c488102de0dc4ea4b0a27" +checksum = "8ef1a30ae415c3a691a4f41afddc2dbcd6d70baf338368d85ebc1e8ed92cedb9" dependencies = [ "cfg-if", "rustix", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -824,9 +821,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", "libz-sys", @@ -898,9 +895,9 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "half" @@ -916,9 +913,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -929,6 +926,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" @@ -977,9 +983,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.21.1" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1e75aa1530e7385af7b2685478dece08dafb9db3b4225c753286decea83bef" +checksum = "fea5b3894afe466b4bcf0388630fc15e11938a6074af0cd637c825ba2ec8a099" dependencies = [ "console", "lazy_static 1.4.0", @@ -990,12 +996,12 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.1" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7d367024b3f3414d8e01f437f704f41a9f64ab36f9067fa73e526ad4c763c87" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" dependencies = [ "libc", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -1022,21 +1028,15 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.8" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "itoa" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] @@ -1126,9 +1126,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.137" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libffi" @@ -1174,9 +1174,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] @@ -1189,9 +1189,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "lock_api" @@ -1227,7 +1227,7 @@ version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b238e3235c8382b7653c6408ed1b08dd379bdb9fdf990fb0bbae3db2cc0ae963" dependencies = [ - "nix 0.23.1", + "nix 0.23.2", "winapi", ] @@ -1248,9 +1248,9 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "matches" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "md-5" @@ -1296,9 +1296,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] @@ -1329,9 +1329,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" +checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" dependencies = [ "bitflags", "cc", @@ -1342,10 +1342,11 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.2" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ + "autocfg", "bitflags", "cfg-if", "libc", @@ -1365,6 +1366,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + [[package]] name = "num-bigint" version = "0.4.3" @@ -1379,9 +1389,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ "num-traits", "serde", @@ -1420,28 +1430,28 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] [[package]] name = "num_enum" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +checksum = "8d829733185c1ca374f17e52b762f24f535ec625d2cc1f070e34c8a9068f341b" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +checksum = "2be1598bf1c313dcdd12092e3f1920f463462525a21b7b4e11b4168353d0123e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1451,9 +1461,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "oorandom" @@ -1544,28 +1554,28 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", "redox_syscall 0.2.16", "smallvec", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "paste" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "petgraph" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", "indexmap", @@ -1689,20 +1699,19 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] @@ -1725,9 +1734,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -1780,20 +1789,19 @@ dependencies = [ [[package]] name = "rayon" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e060280438193c554f654141c9ea9417886713b7acd75974c85b18a69a88e0b" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" dependencies = [ - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.10.1" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -1841,9 +1849,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -1913,16 +1921,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.3" +version = "0.36.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b1fbb4dfc4eb1d390c02df47760bb19a84bb80b301ecc947ab5406394d8223e" +checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -2274,15 +2282,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "rustyline" -version = "10.0.0" +version = "10.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1cd5ae51d3f7bf65d7969d579d502168ef578f289452bd8ccc91de28fda20e" +checksum = "c1e83c32c3f3c33b08496e0d1df9ea8c64d39adb8eb36a1ebb1440c690697aef" dependencies = [ "bitflags", "cfg-if", @@ -2292,7 +2300,7 @@ dependencies = [ "libc", "log", "memchr", - "nix 0.24.2", + "nix 0.25.1", "radix_trie", "scopeguard", "unicode-segmentation", @@ -2303,9 +2311,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "same-file" @@ -2318,12 +2326,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "lazy_static 1.4.0", - "windows-sys 0.36.1", + "windows-sys 0.42.0", ] [[package]] @@ -2334,21 +2341,21 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" [[package]] name = "serde" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] @@ -2377,9 +2384,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -2388,20 +2395,20 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ - "itoa 1.0.4", + "itoa", "ryu", "serde", ] [[package]] name = "sha-1" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" dependencies = [ "cfg-if", "cpufeatures", @@ -2532,9 +2539,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.103" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -2573,9 +2580,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" +checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" [[package]] name = "term" @@ -2590,23 +2597,13 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] -[[package]] -name = "terminal_size" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "termios" version = "0.3.3" @@ -2633,18 +2630,18 @@ checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d" [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -2664,18 +2661,19 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if", "once_cell", ] [[package]] name = "time" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", @@ -2718,17 +2716,25 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] -name = "toml" -version = "0.5.9" +name = "toml_datetime" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" + +[[package]] +name = "toml_edit" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" dependencies = [ - "serde", + "indexmap", + "nom8", + "toml_datetime", ] [[package]] @@ -2743,9 +2749,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "uname" @@ -2880,9 +2886,9 @@ checksum = "623f59e6af2a98bdafeb93fa277ac8e1e40440973001ca15cf4ae1541cd16d56" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" @@ -2895,9 +2901,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" @@ -2925,9 +2931,9 @@ checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" [[package]] name = "uuid" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" +checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" dependencies = [ "atomic", "getrandom", @@ -2937,9 +2943,9 @@ dependencies = [ [[package]] name = "uuid-macro-internal" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73bc89f2894593e665241e0052c3791999e6787b7c4831daa0a5c2e637e276d8" +checksum = "c1b300a878652a387d2a0de915bdae8f1a548f0c6d45e072fe2688794b656cc9" dependencies = [ "proc-macro2", "quote", @@ -2995,9 +3001,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3005,9 +3011,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -3020,9 +3026,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" dependencies = [ "cfg-if", "js-sys", @@ -3032,9 +3038,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3042,9 +3048,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -3055,15 +3061,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" dependencies = [ "js-sys", "wasm-bindgen", @@ -3071,9 +3077,9 @@ dependencies = [ [[package]] name = "which" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" dependencies = [ "either", "libc", @@ -3150,19 +3156,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" @@ -3178,9 +3208,9 @@ checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" @@ -3196,9 +3226,9 @@ checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" @@ -3214,9 +3244,9 @@ checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" @@ -3232,15 +3262,15 @@ checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" @@ -3256,9 +3286,9 @@ checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "winreg"