aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2017-01-25 16:12:45 -0800
committerZac Medico <zmedico@gentoo.org>2017-01-26 11:13:17 -0800
commitccf975296daec92d376c4989e5ffb2a6cdbe8a2d (patch)
tree68f58fd45627c3a408c040a9ed560a77d56ecca8
parentsync.py: set returncode when task failed in SyncScheduler._task_exit() (diff)
downloadportage-ccf975296daec92d376c4989e5ffb2a6cdbe8a2d.tar.gz
portage-ccf975296daec92d376c4989e5ffb2a6cdbe8a2d.tar.bz2
portage-ccf975296daec92d376c4989e5ffb2a6cdbe8a2d.zip
spawn: instantiate userpriv_groups before fork (bug 582098)
Make spawn force instantiation of portage.data.userpriv_groups in the main process, in order to avoid redundant instantiation in child processes. This mitigates the impact of "Bad file descriptor" errors reported in bug 582098, by avoiding redundant instantiation of userpriv_groups in child processes. It may even solve the problem completely, if the "Bad file descriptor" errors are triggered by interactions between garbage collection and the file descriptor operations performed in the _exec function by the _setup_pipes call. X-Gentoo-Bug: 582098 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=582098
-rw-r--r--pym/portage/process.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pym/portage/process.py b/pym/portage/process.py
index ba41ea8eb..bc4efb5fe 100644
--- a/pym/portage/process.py
+++ b/pym/portage/process.py
@@ -305,6 +305,10 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False,
if unshare_net or unshare_ipc:
find_library("c")
+ # Force instantiation of portage.data.userpriv_groups before the
+ # fork, so that the result is cached in the main process.
+ bool(groups)
+
parent_pid = os.getpid()
pid = None
try: