From 7104494084c4d75be476c0344c5eecf478835bf2 Mon Sep 17 00:00:00 2001 From: utam0k Date: Sun, 9 Apr 2023 01:49:50 +0000 Subject: [PATCH] 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() ); }