1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

integration-cli: add a integration test to avoid parsing null string in ADD, COPY and VOLUME to nil slice

Signed-off-by: Soshi Katsuta <katsuta_soshi@cyberagent.co.jp>
This commit is contained in:
Soshi Katsuta 2015-08-18 02:22:57 +09:00
parent 2d6952e8a5
commit d45fcc6c80
2 changed files with 28 additions and 1 deletions

View file

@ -234,7 +234,7 @@ func parseString(rest string) (*Node, map[string]bool, error) {
func parseJSON(rest string) (*Node, map[string]bool, error) {
rest = strings.TrimLeftFunc(rest, unicode.IsSpace)
if !strings.HasPrefix(rest, "[") {
return nil, nil, fmt.Errorf("Error parsing \"%s\" as a JSON array", rest)
return nil, nil, fmt.Errorf(`Error parsing "%s" as a JSON array`, rest)
}
var myJSON []interface{}

View file

@ -5444,3 +5444,30 @@ func (s *DockerTrustSuite) TestBuildContextDirIsSymlink(c *check.C) {
c.Fatalf("build failed with exit status %d: %s", exitStatus, out)
}
}
// Issue #15634: COPY fails when path starts with "null"
func (s *DockerSuite) TestBuildNullStringInAddCopyVolume(c *check.C) {
name := "testbuildnullstringinaddcopyvolume"
ctx, err := fakeContext(`
FROM busybox
ADD null /
COPY nullfile /
VOLUME nullvolume
`,
map[string]string{
"null": "test1",
"nullfile": "test2",
},
)
if err != nil {
c.Fatal(err)
}
defer ctx.Close()
if _, err := buildImageFromContext(name, ctx, true); err != nil {
c.Fatal(err)
}
}