Index: TODO =================================================================== diff -u -r991431830555b151383fcbe040797853920e6838 -r53d0f6c3bde8bd07fb8dd0f091f9442d26539868 --- TODO (.../TODO) (revision 991431830555b151383fcbe040797853920e6838) +++ TODO (.../TODO) (revision 53d0f6c3bde8bd07fb8dd0f091f9442d26539868) @@ -3235,9 +3235,6 @@ - nsf.c: fixed autoname problem with code from tcl trunk -- disposition.test: - * remove/check exit (see comments in the file) - - fixed book-keeping for TclNamespace refcounting such that now alias.test, destroy.test and test.xotcl run now clean, 2 test are still open with tcl 8.5.10 (contains.test and xotcomm.test) @@ -3356,6 +3353,10 @@ * added flag "-keepvars" to nsf::finalize for handling cases in interp.test * reactivated tests and simplified interp.test + - disposition.test: + * remove/check exit (see comments in the file) + - disposition.test: + * handle exit from eval/inticmd with proper refcounts TODO: - private: @@ -3408,8 +3409,6 @@ # TODO: currently, we need two converters (or a converter on nx::Slot), since # variable uses nsf::is and attribute uses the slot obj. method variable should # be changed to use the slotobj as well. - - disposition.test: - * handle exit from eval/inticmd with proper refcounts - fix mem_count on contains.test (currently 4 / 4) the minimal script seems to be the following and is related Index: library/lib/test.tcl =================================================================== diff -u -ra24e1f836c3126d0a0e9467bde3a9fa8da901711 -r53d0f6c3bde8bd07fb8dd0f091f9442d26539868 --- library/lib/test.tcl (.../test.tcl) (revision a24e1f836c3126d0a0e9467bde3a9fa8da901711) +++ library/lib/test.tcl (.../test.tcl) (revision 53d0f6c3bde8bd07fb8dd0f091f9442d26539868) @@ -113,7 +113,23 @@ puts stderr "'${:expected}', got\n'$r'" puts stderr "\tin test file [info script]" if {[info exists :errorReport]} {eval [set :errorReport]} - exit -1 + # + # Gracefully unwind the callstack built-up to this point, by + # using [return]. At the top-most callstack level, we return + # with TCL_OK which will end the script evaluation without any + # error handling noise. We simply stop. By first returning to + # the very top of the callstack, we allow NSF to cleanup + # behind itself at the various dispatch levels + # (ObjectDispatch, MethodDispatch(), ...). + # + # Using [exit -1] directly leaves us with a partially unwinded + # callstack and a significant amount of garbage in certain + # situations (e.g., failing ? statements in initscripts). This is + # because of the "non-returning" character of Tcl_Exit which + # effectively skips the cleanup blocks throughout the NSF method + # dispatch chain. + # + return -level [expr {[info level]-1}] -code ok; # exit -1 } if {[info exists :post]} {:call "post" ${:post}} }