From 5a140b2a27884612895a6ce2e69306190269f03f Mon Sep 17 00:00:00 2001 From: j-griffith Date: Wed, 31 Jul 2019 15:54:15 -0600 Subject: [PATCH] Fix cp arg expansion bug The cloning implementation for hostpath volumes used `args := []string{"-a", srcPath + "/*", destPath + "/"}` The result is some shells will actually try to find/copy a file `*` from the source directory. We need to use the cp specific syntax for this instead `.`, to guarantee that things work on different platforms and shells. --- pkg/hostpath/hostpath.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/hostpath/hostpath.go b/pkg/hostpath/hostpath.go index 6742e8c80..da61dda37 100644 --- a/pkg/hostpath/hostpath.go +++ b/pkg/hostpath/hostpath.go @@ -293,7 +293,7 @@ func loadFromVolume(srcVolumeId, destPath string) error { // If the source hostpath volume is empty it's a noop and we just move along, otherwise the cp call will fail with a a file stat error DNE if !isEmpty { - args := []string{"-a", srcPath + "/*", destPath + "/"} + args := []string{"-a", srcPath + "/.", destPath + "/"} executor := utilexec.New() out, err := executor.Command("cp", args...).CombinedOutput() if err != nil {