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>
Upstream-commit: d45fcc6c80bd67ee6a06821fd64cad029d3a756f
Component: engine
This commit is contained in:
Soshi Katsuta
2015-08-19 11:11:46 +09:00
parent 8728d5d064
commit a9c24d4837
2 changed files with 28 additions and 1 deletions
@@ -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{}
@@ -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)
}
}