* strace.c (terminate): Terminate itself if interrupted by a signal.
* NEWS: Mention this change.
* tests/detach-running.test: Check it.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
Noteworthy changes in release ?.?? (????-??-??)
===============================================
+* Changes in behavior
+ * If strace is interrupted by a signal it handles (currently
+ one of HUP, INT, QUIT, PIPE, or TERM), strace terminates
+ itself with this signal.
+
Noteworthy changes in release 4.25 (2018-10-30)
===============================================
while (waitpid(popen_pid, NULL, 0) < 0 && errno == EINTR)
;
}
+ if (interrupted) {
+ exit_code = 0x100 | interrupted;
+ }
if (exit_code > 0xff) {
/* Avoid potential core file clobbering. */
struct_rlimit rlim = {0, 0};
check_prog sleep
+trap - TERM
+sleep $TIMEOUT_DURATION &
+kill -TERM $!
+wait $!
+expected_rc=$?
+
set -e
../set_ptracer_any sh -c "echo > $LOG; while :; do :; done" > /dev/null &
$SLEEP_A_BIT
done
-kill -INT $!
-wait $!
+kill -TERM $!
+wait $! && rc=0 || rc=$?
grep -F "Process $tracee_pid detached" "$LOG" > /dev/null || {
- cleanup
- dump_log_and_fail_with "$STRACE -p failed to detach"
- }
+ cleanup
+ dump_log_and_fail_with "$STRACE -p failed to detach"
+}
+
+[ "$rc" = "$expected_rc" ] || {
+ cleanup
+ dump_log_and_fail_with "$STRACE -p failed to terminate itself"
+}
if [ -f /proc/self/status ]; then
$SLEEP_A_BIT
check_prog sleep
+trap - TERM
+sleep $TIMEOUT_DURATION &
+kill -TERM $!
+wait $!
+expected_rc=$?
+
set -e
../set_ptracer_any sleep $((2*$TIMEOUT_DURATION)) > "$LOG" &
$SLEEP_A_BIT
done
-kill -INT $!
-wait $!
+kill -TERM $!
+wait $! && rc=0 || rc=$?
grep -F "Process $tracee_pid detached" "$LOG" > /dev/null || {
cleanup
dump_log_and_fail_with "$STRACE -p failed to detach"
}
+[ "$rc" = "$expected_rc" ] || {
+ cleanup
+ dump_log_and_fail_with "$STRACE -p failed to terminate itself"
+}
+
if [ -f /proc/self/status ]; then
$SLEEP_A_BIT
test -d /proc/$tracee_pid || {
run_prog_skip_if_failed \
kill -0 $$
-check_prog sleep
-
$STRACE -d -enone / > /dev/null 2> "$LOG"
if grep -x "[^:]*strace: PTRACE_SEIZE doesn't work" "$LOG" > /dev/null; then
skip_ "PTRACE_SEIZE doesn't work"
fi
+check_prog sleep
+
+trap - TERM
+sleep $TIMEOUT_DURATION &
+kill -TERM $!
+wait $!
+expected_rc=$?
+
set -e
> "$LOG"
$SLEEP_A_BIT
done
-kill -INT $!
-wait $!
+kill -TERM $!
+wait $! && rc=0 || rc=$?
grep -F "Process $tracee_pid detached" "$LOG" > /dev/null || {
cleanup
dump_log_and_fail_with "$STRACE -p failed to detach"
}
+[ "$rc" = "$expected_rc" ] || {
+ cleanup
+ dump_log_and_fail_with "$STRACE -p failed to terminate itself"
+}
+
if [ -f /proc/self/status ]; then
$SLEEP_A_BIT
test -d /proc/$tracee_pid || {