Bump nix and ctrlc crate to resolve audit failures (#20558)

* Bump nix and ctrlc

* Update to direct error variants

* Use statement cleanup
This commit is contained in:
Tyera Eulberg 2021-10-08 17:18:33 -06:00 committed by GitHub
parent 0545306f0c
commit 78f9e65f30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 29 deletions

13
Cargo.lock generated
View File

@ -990,9 +990,9 @@ dependencies = [
[[package]]
name = "ctrlc"
version = "3.1.9"
version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "232295399409a8b7ae41276757b5a1cc21032848d42bff2352261f958b3ca29a"
checksum = "a19c6cedffdc8c03a3346d723eb20bd85a13362bb96dc2ac000842c6381ec7bf"
dependencies = [
"nix",
"winapi 0.3.9",
@ -2469,9 +2469,9 @@ dependencies = [
[[package]]
name = "memoffset"
version = "0.6.1"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
dependencies = [
"autocfg 1.0.0",
]
@ -2603,14 +2603,15 @@ dependencies = [
[[package]]
name = "nix"
version = "0.20.0"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a"
checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
"memoffset",
]
[[package]]

View File

@ -14,7 +14,7 @@ bincode = "1.3.3"
bs58 = "0.4.0"
clap = "2.33.1"
criterion-stats = "0.3.0"
ctrlc = { version = "3.1.9", features = ["termination"] }
ctrlc = { version = "3.2.1", features = ["termination"] }
console = "0.14.1"
const_format = "0.2.21"
log = "0.4.14"

View File

@ -16,11 +16,11 @@ bzip2 = "0.4.3"
chrono = { version = "0.4.11", features = ["serde"] }
clap = { version = "2.33.1" }
console = "0.14.1"
ctrlc = { version = "3.1.9", features = ["termination"] }
ctrlc = { version = "3.2.1", features = ["termination"] }
dirs-next = "2.0.0"
indicatif = "0.16.2"
lazy_static = "1.4.0"
nix = "0.20.0"
nix = "0.23.0"
reqwest = { version = "0.11.5", default-features = false, features = ["blocking", "rustls-tls", "json"] }
serde = { version = "1.0.130", features = ["derive"] }
serde_yaml = "0.8.21"

View File

@ -1,5 +1,4 @@
use std::io;
use std::process::Child;
use std::{io, process::Child};
fn kill_process(process: &mut Child) -> Result<(), io::Error> {
if let Ok(()) = process.kill() {
@ -17,13 +16,18 @@ pub fn stop_process(process: &mut Child) -> Result<(), io::Error> {
#[cfg(not(windows))]
pub fn stop_process(process: &mut Child) -> Result<(), io::Error> {
use nix::errno::Errno::{EINVAL, EPERM, ESRCH};
use nix::sys::signal::{kill, Signal};
use nix::unistd::Pid;
use nix::Error::Sys;
use std::io::ErrorKind;
use std::thread;
use std::time::{Duration, Instant};
use {
nix::{
errno::Errno::{EINVAL, EPERM, ESRCH},
sys::signal::{kill, Signal},
unistd::Pid,
},
std::{
io::ErrorKind,
thread,
time::{Duration, Instant},
},
};
let nice_wait = Duration::from_secs(5);
let pid = Pid::from_raw(process.id() as i32);
@ -40,17 +44,17 @@ pub fn stop_process(process: &mut Child) -> Result<(), io::Error> {
kill_process(process)?;
}
}
Err(Sys(EINVAL)) => {
Err(EINVAL) => {
println!("Invalid signal. Killing process {}", pid);
kill_process(process)?;
}
Err(Sys(EPERM)) => {
Err(EPERM) => {
return Err(io::Error::new(
ErrorKind::InvalidInput,
format!("Insufficient permissions to signal process {}", pid),
));
}
Err(Sys(ESRCH)) => {
Err(ESRCH) => {
return Err(io::Error::new(
ErrorKind::InvalidInput,
format!("Process {} does not exist", pid),

View File

@ -13,7 +13,7 @@ edition = "2018"
bincode = "1.3.3"
clap = "2.33.1"
log = "0.4.14"
nix = "0.20.0"
nix = "0.23.0"
rand = "0.7.0"
serde = "1.0.130"
serde_derive = "1.0.103"

View File

@ -1499,9 +1499,9 @@ dependencies = [
[[package]]
name = "memoffset"
version = "0.6.1"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
dependencies = [
"autocfg",
]
@ -1557,14 +1557,15 @@ dependencies = [
[[package]]
name = "nix"
version = "0.20.0"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a"
checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
"memoffset",
]
[[package]]

View File

@ -17,7 +17,7 @@ solana-sdk = { path = "../sdk", version = "=1.9.0" }
thiserror = "1.0"
solana-logger = { path = "../logger", version = "=1.9.0" }
libc = "0.2.103"
nix = "0.20.0"
nix = "0.23.0"
solana-perf = { path = "../perf", version = "=1.9.0" }
[dev-dependencies]

View File

@ -20,7 +20,7 @@ solana-version = { path = "../version", version = "=1.9.0" }
[target."cfg(unix)".dependencies]
unix_socket2 = "0.5.4"
users = "0.10.0"
nix = "0.20.0"
nix = "0.23.0"
sysctl = "0.4.2"
[lib]

View File

@ -14,7 +14,7 @@ chrono = { version = "0.4", features = ["serde"] }
clap = "2.33.0"
console = "0.14.1"
csv = "1.1.6"
ctrlc = { version = "3.1.9", features = ["termination"] }
ctrlc = { version = "3.2.1", features = ["termination"] }
indexmap = "1.7.0"
indicatif = "0.16.2"
pickledb = "0.4.1"