mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-06 21:51:33 +00:00
Fix for Daemon crashing when wildcards are used for COPY/ADD
in the filename and the command itself Closes #12267 Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
@@ -1113,10 +1113,10 @@ func (s *DockerSuite) TestBuildCopyWildcard(c *check.C) {
|
||||
"dir/nested_dir/nest_nest_file": "2 times nested",
|
||||
"dirt": "dirty",
|
||||
})
|
||||
defer ctx.Close()
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
defer ctx.Close()
|
||||
|
||||
id1, err := buildImageFromContext(name, ctx, true)
|
||||
if err != nil {
|
||||
@@ -1155,6 +1155,31 @@ func (s *DockerSuite) TestBuildCopyWildcardNoFind(c *check.C) {
|
||||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildCopyWildcardInName(c *check.C) {
|
||||
name := "testcopywildcardinname"
|
||||
defer deleteImages(name)
|
||||
ctx, err := fakeContext(`FROM busybox
|
||||
COPY *.txt /tmp/
|
||||
RUN [ "$(cat /tmp/\*.txt)" = 'hi there' ]
|
||||
`, map[string]string{"*.txt": "hi there"})
|
||||
|
||||
if err != nil {
|
||||
// Normally we would do c.Fatal(err) here but given that
|
||||
// the odds of this failing are so rare, it must be because
|
||||
// the OS we're running the client on doesn't support * in
|
||||
// filenames (like windows). So, instead of failing the test
|
||||
// just let it pass. Then we don't need to explicitly
|
||||
// say which OSs this works on or not.
|
||||
return
|
||||
}
|
||||
defer ctx.Close()
|
||||
|
||||
_, err = buildImageFromContext(name, ctx, true)
|
||||
if err != nil {
|
||||
c.Fatalf("should have built: %q", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildCopyWildcardCache(c *check.C) {
|
||||
name := "testcopywildcardcache"
|
||||
ctx, err := fakeContext(`FROM busybox
|
||||
|
||||
Reference in New Issue
Block a user