1
0
mirror of https://github.com/moby/moby.git synced 2025-08-08 13:22:22 +03:00

Fix case where \\ at EOF made the builder ignore the command

Came from looking at issue #27545

Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
Doug Davis
2016-10-28 14:11:36 -07:00
parent aa90a531c5
commit eaf0b5708f
4 changed files with 43 additions and 7 deletions

View File

@@ -7237,3 +7237,33 @@ func (s *DockerSuite) TestBuildSquashParent(c *check.C) {
c.Assert(err, checker.IsNil)
c.Assert(strings.TrimSpace(out), checker.Equals, "3")
}
func (s *DockerSuite) TestBuildContChar(c *check.C) {
name := "testbuildcontchar"
_, out, err := buildImageWithOut(name,
`FROM busybox\`, true)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "Step 1/1 : FROM busybox")
_, out, err = buildImageWithOut(name,
`FROM busybox
RUN echo hi \`, true)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "Step 1/2 : FROM busybox")
c.Assert(out, checker.Contains, "Step 2/2 : RUN echo hi\n")
_, out, err = buildImageWithOut(name,
`FROM busybox
RUN echo hi \\`, true)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "Step 1/2 : FROM busybox")
c.Assert(out, checker.Contains, "Step 2/2 : RUN echo hi \\\n")
_, out, err = buildImageWithOut(name,
`FROM busybox
RUN echo hi \\\`, true)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "Step 1/2 : FROM busybox")
c.Assert(out, checker.Contains, "Step 2/2 : RUN echo hi \\\\\n")
}