Browse code

Merge pull request #30010 from thaJeztah/master-revert-27146

Revert "Require continuation char to be last char in a line"

Brian Goff authored on 2017/01/12 23:17:08
Showing 4 changed files
... ...
@@ -61,7 +61,7 @@ func SetEscapeToken(s string, d *Directive) error {
61 61
 		return fmt.Errorf("invalid ESCAPE '%s'. Must be ` or \\", s)
62 62
 	}
63 63
 	d.EscapeToken = rune(s[0])
64
-	d.LineContinuationRegex = regexp.MustCompile(`\` + s + `$`)
64
+	d.LineContinuationRegex = regexp.MustCompile(`\` + s + `[ \t]*$`)
65 65
 	return nil
66 66
 }
67 67
 
... ...
@@ -13,6 +13,8 @@ world
13 13
 RUN echo hello \
14 14
 goodbye\
15 15
 frog
16
+RUN echo hello  \  
17
+world
16 18
 RUN echo hi \
17 19
  \
18 20
  world \
... ...
@@ -3,6 +3,7 @@
3 3
 (run "echo hello    world")
4 4
 (run "echo hello  world")
5 5
 (run "echo hello goodbyefrog")
6
+(run "echo hello  world")
6 7
 (run "echo hi   world  goodnight")
7 8
 (run "echo goodbyefrog")
8 9
 (run "echo goodbyefrog")
... ...
@@ -7037,17 +7037,6 @@ func (s *DockerSuite) TestBuildCmdShellArgsEscaped(c *check.C) {
7037 7037
 	}
7038 7038
 }
7039 7039
 
7040
-func (s *DockerSuite) TestContinueCharSpace(c *check.C) {
7041
-	// Test to make sure that we don't treat a \ as a continuation
7042
-	// character IF there are spaces (or tabs) after it on the same line
7043
-	name := "testbuildcont"
7044
-	_, err := buildImage(name, "FROM busybox\nRUN echo hi \\\t\nbye", true)
7045
-	c.Assert(err, check.NotNil, check.Commentf("Build 1 should fail - didn't"))
7046
-
7047
-	_, err = buildImage(name, "FROM busybox\nRUN echo hi \\ \nbye", true)
7048
-	c.Assert(err, check.NotNil, check.Commentf("Build 2 should fail - didn't"))
7049
-}
7050
-
7051 7040
 // Test case for #24912.
7052 7041
 func (s *DockerSuite) TestBuildStepsWithProgress(c *check.C) {
7053 7042
 	name := "testbuildstepswithprogress"