Browse code

Fix panic when `ENV ARG=ARG` is used.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)

Erik Hollensbe authored on 2014/08/31 21:39:36
Showing 2 changed files
... ...
@@ -9,6 +9,7 @@ package parser
9 9
 import (
10 10
 	"encoding/json"
11 11
 	"errors"
12
+	"fmt"
12 13
 	"strconv"
13 14
 	"strings"
14 15
 )
... ...
@@ -43,6 +44,11 @@ func parseEnv(rest string) (*Node, map[string]bool, error) {
43 43
 	node := &Node{}
44 44
 	rootnode := node
45 45
 	strs := TOKEN_WHITESPACE.Split(rest, 2)
46
+
47
+	if len(strs) < 2 {
48
+		return nil, nil, fmt.Errorf("ENV must have two arguments")
49
+	}
50
+
46 51
 	node.Value = strs[0]
47 52
 	node.Next = &Node{}
48 53
 	node.Next.Value = strs[1]
49 54
new file mode 100644
... ...
@@ -0,0 +1,3 @@
0
+FROM busybox
1
+
2
+ENV PATH=PATH