# HG changeset patch # User Peter O'Gorman # Date 1280438099 21600 # Node ID 8dc4f611c38150e071f580aa2e2dc7e39ecc27ed # Parent b395acf07985fd6bb3d055eb5827828d53cdb449 init.sh: work around trap limitation of some shells This limitation is already documented in the Autoconf manual. * tests/init.sh (setup_): Move exit trap outside of shell function. Signed-off-by: Eric Blake diff -r b395acf07985 -r 8dc4f611c381 ChangeLog --- a/ChangeLog Thu Jul 29 08:43:00 2010 -0600 +++ b/ChangeLog Thu Jul 29 15:14:59 2010 -0600 @@ -1,3 +1,8 @@ +2010-07-29 Peter O'Gorman (tiny change) + + init.sh: work around trap limitation of some shells + * tests/init.sh (setup_): Move exit trap outside of shell function. + 2010-07-29 Eric Blake strtod: aid debugging diff -r b395acf07985 -r 8dc4f611c381 tests/init.sh --- a/tests/init.sh Thu Jul 29 08:43:00 2010 -0600 +++ b/tests/init.sh Thu Jul 29 15:14:59 2010 -0600 @@ -255,9 +255,9 @@ || fail_ "failed to create temporary directory in $initial_cwd_" cd "$test_dir_" - # These trap statements ensure that the temporary directory, $test_dir_, - # is removed upon exit as well as upon receipt of any of the listed signals. - trap remove_tmp_ 0 + # This trap statement, along with a trap on 0 below, ensure that the + # temporary directory, $test_dir_, is removed upon exit as well as + # upon receipt of any of the listed signals. for sig_ in 1 2 3 13 15; do eval "trap 'Exit $(expr $sig_ + 128)' $sig_" done @@ -385,3 +385,6 @@ && . "$srcdir/init.cfg" setup_ "$@" +# This trap is here, rather than in the setup_ function, because some +# shells run the exit trap at shell function exit, rather than script exit. +trap remove_tmp_ 0