See https://github.com/docker/docker/pull/10431#issuecomment-75163177
Signed-off-by: Doug Davis <dug@us.ibm.com>
... | ... |
@@ -3728,6 +3728,9 @@ ENV FROM hello/docker/world |
3728 | 3728 |
ENV TO /docker/world/hello |
3729 | 3729 |
ADD $FROM $TO |
3730 | 3730 |
RUN [ "$(cat $TO)" = "hello" ] |
3731 |
+ENV abc=def |
|
3732 |
+ENV ghi=$abc |
|
3733 |
+RUN [ "$ghi" = "def" ] |
|
3731 | 3734 |
` |
3732 | 3735 |
ctx, err := fakeContext(dockerfile, map[string]string{ |
3733 | 3736 |
"hello/docker/world": "hello", |
... | ... |
@@ -3770,6 +3773,26 @@ ENV abc 'yyy' |
3770 | 3770 |
RUN [ $abc = \'yyy\' ] |
3771 | 3771 |
ENV abc= |
3772 | 3772 |
RUN [ "$abc" = "" ] |
3773 |
+ |
|
3774 |
+# use grep to make sure if the builder substitutes \$foo by mistake |
|
3775 |
+# we don't get a false positive |
|
3776 |
+ENV abc=\$foo |
|
3777 |
+RUN [ "$abc" = "\$foo" ] && (echo "$abc" | grep foo) |
|
3778 |
+ENV abc \$foo |
|
3779 |
+RUN [ "$abc" = "\$foo" ] && (echo "$abc" | grep foo) |
|
3780 |
+ |
|
3781 |
+ENV abc=\'foo\' |
|
3782 |
+RUN [ "$abc" = "'foo'" ] |
|
3783 |
+ENV abc=\"foo\" |
|
3784 |
+RUN [ "$abc" = "\"foo\"" ] |
|
3785 |
+ENV abc "foo" |
|
3786 |
+RUN [ "$abc" = "\"foo\"" ] |
|
3787 |
+ENV abc 'foo' |
|
3788 |
+RUN [ "$abc" = "'foo'" ] |
|
3789 |
+ENV abc \'foo\' |
|
3790 |
+RUN [ "$abc" = "\\'foo\\'" ] |
|
3791 |
+ENV abc \"foo\" |
|
3792 |
+RUN [ "$abc" = "\\\"foo\\\"" ] |
|
3773 | 3793 |
` |
3774 | 3794 |
ctx, err := fakeContext(dockerfile, map[string]string{ |
3775 | 3795 |
"hello/docker/world": "hello", |