The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3447
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === The source path given to the push command no longer assumes the path is normal. Now oddities like `././` normalize to `.`. This fixes the issue where `./` results in malformed destination paths (issue #3446).
From 3247f2f266099dc4ffca3d187725e42d4d184be2 Mon Sep 17 00:00:00 2001 From: wagoodman <[email protected]> Date: Sun, 25 Jun 2017 12:53:19 -0400 Subject: [PATCH] clean the given source filepath Signed-off-by: wagoodman <[email protected]> --- client.go | 5 +---- lxc/file.go | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/client.go b/client.go index 77a3890bb..4694caca6 100644 --- a/client.go +++ b/client.go @@ -1873,9 +1873,6 @@ func (c *Client) RecursivePushFile(container string, source string, target strin return fmt.Errorf("This function isn't supported by public remotes.") } - sourceDir, _ := filepath.Split(source) - sourceLen := len(sourceDir) - sendFile := func(p string, fInfo os.FileInfo, err error) error { if err != nil { return fmt.Errorf("Failed to walk path for %s: %s", p, err) @@ -1886,7 +1883,7 @@ func (c *Client) RecursivePushFile(container string, source string, target strin return fmt.Errorf("'%s' isn't a regular file or directory.", p) } - targetPath := path.Join(target, filepath.ToSlash(p[sourceLen:])) + targetPath := path.Join(target, filepath.ToSlash(p)) if fInfo.IsDir() { mode, uid, gid := shared.GetOwnerMode(fInfo) return c.Mkdir(container, targetPath, mode, uid, gid) diff --git a/lxc/file.go b/lxc/file.go index 67ecbaf03..96d60ac52 100644 --- a/lxc/file.go +++ b/lxc/file.go @@ -102,7 +102,8 @@ func (c *fileCmd) push(config *lxd.Config, send_file_perms bool, args []string) var sourcefilenames []string for _, fname := range args[:len(args)-1] { - if !strings.HasPrefix(fname, "--") { + if !strings.HasPrefix(fname, "--") + fname = path.Clean(fname) sourcefilenames = append(sourcefilenames, fname) } }
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
