aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-08-08 15:16:34 -0700
committerZac Medico <zmedico@gentoo.org>2020-08-08 16:25:03 -0700
commit0b4b5eae5555fafcfa314465ae1094da00687779 (patch)
tree04fcc9890d36a4e4928e5b7b8422e9cdc1f3cdec /lib/_emerge
parentEventLoopInForkTestCase: use AsyncFunction (diff)
downloadportage-0b4b5eae5555fafcfa314465ae1094da00687779.tar.gz
portage-0b4b5eae5555fafcfa314465ae1094da00687779.tar.bz2
portage-0b4b5eae5555fafcfa314465ae1094da00687779.zip
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@gentoo.org>
Diffstat (limited to 'lib/_emerge')
-rw-r--r--lib/_emerge/BinpkgEnvExtractor.py7
1 files changed, 6 insertions, 1 deletions
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)