From 475b2c19abf9911c7d104ac9b40e366fccafd7a3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 13 Nov 2010 09:09:29 -0800 Subject: [PATCH] EbuildFetcher: suppress finally blocks after fork This should fix bug #345289. --- pym/_emerge/EbuildFetcher.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pym/_emerge/EbuildFetcher.py b/pym/_emerge/EbuildFetcher.py index 96f295f3b..bfac5a6c0 100644 --- a/pym/_emerge/EbuildFetcher.py +++ b/pym/_emerge/EbuildFetcher.py @@ -1,6 +1,8 @@ # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +import traceback + from _emerge.SpawnProcess import SpawnProcess import sys import portage @@ -95,10 +97,17 @@ class EbuildFetcher(SpawnProcess): not in ('yes', 'true') rval = 1 - if fetch(self._uri_map, self._settings, fetchonly=self.fetchonly): - rval = os.EX_OK - - os._exit(rval) + try: + if fetch(self._uri_map, self._settings, fetchonly=self.fetchonly): + rval = os.EX_OK + except SystemExit: + raise + except: + traceback.print_exc() + finally: + # Call os._exit() from finally block, in order to suppress any + # finally blocks from earlier in the call stack. See bug #345289. + os._exit(rval) def _get_uri_map(self, portdb, ebuild_path): """ -- 2.26.2