commit: ccf975296daec92d376c4989e5ffb2a6cdbe8a2d Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Thu Jan 26 00:12:45 2017 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Thu Jan 26 19:13:17 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ccf97529
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 pym/portage/process.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pym/portage/process.py b/pym/portage/process.py index ba41ea8..bc4efb5 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:
