Browse code

Windows: Fix wildcard expansion after slash in filename

Signed-off-by: Darren Stahl <darst@microsoft.com>

Darren Stahl authored on 2016/09/14 09:50:45
Showing 4 changed files
... ...
@@ -375,18 +375,6 @@ func (b *Builder) calcCopyInfo(cmdName, origPath string, allowLocalDecompression
375 375
 	return copyInfos, nil
376 376
 }
377 377
 
378
-func containsWildcards(name string) bool {
379
-	for i := 0; i < len(name); i++ {
380
-		ch := name[i]
381
-		if ch == '\\' {
382
-			i++
383
-		} else if ch == '*' || ch == '?' || ch == '[' {
384
-			return true
385
-		}
386
-	}
387
-	return false
388
-}
389
-
390 378
 func (b *Builder) processImageFrom(img builder.Image) error {
391 379
 	if img != nil {
392 380
 		b.image = img.ImageID()
... ...
@@ -24,3 +24,15 @@ func normaliseDest(cmdName, workingDir, requested string) (string, error) {
24 24
 	}
25 25
 	return dest, nil
26 26
 }
27
+
28
+func containsWildcards(name string) bool {
29
+	for i := 0; i < len(name); i++ {
30
+		ch := name[i]
31
+		if ch == '\\' {
32
+			i++
33
+		} else if ch == '*' || ch == '?' || ch == '[' {
34
+			return true
35
+		}
36
+	}
37
+	return false
38
+}
... ...
@@ -54,3 +54,13 @@ func normaliseDest(cmdName, workingDir, requested string) (string, error) {
54 54
 	}
55 55
 	return dest, nil
56 56
 }
57
+
58
+func containsWildcards(name string) bool {
59
+	for i := 0; i < len(name); i++ {
60
+		ch := name[i]
61
+		if ch == '*' || ch == '?' || ch == '[' {
62
+			return true
63
+		}
64
+	}
65
+	return false
66
+}
... ...
@@ -849,7 +849,6 @@ RUN [ $(cat "/test dir/test_file6") = 'test6' ]`,
849 849
 }
850 850
 
851 851
 func (s *DockerSuite) TestBuildCopyWildcard(c *check.C) {
852
-	testRequires(c, DaemonIsLinux) // Windows doesn't have httpserver image yet
853 852
 	name := "testcopywildcard"
854 853
 	server, err := fakeStorage(map[string]string{
855 854
 		"robots.txt": "hello",
... ...
@@ -863,10 +862,10 @@ func (s *DockerSuite) TestBuildCopyWildcard(c *check.C) {
863 863
 	ctx, err := fakeContext(fmt.Sprintf(`FROM busybox
864 864
 	COPY file*.txt /tmp/
865 865
 	RUN ls /tmp/file1.txt /tmp/file2.txt
866
-	RUN mkdir /tmp1
866
+	RUN [ "mkdir",  "/tmp1" ]
867 867
 	COPY dir* /tmp1/
868 868
 	RUN ls /tmp1/dirt /tmp1/nested_file /tmp1/nested_dir/nest_nest_file
869
-	RUN mkdir /tmp2
869
+	RUN [ "mkdir",  "/tmp2" ]
870 870
         ADD dir/*dir %s/robots.txt /tmp2/
871 871
 	RUN ls /tmp2/nest_nest_file /tmp2/robots.txt
872 872
 	`, server.URL()),