From 0830a680ee26e85dba913c1ddc60eb39057f898b Mon Sep 17 00:00:00 2001 From: Sudhakar Verma Date: Tue, 10 Dec 2024 13:12:26 +0530 Subject: [PATCH] i/statemachine: Check if the copy file source is absolute Signed-off-by: Sudhakar Verma --- internal/statemachine/helper.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/statemachine/helper.go b/internal/statemachine/helper.go index 83516b58..dc9273da 100644 --- a/internal/statemachine/helper.go +++ b/internal/statemachine/helper.go @@ -753,7 +753,10 @@ func manualMakeDirs(customizations []*imagedefinition.MakeDirs, targetDir string // manualCopyFile copies a file into the chroot func manualCopyFile(customizations []*imagedefinition.CopyFile, confDefPath string, targetDir string, debug bool) error { for _, c := range customizations { - source := filepath.Join(confDefPath, c.Source) + source := c.Source + if !filepath.IsAbs(source) { + source = filepath.Join(confDefPath, source) + } dest := filepath.Join(targetDir, c.Dest) if debug { fmt.Printf("Copying file \"%s\" to \"%s\"\n", source, dest)