[MERGE] Wait for strace to attach before running the function we want to trace

Andrew Bennetts andrew at canonical.com
Wed Apr 4 02:25:57 BST 2007


This small patch should fix a race reported in the strace debugging feature.

Note that this isn't a fix for the "full test suite gets SIGSTOP during strace
tests."

-Andrew.

-------------- next part --------------
# Bazaar revision bundle v0.9
#
# message:
#   Wait for strace to attach before running the function we want to trace.
# committer: Andrew Bennetts <andrew.bennetts at canonical.com>
# date: Wed 2007-04-04 11:11:36.323999882 +1000

=== modified file bzrlib/strace.py
--- bzrlib/strace.py
+++ bzrlib/strace.py
@@ -42,8 +42,9 @@
         ],
         stderr=log_file_fd,
         stdout=log_file_fd)
-    # TODO? confirm its started (test suite should be sufficient)
-    # (can loop on proc.pid, but that may not indicate started and attached.)
+    # Wait for strace to attach
+    attached_notice = log_file.readline()
+    # Run the function to strace
     result = function(*args, **kwargs)
     # stop strace
     os.kill(proc.pid, signal.SIGQUIT)

=== modified directory  // last-changed:andrew.bennetts at canonical.com-200704040
... 11136-pzaxkaziasx2gmu3
# revision id: andrew.bennetts at canonical.com-20070404011136-pzaxkaziasx2gmu3
# sha1: 0660f7bdf3b18277f859cf375e1717edbbebd60e
# inventory sha1: b7f282925cf8840840dbe9426971b075724a22d8
# parent ids:
#   pqm at pqm.ubuntu.com-20070404005411-46c388fbf2acf940
# base id: pqm at pqm.ubuntu.com-20070404005411-46c388fbf2acf940
# properties:
#   branch-nick: strace-attach



More information about the bazaar mailing list