commit: 0b4b5eae5555fafcfa314465ae1094da00687779 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sat Aug 8 22:16:34 2020 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Sat Aug 8 23:25:03 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0b4b5eae
BinpkgEnvExtractor: fix subprocess logfile usage (bug 711174) Do not write to log file when in a MergeProcess subprocess, since stdout and stderr are already redirected to the log file by MergeProcess. This fixes log corruption when BinpkgEnvExtractor is use to extract environment.bz2 prior to pkg_prerm. Bug: https://bugs.gentoo.org/711174 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/_emerge/BinpkgEnvExtractor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/_emerge/BinpkgEnvExtractor.py b/lib/_emerge/BinpkgEnvExtractor.py index b19586e83..9398b493c 100644 --- a/lib/_emerge/BinpkgEnvExtractor.py +++ b/lib/_emerge/BinpkgEnvExtractor.py @@ -33,12 +33,17 @@ class BinpkgEnvExtractor(CompositeTask): shell_cmd = "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- %s > %s" % \ (_shell_quote(saved_env_path), _shell_quote(dest_env_path)) + + logfile = None + if self.settings.get("PORTAGE_BACKGROUND") != "subprocess": + logfile = self.settings.get("PORTAGE_LOG_FILE") + extractor_proc = SpawnProcess( args=[BASH_BINARY, "-c", shell_cmd], background=self.background, env=self.settings.environ(), scheduler=self.scheduler, - logfile=self.settings.get('PORTAGE_LOG_FILE')) + logfile=logfile) self._start_task(extractor_proc, self._extractor_exit)