2010-05-18 14:13:56 +00:00
|
|
|
# cat is an external program, variable should not leak out of it.
|
2010-05-18 12:35:20 +00:00
|
|
|
# this currently fails with CONFIG_FEATURE_SH_NOFORK=y
|
2008-04-13 17:45:56 +00:00
|
|
|
VAR=''
|
2010-05-18 14:13:56 +00:00
|
|
|
VAR=val0 cat /dev/null
|
|
|
|
echo "should be empty: '$VAR'"
|
|
|
|
|
|
|
|
# true is a regular builtin, variable should not leak out of it.
|
|
|
|
VAR=''
|
2010-05-18 12:35:20 +00:00
|
|
|
VAR=val1 true
|
2008-04-13 17:45:56 +00:00
|
|
|
echo "should be empty: '$VAR'"
|
|
|
|
|
2010-05-18 12:35:20 +00:00
|
|
|
# ash follows the "special builtin leaks variables" rule here:
|
|
|
|
# exec is a special builtin. (bash does not do it)
|
2008-04-13 17:45:56 +00:00
|
|
|
VAR=''
|
2010-05-18 12:35:20 +00:00
|
|
|
VAR=val2 exec 2>&1
|
|
|
|
echo "should be not empty: '$VAR'"
|
|
|
|
|
|
|
|
# ash follows the "function call is a special builtin" rule here
|
|
|
|
# (bash does not do it)
|
|
|
|
f() { true; }
|
|
|
|
VAR=''
|
|
|
|
VAR=val3 f
|
|
|
|
echo "should be not empty: '$VAR'"
|