From d3edc90d80e45617224534fb4984ecda62551c4a Mon Sep 17 00:00:00 2001 From: Shunsuke Kimura Date: Fri, 28 Mar 2025 12:53:55 +0900 Subject: [PATCH] kata-deploy: Fix condition always true if config.toml does not exist, `[ -x $(command -v containerd) ]` will always True (Because it is not enclosed in ""). ``` // current code $ [ -x $(command -v containerd_notfound) ] $ echo $? 0 // maybe expected code $ [ -x "$(command -v containerd_notfound)" ] $ echo $? 1 ``` Fixes: #11092 Signed-off-by: Shunsuke Kimura --- tools/packaging/kata-deploy/scripts/kata-deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/kata-deploy/scripts/kata-deploy.sh b/tools/packaging/kata-deploy/scripts/kata-deploy.sh index 1d7ac8d31f..f284b7fb4a 100755 --- a/tools/packaging/kata-deploy/scripts/kata-deploy.sh +++ b/tools/packaging/kata-deploy/scripts/kata-deploy.sh @@ -876,7 +876,7 @@ function main() { mkdir -p $(dirname "$containerd_conf_file") touch "$containerd_conf_file" elif [[ "$runtime" == "containerd" ]]; then - if [ ! -f "$containerd_conf_file" ] && [ -d $(dirname "$containerd_conf_file") ] && [ -x $(command -v containerd) ]; then + if [ ! -f "$containerd_conf_file" ] && [ -d $(dirname "$containerd_conf_file") ] && [ -x "$(command -v containerd)" ]; then containerd config default > "$containerd_conf_file" fi fi