Package: strace Forwarded from Ubuntu's Malone bugtracker, at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=377200
-------------- Bug Description, written by bug submitter Andrew Bennetts: Binary package hint: strace The attached python script starts a thread, attaches strace -f to itself, and sends SIGINT to strace to detach it. The process is then left stopped: $ python sigstop-demo.py [1]+ Stopped python sigstop-demo.py $ fg python sigstop-demo.py done $ If the thread is not started, the process isn't stopped by detaching strace. Similarly, if "-f" is not passed to strace, this does not occur. This was discovered by a debug hook in bzr. There are reports this problem doesn't happen in dapper. -------------- Micah Cowan comments: This doesn't seem to be a bug. From strace(1), -f option: If the parent process decides to wait(2) for a child that is currently being traced, it is suspended until an appropriate child process either terminates or incurs a signal that would cause it to terminate (as determined from the child’s current signal dis‐ position). of course, if that child happens to be strace itself, the "until" bit probably ceases to apply. I'm guessing the call to proc.communicate() involves wait()ing. (Closing bug for now; if further information arises that suggests that this may still be a bug, please feel free to reopen.) -------------- Andrew Bennets (further down the thread; I've skipped some discussion) The man page talks about wait()ing for a *traced* child. That's not the case here. The parent is wait()ing for strace itself, which is definitely not a traced child. In fact, if I comment out the "proc.communicate()" line, so no wait() happens, the bug still occurs. So wait() is definitely a red herring. (Sorry for not realising this sooner so that I could have given you a more minimal example!) If you change the demo script to send SIGTERM to strace, rather than SIGINT, then problem still exists. I used SIGINT because in the man page it says of the "-p" option: begin tracing. The trace may be terminated at any time by a keyboard interrupt signal (CTRL-C). strace will respond by detaching itself from the traced process(es) leaving it (them) to continue running. I expect that SIGTERM is treated identically, but that isn't documented, whereas an interrupt signal is. All I really want is the behaviour that is promised by that part of the man page: "strace will respond by detaching itself from the traced process(es) leaving it (them) to continue running."