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: Thu, 22 Feb 2018 17:32:34
Message-Id: 1519320626.d3778a92be0ac4a22eb61e3affdc85f99337847a.zmedico@gentoo
1 commit: d3778a92be0ac4a22eb61e3affdc85f99337847a
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 21 23:14:44 2018 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 22 17:30:26 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d3778a92
7
8 portage.process.spawn: default close_fds=False (bug 648432)
9
10 For python3.4 and later, default to close_fds=False, since file
11 descriptors are non-inheritable by default due to PEP 446. This solves
12 a performance problem on systems like FreeBSD, where our get_open_fds
13 function returns all possible file descriptor values (including those
14 that are not open).
15
16 Bug: https://bugs.gentoo.org/648432
17 See: https://www.python.org/dev/peps/pep-0446/
18
19 pym/portage/process.py | 6 ++++--
20 1 file changed, 4 insertions(+), 2 deletions(-)
21
22 diff --git a/pym/portage/process.py b/pym/portage/process.py
23 index bc4efb5fe..4d96f156e 100644
24 --- a/pym/portage/process.py
25 +++ b/pym/portage/process.py
26 @@ -196,7 +196,8 @@ def cleanup():
27
28 def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False,
29 uid=None, gid=None, groups=None, umask=None, logfile=None,
30 - path_lookup=True, pre_exec=None, close_fds=True, unshare_net=False,
31 + path_lookup=True, pre_exec=None,
32 + close_fds=(sys.version_info < (3, 4)), unshare_net=False,
33 unshare_ipc=False, cgroup=None):
34 """
35 Spawns a given command.
36 @@ -228,7 +229,8 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False,
37 @param pre_exec: A function to be called with no arguments just prior to the exec call.
38 @type pre_exec: callable
39 @param close_fds: If True, then close all file descriptors except those
40 - referenced by fd_pipes (default is True).
41 + referenced by fd_pipes (default is True for python3.3 and earlier, and False for
42 + python3.4 and later due to non-inheritable file descriptor behavior from PEP 446).
43 @type close_fds: Boolean
44 @param unshare_net: If True, networking will be unshared from the spawned process
45 @type unshare_net: Boolean