Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/
Date: Fri, 27 Jan 2017 00:04:14
Message-Id: 1485457997.ccf975296daec92d376c4989e5ffb2a6cdbe8a2d.zmedico@gentoo
1 commit: ccf975296daec92d376c4989e5ffb2a6cdbe8a2d
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 26 00:12:45 2017 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 26 19:13:17 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ccf97529
7
8 spawn: instantiate userpriv_groups before fork (bug 582098)
9
10 Make spawn force instantiation of portage.data.userpriv_groups in the
11 main process, in order to avoid redundant instantiation in child
12 processes. This mitigates the impact of "Bad file descriptor" errors
13 reported in bug 582098, by avoiding redundant instantiation of
14 userpriv_groups in child processes. It may even solve the problem
15 completely, if the "Bad file descriptor" errors are triggered by
16 interactions between garbage collection and the file descriptor
17 operations performed in the _exec function by the _setup_pipes call.
18
19 X-Gentoo-Bug: 582098
20 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=582098
21
22 pym/portage/process.py | 4 ++++
23 1 file changed, 4 insertions(+)
24
25 diff --git a/pym/portage/process.py b/pym/portage/process.py
26 index ba41ea8..bc4efb5 100644
27 --- a/pym/portage/process.py
28 +++ b/pym/portage/process.py
29 @@ -305,6 +305,10 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False,
30 if unshare_net or unshare_ipc:
31 find_library("c")
32
33 + # Force instantiation of portage.data.userpriv_groups before the
34 + # fork, so that the result is cached in the main process.
35 + bool(groups)
36 +
37 parent_pid = os.getpid()
38 pid = None
39 try: