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:
@@ -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")
|
||||
}
|
||||
|
Reference in New Issue
Block a user