vendor: update fsutil to fix local source bug

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2018-06-10 09:21:24 -07:00
parent 4b8dc5b08b
commit 30461204da
3 changed files with 11 additions and 4 deletions

View File

@ -80,11 +80,12 @@ func testLocalSymlinkEscape(t *testing.T, sb integration.Sandbox) {
require.NoError(t, err) require.NoError(t, err)
defer c.Close() defer c.Close()
test := []byte(`set -x test := []byte(`set -ex
[[ -L /mount/foo ]] [[ -L /mount/foo ]]
[[ -L /mount/sub/bar ]] [[ -L /mount/sub/bar ]]
[[ -L /mount/bax ]] [[ -L /mount/bax ]]
[[ -f /mount/bay ]] [[ -f /mount/bay ]]
[[ -f /mount/sub/sub2/file ]]
[[ ! -f /mount/baz ]] [[ ! -f /mount/baz ]]
[[ ! -f /mount/etc/passwd ]] [[ ! -f /mount/etc/passwd ]]
[[ ! -f /mount/etc/group ]] [[ ! -f /mount/etc/group ]]
@ -102,6 +103,9 @@ func testLocalSymlinkEscape(t *testing.T, sb integration.Sandbox) {
fstest.Symlink("bay", "bax"), fstest.Symlink("bay", "bax"),
// target for symlink (not requested) // target for symlink (not requested)
fstest.CreateFile("bay", []byte{}, 0600), fstest.CreateFile("bay", []byte{}, 0600),
// file with many subdirs
fstest.CreateDir("sub/sub2", 0700),
fstest.CreateFile("sub/sub2/file", []byte{}, 0600),
// unused file that shouldn't be included // unused file that shouldn't be included
fstest.CreateFile("baz", []byte{}, 0600), fstest.CreateFile("baz", []byte{}, 0600),
fstest.CreateFile("test.sh", test, 0700), fstest.CreateFile("test.sh", test, 0700),
@ -110,7 +114,7 @@ func testLocalSymlinkEscape(t *testing.T, sb integration.Sandbox) {
defer os.RemoveAll(dir) defer os.RemoveAll(dir)
local := llb.Local("mylocal", llb.FollowPaths([]string{ local := llb.Local("mylocal", llb.FollowPaths([]string{
"test.sh", "foo", "sub/bar", "bax", "test.sh", "foo", "sub/bar", "bax", "sub/sub2/file",
})) }))
st := llb.Image("busybox:latest"). st := llb.Image("busybox:latest").

View File

@ -39,7 +39,7 @@ golang.org/x/time f51c12702a4d776e4c1fa9b0fabab841babae631
github.com/docker/docker 71cd53e4a197b303c6ba086bd584ffd67a884281 github.com/docker/docker 71cd53e4a197b303c6ba086bd584ffd67a884281
github.com/pkg/profile 5b67d428864e92711fcbd2f8629456121a56d91f github.com/pkg/profile 5b67d428864e92711fcbd2f8629456121a56d91f
github.com/tonistiigi/fsutil 8839685ae8c3c8bd67d0ce28e9b3157b23c1c7a5 github.com/tonistiigi/fsutil 8abad97ee3969cdf5e9c367f46adba2c212b3ddb
github.com/hashicorp/go-immutable-radix 826af9ccf0feeee615d546d69b11f8e98da8c8f1 git://github.com/tonistiigi/go-immutable-radix.git github.com/hashicorp/go-immutable-radix 826af9ccf0feeee615d546d69b11f8e98da8c8f1 git://github.com/tonistiigi/go-immutable-radix.git
github.com/hashicorp/golang-lru a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4 github.com/hashicorp/golang-lru a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4
github.com/mitchellh/hashstructure 2bca23e0e452137f789efbc8610126fd8b94f73b github.com/mitchellh/hashstructure 2bca23e0e452137f789efbc8610126fd8b94f73b

View File

@ -107,6 +107,9 @@ func Walk(ctx context.Context, p string, opt *WalkOpt, fn filepath.WalkFunc) err
} }
} }
if !matched { if !matched {
if fi.IsDir() {
return filepath.SkipDir
}
return nil return nil
} }
if !partial && fi.IsDir() { if !partial && fi.IsDir() {
@ -236,7 +239,7 @@ func trimUntilIndex(str, sep string, count int) string {
s = s[idx+len(sep):] s = s[idx+len(sep):]
i += idx + len(sep) i += idx + len(sep)
c++ c++
if c >= count { if c > count {
return str[:i-len(sep)] return str[:i-len(sep)]
} }
} }