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:
parent
2d6952e8a5
commit
d45fcc6c80
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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue