diff --git a/Cargo.lock b/Cargo.lock index 42127f846c..afc992f004 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3270,9 +3270,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ryu" @@ -3966,9 +3966,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -3978,7 +3978,7 @@ dependencies = [ "powerfmt", "serde", "time-core", - "time-macros 0.2.17", + "time-macros 0.2.18", ] [[package]] @@ -3999,9 +3999,9 @@ dependencies = [ [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -4365,14 +4365,41 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vergen" -version = "8.3.2" +version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2990d9ea5967266ea0ccf413a4aa5c42a93dbcfda9cb49a97de6931726b12566" +checksum = "c32e7318e93a9ac53693b6caccfb05ff22e04a44c7cf8a279051f24c09da286f" dependencies = [ "anyhow", - "cfg-if", + "derive_builder 0.20.0", + "rustversion", + "time 0.3.36", + "vergen-lib", +] + +[[package]] +name = "vergen-gitcl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bbdc9746577cb4767f218d320ee0b623d415e8130332f8f562b910b61cc2c4e" +dependencies = [ + "anyhow", + "derive_builder 0.20.0", + "rustversion", + "time 0.3.36", + "vergen", + "vergen-lib", +] + +[[package]] +name = "vergen-lib" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e06bee42361e43b60f363bad49d63798d0f42fb1768091812270eca00c784720" +dependencies = [ + "anyhow", + "derive_builder 0.20.0", + "getset", "rustversion", - "time 0.3.34", ] [[package]] @@ -5782,7 +5809,7 @@ dependencies = [ "tracing", "tracing-journald", "tracing-subscriber", - "vergen", + "vergen-gitcl", "wasi-common", "wasmedge-sdk", "wasmer", diff --git a/crates/libcgroups/src/stats.rs b/crates/libcgroups/src/stats.rs index e8fbc70d36..b3291478cf 100644 --- a/crates/libcgroups/src/stats.rs +++ b/crates/libcgroups/src/stats.rs @@ -183,7 +183,6 @@ pub struct PSIStats { pub full: PSIData, } -/// #[derive(Debug, Default, PartialEq, Serialize)] pub struct PSIData { /// Running average over the last 10 seconds diff --git a/crates/libcgroups/src/systemd/dbus_native/client.rs b/crates/libcgroups/src/systemd/dbus_native/client.rs index 569fd025fa..9dccff3ff3 100644 --- a/crates/libcgroups/src/systemd/dbus_native/client.rs +++ b/crates/libcgroups/src/systemd/dbus_native/client.rs @@ -5,6 +5,7 @@ use super::serialize::Variant; use super::utils::SystemdClientError; pub trait SystemdClient { + #[allow(dead_code)] fn is_system(&self) -> bool; fn transient_unit_exists(&self, unit_name: &str) -> bool; diff --git a/crates/libcgroups/src/systemd/dbus_native/dbus.rs b/crates/libcgroups/src/systemd/dbus_native/dbus.rs index 95c78822d5..b43eca910c 100644 --- a/crates/libcgroups/src/systemd/dbus_native/dbus.rs +++ b/crates/libcgroups/src/systemd/dbus_native/dbus.rs @@ -23,6 +23,7 @@ const REPLY_BUF_SIZE: usize = 128; // seems good enough tradeoff between extra s // For more information see https://www.freedesktop.org/wiki/Software/systemd/dbus/ pub struct DbusConnection { /// Is the socket system level or session specific + #[allow(dead_code)] system: bool, /// socket fd socket: i32, diff --git a/crates/libcgroups/src/v2/memory.rs b/crates/libcgroups/src/v2/memory.rs index 036fe9980c..750b045ac9 100644 --- a/crates/libcgroups/src/v2/memory.rs +++ b/crates/libcgroups/src/v2/memory.rs @@ -317,7 +317,7 @@ mod tests { // check the limit file is set as expected let limit_content = read_to_string(tmp.path().join(CGROUP_MEMORY_MAX)).expect("read memory limit to string"); let limit_check = match linux_memory.limit() { - Some(limit) if limit == -1 => limit_content == "max", + Some(-1) => limit_content == "max", Some(limit) => limit_content == limit.to_string(), None => limit_content == "0", }; @@ -325,7 +325,7 @@ mod tests { // check the swap file is set as expected let swap_content = read_to_string(tmp.path().join(CGROUP_MEMORY_SWAP)).expect("read swap limit to string"); let swap_check = match linux_memory.swap() { - Some(swap) if swap == -1 => swap_content == "max", + Some(-1)=> swap_content == "max", Some(swap) => { if let Some(limit) = linux_memory.limit() { if limit == -1 { @@ -339,7 +339,7 @@ mod tests { } None => { match linux_memory.limit() { - Some(limit) if limit == -1 => swap_content == "max", + Some(-1) => swap_content == "max", _ => swap_content == "0", } } @@ -349,7 +349,7 @@ mod tests { // check the reservation file is set as expected let reservation_content = read_to_string(tmp.path().join(CGROUP_MEMORY_LOW)).expect("read memory reservation to string"); let reservation_check = match linux_memory.reservation() { - Some(reservation) if reservation == -1 => reservation_content == "max", + Some(-1) => reservation_content == "max", Some(reservation) => reservation_content == reservation.to_string(), None => reservation_content == "0", }; diff --git a/crates/libcontainer/Cargo.toml b/crates/libcontainer/Cargo.toml index 1633538f60..3c136b6a82 100644 --- a/crates/libcontainer/Cargo.toml +++ b/crates/libcontainer/Cargo.toml @@ -8,7 +8,7 @@ homepage = "https://containers.github.io/youki" readme = "README.md" authors = ["youki team"] edition = "2021" -rust-version = "1.58.1" +rust-version = "1.63.0" keywords = ["youki", "container", "cgroups"] [features] diff --git a/crates/libcontainer/src/container/state.rs b/crates/libcontainer/src/container/state.rs index 503574bfbd..4f0bc07aac 100644 --- a/crates/libcontainer/src/container/state.rs +++ b/crates/libcontainer/src/container/state.rs @@ -11,10 +11,11 @@ use serde::{Deserialize, Serialize}; use tracing::instrument; /// Indicates status of the container -#[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq, Default)] #[serde(rename_all = "camelCase")] pub enum ContainerStatus { // The container is being created + #[default] Creating, // The runtime has finished the create operation Created, @@ -26,12 +27,6 @@ pub enum ContainerStatus { Paused, } -impl Default for ContainerStatus { - fn default() -> Self { - ContainerStatus::Creating - } -} - impl ContainerStatus { pub fn can_start(&self) -> bool { matches!(self, ContainerStatus::Created) diff --git a/crates/libcontainer/src/hooks.rs b/crates/libcontainer/src/hooks.rs index eb50370344..8233e2ab8a 100644 --- a/crates/libcontainer/src/hooks.rs +++ b/crates/libcontainer/src/hooks.rs @@ -56,7 +56,7 @@ pub fn run_hooks( tracing::debug!("run_hooks arg0: {:?}, args: {:?}", arg0, args); hook_command.arg0(arg0).args(args) } else { - hook_command.arg0(&hook.path().display().to_string()) + hook_command.arg0(hook.path().display().to_string()) }; let envs: HashMap = if let Some(env) = hook.env() { diff --git a/crates/libcontainer/src/notify_socket.rs b/crates/libcontainer/src/notify_socket.rs index 8707c45333..8e3ed8410c 100644 --- a/crates/libcontainer/src/notify_socket.rs +++ b/crates/libcontainer/src/notify_socket.rs @@ -181,9 +181,7 @@ mod test { move || { // We clone the listener and listen on the cloned listener to // make sure the cloned fd functions correctly. - let cloned_listener = listener.clone(); - cloned_listener.wait_for_container_start().unwrap(); - cloned_listener.close().unwrap(); + listener.wait_for_container_start().unwrap(); } }); diff --git a/crates/youki/Cargo.toml b/crates/youki/Cargo.toml index 62b2e9011c..14ca0a10e8 100644 --- a/crates/youki/Cargo.toml +++ b/crates/youki/Cargo.toml @@ -57,4 +57,4 @@ scopeguard = "1.2.0" [build-dependencies] anyhow = "1.0.86" -vergen = { version = "8.3.2", features = ["git", "gitcl"] } +vergen-gitcl = { version = "1.0.0", features = ["build"] } diff --git a/crates/youki/build.rs b/crates/youki/build.rs index f29fc540b7..750b5c4bf9 100644 --- a/crates/youki/build.rs +++ b/crates/youki/build.rs @@ -1,10 +1,9 @@ use anyhow::Result; -use vergen::EmitBuilder; +use vergen_gitcl::{Emitter, GitclBuilder}; -fn main() -> Result<()> { - if EmitBuilder::builder() - .fail_on_error() - .git_sha(true) +pub fn main() -> Result<()> { + if Emitter::default() + .add_instructions(&GitclBuilder::all_git()?)? .emit() .is_err() { diff --git a/crates/youki/src/observability.rs b/crates/youki/src/observability.rs index cef223d80a..2f5389f6f8 100644 --- a/crates/youki/src/observability.rs +++ b/crates/youki/src/observability.rs @@ -49,6 +49,7 @@ pub struct ObservabilityConfig { pub log_level: Option, pub log_file: Option, pub log_format: Option, + #[allow(dead_code)] pub systemd_log: bool, } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index d3ad259bb2..77f0d27504 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] profile="default" -channel="1.77.2" +channel="1.80.0" diff --git a/tests/contest/contest/src/tests/mounts_recursive/mod.rs b/tests/contest/contest/src/tests/mounts_recursive/mod.rs index 375882f1e2..976d5008b1 100644 --- a/tests/contest/contest/src/tests/mounts_recursive/mod.rs +++ b/tests/contest/contest/src/tests/mounts_recursive/mod.rs @@ -609,7 +609,7 @@ fn check_recursive_rsymfollow() -> TestResult { /// 1. Create mount_options based on the mount properties of the test /// 2. Create OCI.Spec content, container one process is runtimetest,(runtimetest is cargo model, file path `tests/runtimetest/`) /// 3. inside container to check if the actual mount matches the spec, (spec https://man7.org/linux/man-pages/man2/mount_setattr.2.html), -/// eg. tests/runtimetest/src/tests.rs +/// eg. tests/runtimetest/src/tests.rs pub fn get_mounts_recursive_test() -> TestGroup { let rro_test = Test::new("rro_test", Box::new(check_recursive_readonly)); let rnosuid_test = Test::new("rnosuid_test", Box::new(check_recursive_nosuid));