var_leak.tests 540 B

123456789101112131415161718192021
  1. # cat is an external program, variable should not leak out of it.
  2. # this currently fails with CONFIG_FEATURE_SH_NOFORK=y
  3. VAR=''
  4. VAR=val0 cat /dev/null
  5. echo "should be empty: '$VAR'"
  6. # true is a regular builtin, variable should not leak out of it.
  7. VAR=''
  8. VAR=val1 true
  9. echo "should be empty: '$VAR'"
  10. # ash follows the "special builtin leaks variables" rule here:
  11. # exec is a special builtin. (bash does not do it)
  12. VAR=''
  13. VAR=val2 exec 2>&1
  14. echo "should be not empty: '$VAR'"
  15. f() { true; }
  16. VAR=''
  17. VAR=val3 f
  18. echo "should be empty: '$VAR'"