diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-10-08 08:08:51 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-10-08 08:08:51 -0700 |
commit | 56fbe3fe63adf4e7c5b47400182cd857d145d5b0 (patch) | |
tree | 8f2ee6a6b526db5e17659bd686193b23955f9f84 | |
parent | 84ce763b5d397dc836b7132c0961d8f2b1a2d1f1 (diff) | |
download | portage-56fbe3fe63adf4e7c5b47400182cd857d145d5b0.tar.gz portage-56fbe3fe63adf4e7c5b47400182cd857d145d5b0.tar.bz2 portage-56fbe3fe63adf4e7c5b47400182cd857d145d5b0.zip |
test_ipc_daemon: handle fork/finally race
-rw-r--r-- | pym/portage/tests/ebuild/test_ipc_daemon.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pym/portage/tests/ebuild/test_ipc_daemon.py b/pym/portage/tests/ebuild/test_ipc_daemon.py index a87107625..b88fce695 100644 --- a/pym/portage/tests/ebuild/test_ipc_daemon.py +++ b/pym/portage/tests/ebuild/test_ipc_daemon.py @@ -36,6 +36,7 @@ class IpcDaemonTestCase(TestCase): def testIpcDaemon(self): event_loop = global_event_loop() tmpdir = tempfile.mkdtemp() + main_pid = os.getpid() build_dir = None try: env = {} @@ -135,6 +136,14 @@ class IpcDaemonTestCase(TestCase): self.assertEqual(proc.returncode == os.EX_OK, False) finally: + + # Ensure that finally blocks don't run in forked subprocesses + # before they are able to exec or _exit themselves, since the + # fork might fail or be killed before it can setup its own + # try/finally/_exit routine. See bug #345289. + if os.getpid() != main_pid: + os._exit(1) + if build_dir is not None: build_dir.unlock() shutil.rmtree(tmpdir) |