Denys Vlasenko | 42c4b2e | 2010-05-18 16:13:56 +0200 | [diff] [blame] | 1 | # cat is an external program, variable should not leak out of it. |
Denys Vlasenko | 51b4a9e | 2010-05-18 14:35:20 +0200 | [diff] [blame] | 2 | # this currently fails with CONFIG_FEATURE_SH_NOFORK=y |
Denis Vlasenko | 6d1ebec | 2008-04-13 17:45:56 +0000 | [diff] [blame] | 3 | VAR='' |
Denys Vlasenko | 42c4b2e | 2010-05-18 16:13:56 +0200 | [diff] [blame] | 4 | VAR=val0 cat /dev/null |
| 5 | echo "should be empty: '$VAR'" |
| 6 | |
| 7 | # true is a regular builtin, variable should not leak out of it. |
| 8 | VAR='' |
Denys Vlasenko | 51b4a9e | 2010-05-18 14:35:20 +0200 | [diff] [blame] | 9 | VAR=val1 true |
Denis Vlasenko | 6d1ebec | 2008-04-13 17:45:56 +0000 | [diff] [blame] | 10 | echo "should be empty: '$VAR'" |
| 11 | |
Denys Vlasenko | 51b4a9e | 2010-05-18 14:35:20 +0200 | [diff] [blame] | 12 | # ash follows the "special builtin leaks variables" rule here: |
| 13 | # exec is a special builtin. (bash does not do it) |
Denis Vlasenko | 6d1ebec | 2008-04-13 17:45:56 +0000 | [diff] [blame] | 14 | VAR='' |
Denys Vlasenko | 51b4a9e | 2010-05-18 14:35:20 +0200 | [diff] [blame] | 15 | VAR=val2 exec 2>&1 |
| 16 | echo "should be not empty: '$VAR'" |
| 17 | |
| 18 | # ash follows the "function call is a special builtin" rule here |
| 19 | # (bash does not do it) |
| 20 | f() { true; } |
| 21 | VAR='' |
| 22 | VAR=val3 f |
| 23 | echo "should be not empty: '$VAR'" |