2010-05-18 19:43:56 +05:30
|
|
|
# cat is an external program, variable should not leak out of it.
|
2010-05-18 18:05:20 +05:30
|
|
|
# this currently fails with CONFIG_FEATURE_SH_NOFORK=y
|
2008-04-13 23:15:56 +05:30
|
|
|
VAR=''
|
2010-05-18 19:43:56 +05:30
|
|
|
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 18:05:20 +05:30
|
|
|
VAR=val1 true
|
2008-04-13 23:15:56 +05:30
|
|
|
echo "should be empty: '$VAR'"
|
|
|
|
|
2010-05-18 18:05:20 +05:30
|
|
|
# ash follows the "special builtin leaks variables" rule here:
|
|
|
|
# exec is a special builtin. (bash does not do it)
|
2008-04-13 23:15:56 +05:30
|
|
|
VAR=''
|
2010-05-18 18:05:20 +05:30
|
|
|
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'"
|