From 23224f1fbb32ce91c5a261fb94cfb17df475cb30 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 22 Feb 2010 13:43:41 +0100 Subject: Prevent accidental global cleanup triggering for syscall test.tcl. Later tests might trigger a cleanup and might set the global dir variable leading to the syscall test.tcl trying to do an exec rm -rf on whatever dir was set. So rename proc cleanup and global dir in syscall test.tcl to something a bit less likely to clash. * testsuite/systemtap.syscall/test.tcl: Rename proc cleanup to syscall_cleanup and global dir to syscall_dir. * testsuite/systemtap.syscall/test-debug.tcl: Likewise. --- testsuite/systemtap.syscall/test-debug.tcl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'testsuite/systemtap.syscall/test-debug.tcl') diff --git a/testsuite/systemtap.syscall/test-debug.tcl b/testsuite/systemtap.syscall/test-debug.tcl index 3eb6bbf0..320558bf 100755 --- a/testsuite/systemtap.syscall/test-debug.tcl +++ b/testsuite/systemtap.syscall/test-debug.tcl @@ -1,14 +1,14 @@ #!/usr/bin/env wish package require Expect -set dir "" +set syscall_dir "" set current_dir "" -proc cleanup {} { - global dir current_dir +proc syscall_cleanup {} { + global syscall_dir current_dir if {$current_dir != ""} { cd $current_dir - if {$dir != ""} {exec rm -rf $dir} + if {$syscall_dir != ""} {exec rm -rf $syscall_dir} set current_dir "" } exit 0 @@ -16,14 +16,14 @@ proc cleanup {} { proc usage {progname} { puts "Usage: $progname testname" - cleanup + syscall_cleanup } proc bgerror {error} { puts "ERROR: $error" - cleanup + syscall_cleanup } -trap {cleanup} SIGINT +trap {syscall_cleanup} SIGINT set testname [lindex $argv 0] if {$testname == ""} { usage $argv0 @@ -75,17 +75,17 @@ foreach line [split $output "\n"] { if {$ind == 0} { puts "UNSUPP" - cleanup + syscall_cleanup exit } -if {[catch {exec mktemp -d staptestXXXXXX} dir]} { - puts stderr "Failed to create temporary directory: $dir" - cleanup +if {[catch {exec mktemp -d staptestXXXXXX} syscall_dir]} { + puts stderr "Failed to create temporary directory: $syscall_dir" + syscall_cleanup } set current_dir [pwd] -cd $dir +cd $syscall_dir catch {eval exec $cmd} output set i 0 @@ -151,5 +151,5 @@ for {} {$i < $ind} {incr i} { .t2 insert end "\n" } -bind . {cleanup} +bind . {syscall_cleanup} -- cgit