var_leak.tests 633 B

1234567891011121314151617181920212223
  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. # ash follows the "function call is a special builtin" rule here
  16. # (bash does not do it)
  17. f() { true; }
  18. VAR=''
  19. VAR=val3 f
  20. echo "should be not empty: '$VAR'"