From 96f1fb578dec42612157bbf55253c85ac4793073 Mon Sep 17 00:00:00 2001 Message-Id: <96f1fb578dec42612157bbf55253c85ac4793073.1715237272.git.mdw@distorted.org.uk> From: Mark Wooding Date: Fri, 20 Jan 2012 01:23:41 +0000 Subject: [PATCH] server/tests.at: Work around strace's attempt to overwrite core files. Organization: Straylight/Edgeware From: Mark Wooding When strace sees its child process die from a signal, it sends itself the same signal in order to propagate the exit status accurately. Unfortunately, if the child process left a core dump, it gets overwritten by a useless core dump showing how strace committed suicide. Work around this by running strace in a subdirectory and getting the child process to run back in the parent. Also see Debian bug #656389. --- server/tests.at | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/tests.at b/server/tests.at index 4fcd9cd2..188d6504 100644 --- a/server/tests.at +++ b/server/tests.at @@ -70,11 +70,19 @@ while test ! -r $1/server-status && test ! -S $1/admin; do :; done ## Test body... $3 -## End of the test, now run the server. +## End of the test, now run the server. There's an awful hack here. If a +## process running under strace exits with a signal, then strace will kill +## itself with the same signal -- and therefore clobber the original +## process's core file. So we arrange to run strace in one directory and +## have the child process run in another. ) && :; } | { cd $1 + mkdir -p strace-hack/ echo TRIPE $2 >&2 - strace -f -o tripe.trace TRIPE $2 >server-output 2>server-errors + (cd strace-hack/ + ulimit -c hard >/dev/null 2>&1 + strace -f -o ../tripe.trace \ + TRIPE -d.. $2 >../server-output 2>../server-errors) stat=$? echo $stat >server-status if test $stat -ne 0; then -- [mdw]