Commit be5adb92 authored by Nathan Hartwell's avatar Nathan Hartwell

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.
parent 5a4a5842
......@@ -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
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment