From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 22BE11382C5 for ; Thu, 22 Feb 2018 17:32:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2612DE07FA; Thu, 22 Feb 2018 17:32:33 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 07612E07FA for ; Thu, 22 Feb 2018 17:32:33 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D3022335C3E for ; Thu, 22 Feb 2018 17:32:31 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C7CC2211 for ; Thu, 22 Feb 2018 17:32:29 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1519320626.d3778a92be0ac4a22eb61e3affdc85f99337847a.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/process.py X-VCS-Directories: pym/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: d3778a92be0ac4a22eb61e3affdc85f99337847a X-VCS-Branch: master Date: Thu, 22 Feb 2018 17:32:29 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e2e2c35e-1264-43a5-bacf-4fa8e4a2a1fb X-Archives-Hash: f5bd227313998e10df81735660d01231 commit: d3778a92be0ac4a22eb61e3affdc85f99337847a Author: Zac Medico gentoo org> AuthorDate: Wed Feb 21 23:14:44 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Thu Feb 22 17:30:26 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d3778a92 portage.process.spawn: default close_fds=False (bug 648432) For python3.4 and later, default to close_fds=False, since file descriptors are non-inheritable by default due to PEP 446. This solves a performance problem on systems like FreeBSD, where our get_open_fds function returns all possible file descriptor values (including those that are not open). Bug: https://bugs.gentoo.org/648432 See: https://www.python.org/dev/peps/pep-0446/ pym/portage/process.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pym/portage/process.py b/pym/portage/process.py index bc4efb5fe..4d96f156e 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -196,7 +196,8 @@ def cleanup(): def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False, uid=None, gid=None, groups=None, umask=None, logfile=None, - path_lookup=True, pre_exec=None, close_fds=True, unshare_net=False, + path_lookup=True, pre_exec=None, + close_fds=(sys.version_info < (3, 4)), unshare_net=False, unshare_ipc=False, cgroup=None): """ Spawns a given command. @@ -228,7 +229,8 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False, @param pre_exec: A function to be called with no arguments just prior to the exec call. @type pre_exec: callable @param close_fds: If True, then close all file descriptors except those - referenced by fd_pipes (default is True). + referenced by fd_pipes (default is True for python3.3 and earlier, and False for + python3.4 and later due to non-inheritable file descriptor behavior from PEP 446). @type close_fds: Boolean @param unshare_net: If True, networking will be unshared from the spawned process @type unshare_net: Boolean