From be5adb92b5c4d5d95e5089be94c706b930fea7ba Mon Sep 17 00:00:00 2001 From: Nathan Hartwell Date: Fri, 2 May 2014 11:18:56 -0500 Subject: [PATCH] Appending wildcard to src causes problems It appears that the desired effect was to support src = "dir" -> dest/dir src = "dir/" -> dest but cp -R already handles this, provided the trailing slash does not get consumed by the shell. The wildcard causes problems when multiple files match the shell glob, e.g. UploadDir("/tmp", "./salt*", []) where my working dir contains - salt - salt-foo will error. --- builder/amazon/chroot/communicator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/amazon/chroot/communicator.go b/builder/amazon/chroot/communicator.go index 22becd164..b6db9340b 100644 --- a/builder/amazon/chroot/communicator.go +++ b/builder/amazon/chroot/communicator.go @@ -82,7 +82,7 @@ func (c *Communicator) UploadDir(dst string, src string, exclude []string) error // TODO: remove any file copied if it appears in `exclude` chrootDest := filepath.Join(c.Chroot, dst) log.Printf("Uploading directory '%s' to '%s'", src, chrootDest) - cpCmd, err := c.CmdWrapper(fmt.Sprintf("cp -R %s* %s", src, chrootDest)) + cpCmd, err := c.CmdWrapper(fmt.Sprintf("cp -R '%s' %s", src, chrootDest)) if err != nil { return err }