Skip to content

Commit 5a140b2

Browse files
author
j-griffith
committed
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.
1 parent 4b2c735 commit 5a140b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/hostpath/hostpath.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ func loadFromVolume(srcVolumeId, destPath string) error {
293293

294294
// 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
295295
if !isEmpty {
296-
args := []string{"-a", srcPath + "/*", destPath + "/"}
296+
args := []string{"-a", srcPath + "/.", destPath + "/"}
297297
executor := utilexec.New()
298298
out, err := executor.Command("cp", args...).CombinedOutput()
299299
if err != nil {

0 commit comments

Comments
 (0)