From 030acdb414b7bd96aec931d4a1f2b8b256b29043 Mon Sep 17 00:00:00 2001 From: utam0k Date: Sun, 9 Apr 2023 01:41:35 +0000 Subject: [PATCH 1/2] Fix the warns from lint Signed-off-by: utam0k --- .../integration_test/src/tests/cgroups/mod.rs | 1 - tests/rust-integration-tests/runtimetest/src/utils.rs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/rust-integration-tests/integration_test/src/tests/cgroups/mod.rs b/tests/rust-integration-tests/integration_test/src/tests/cgroups/mod.rs index ee19db5c3..035c23613 100644 --- a/tests/rust-integration-tests/integration_test/src/tests/cgroups/mod.rs +++ b/tests/rust-integration-tests/integration_test/src/tests/cgroups/mod.rs @@ -60,7 +60,6 @@ pub fn attach_controller(cgroup_root: &Path, cgroup_path: &Path, controller: &st let mut components = cgroup_path .components() - .into_iter() .filter(|c| c.ne(&RootDir)) .peekable(); diff --git a/tests/rust-integration-tests/runtimetest/src/utils.rs b/tests/rust-integration-tests/runtimetest/src/utils.rs index 0ae78f32a..25ae85a18 100644 --- a/tests/rust-integration-tests/runtimetest/src/utils.rs +++ b/tests/rust-integration-tests/runtimetest/src/utils.rs @@ -442,8 +442,8 @@ pub fn test_mount_rsuid_option(path: &str) -> Result<(), std::io::Error> { if suid && sgid { return Ok(()); } - return Err(std::io::Error::new( + Err(std::io::Error::new( std::io::ErrorKind::Other, format!("rsuid error {path:?}"), - )); + )) } From 7104494084c4d75be476c0344c5eecf478835bf2 Mon Sep 17 00:00:00 2001 From: utam0k Date: Sun, 9 Apr 2023 01:49:50 +0000 Subject: [PATCH 2/2] Update version check in validate_spec to support 1.X.Y version. Previously, the validate_spec function only supported runtime spec versions that started with "1.0". This commit updates the function to support all versions starting with "1." (e.g., 1.X.Y), making it compatible with a broader range of runtime spec versions. Signed-off-by: utam0k --- crates/libcontainer/src/container/init_builder.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/libcontainer/src/container/init_builder.rs b/crates/libcontainer/src/container/init_builder.rs index 1276b6d1b..c689beb0b 100644 --- a/crates/libcontainer/src/container/init_builder.rs +++ b/crates/libcontainer/src/container/init_builder.rs @@ -132,9 +132,10 @@ impl<'a> InitContainerBuilder<'a> { } fn validate_spec(spec: &Spec) -> Result<()> { - if !spec.version().starts_with("1.0") { + let version = spec.version(); + if !version.starts_with("1.") { bail!( - "runtime spec has incompatible version '{}'. Only 1.0.X is supported", + "runtime spec has incompatible version '{}'. Only 1.X.Y is supported", spec.version() ); }