blob: 5242e24eb19a2a5031bde9f96561db3c4262010f [file] [log] [blame]
Denys Vlasenko42c4b2e2010-05-18 16:13:56 +02001# cat is an external program, variable should not leak out of it.
Denys Vlasenko51b4a9e2010-05-18 14:35:20 +02002# this currently fails with CONFIG_FEATURE_SH_NOFORK=y
Denis Vlasenko6d1ebec2008-04-13 17:45:56 +00003VAR=''
Denys Vlasenko42c4b2e2010-05-18 16:13:56 +02004VAR=val0 cat /dev/null
5echo "should be empty: '$VAR'"
6
7# true is a regular builtin, variable should not leak out of it.
8VAR=''
Denys Vlasenko51b4a9e2010-05-18 14:35:20 +02009VAR=val1 true
Denis Vlasenko6d1ebec2008-04-13 17:45:56 +000010echo "should be empty: '$VAR'"
11
Denys Vlasenko51b4a9e2010-05-18 14:35:20 +020012# ash follows the "special builtin leaks variables" rule here:
13# exec is a special builtin. (bash does not do it)
Denis Vlasenko6d1ebec2008-04-13 17:45:56 +000014VAR=''
Denys Vlasenko51b4a9e2010-05-18 14:35:20 +020015VAR=val2 exec 2>&1
16echo "should be not empty: '$VAR'"
17
18# ash follows the "function call is a special builtin" rule here
19# (bash does not do it)
20f() { true; }
21VAR=''
22VAR=val3 f
23echo "should be not empty: '$VAR'"