Browse code

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

This reverts commit 105bc63295a7126798d3722a0e205c5ead4e2b1c,
which (although correct), resulted in a backward incompatible
change.

We can re-implement this in future, after this changes goes
through a deprecation cycle

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2017/01/10 08:41:03
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")
... ...
@@ -7043,17 +7043,6 @@ func (s *DockerSuite) TestBuildCmdShellArgsEscaped(c *check.C) {
7043 7043
 	}
7044 7044
 }
7045 7045
 
7046
-func (s *DockerSuite) TestContinueCharSpace(c *check.C) {
7047
-	// Test to make sure that we don't treat a \ as a continuation
7048
-	// character IF there are spaces (or tabs) after it on the same line
7049
-	name := "testbuildcont"
7050
-	_, err := buildImage(name, "FROM busybox\nRUN echo hi \\\t\nbye", true)
7051
-	c.Assert(err, check.NotNil, check.Commentf("Build 1 should fail - didn't"))
7052
-
7053
-	_, err = buildImage(name, "FROM busybox\nRUN echo hi \\ \nbye", true)
7054
-	c.Assert(err, check.NotNil, check.Commentf("Build 2 should fail - didn't"))
7055
-}
7056
-
7057 7046
 // Test case for #24912.
7058 7047
 func (s *DockerSuite) TestBuildStepsWithProgress(c *check.C) {
7059 7048
 	name := "testbuildstepswithprogress"