From 17882cca3f4f064c23198ee0deec82bcc3d36aba Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Tue, 23 Dec 2025 18:11:57 +0800 Subject: [PATCH] fix(host): quote include paths when before executing tar (#23969) --- pkg/hostman/guestman/pod.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/hostman/guestman/pod.go b/pkg/hostman/guestman/pod.go index 02bb1a6a1b..3c6756790a 100644 --- a/pkg/hostman/guestman/pod.go +++ b/pkg/hostman/guestman/pod.go @@ -2866,6 +2866,8 @@ func (s *sPodGuestInstance) tarHostDir(srcDir, targetPath string, for i := range files { if fileutils2.Exists(filepath.Join(srcDir, files[i])) { result = append(result, files[i]) + } else { + log.Warningf("tar path doesn't exist: %q", filepath.Join(srcDir, files[i])) } } return result @@ -2879,6 +2881,9 @@ func (s *sPodGuestInstance) tarHostDir(srcDir, targetPath string, } includeStr := "." if len(includeFiles) > 0 { + for i := range includeFiles { + includeFiles[i] = fmt.Sprintf("'%s'", includeFiles[i]) + } includeStr = strings.Join(includeFiles, " ") } cmd := fmt.Sprintf("%s --ignore-failed-read -cf %s -C %s %s", baseCmd, targetPath, srcDir, includeStr)