From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D3F9A138D0D for ; Tue, 7 Jul 2015 18:38:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6853CE0A45; Tue, 7 Jul 2015 18:38:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id EAA04E0A45 for ; Tue, 7 Jul 2015 18:38:12 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0D7E4340EF9 for ; Tue, 7 Jul 2015 18:38:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3A25E738 for ; Tue, 7 Jul 2015 18:38:10 +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: <1436294177.551837f0de95cf8e3e741e76094b31cfc0d68bd5.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/AbstractEbuildProcess.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 551837f0de95cf8e3e741e76094b31cfc0d68bd5 X-VCS-Branch: master Date: Tue, 7 Jul 2015 18:38:10 +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: 31b8d140-b8c0-4e56-90df-e956e24c0e09 X-Archives-Hash: 92eba1b3fe4b22b983813c7b827050ef commit: 551837f0de95cf8e3e741e76094b31cfc0d68bd5 Author: Zac Medico gentoo org> AuthorDate: Tue Jul 7 07:20:55 2015 +0000 Commit: Zac Medico gentoo org> CommitDate: Tue Jul 7 18:36:17 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=551837f0 AbstractEbuildProcess: use mkdtemp to avoid cgroup interference (bug 554108) This fixes parallel builds of the same package, so they don't try to kill eachothers processes. Fixes: b01a1b90d8c5 ("Add FEATURES=cgroup to isolate phase processes.") X-Gentoo-Bug: 554108 X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=554108 Acked-by: Brian Dolbec gentoo.org> pym/_emerge/AbstractEbuildProcess.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py index 31127f4..68d96e4 100644 --- a/pym/_emerge/AbstractEbuildProcess.py +++ b/pym/_emerge/AbstractEbuildProcess.py @@ -1,10 +1,12 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +import errno import io import platform import stat import subprocess +import tempfile import textwrap from _emerge.SpawnProcess import SpawnProcess from _emerge.EbuildBuildDir import EbuildBuildDir @@ -14,7 +16,7 @@ from portage.elog import messages as elog_messages from portage.localization import _ from portage.package.ebuild._ipc.ExitCommand import ExitCommand from portage.package.ebuild._ipc.QueryCommand import QueryCommand -from portage import os +from portage import shutil, os from portage.util._pty import _create_pty_or_pipe from portage.util import apply_secpass_permissions @@ -69,9 +71,7 @@ class AbstractEbuildProcess(SpawnProcess): and self.phase not in self._phases_without_cgroup): cgroup_root = '/sys/fs/cgroup' cgroup_portage = os.path.join(cgroup_root, 'portage') - cgroup_path = os.path.join(cgroup_portage, - '%s:%s' % (self.settings["CATEGORY"], - self.settings["PF"])) + try: # cgroup tmpfs if not os.path.ismount(cgroup_root): @@ -90,9 +90,9 @@ class AbstractEbuildProcess(SpawnProcess): '-o', 'rw,nosuid,nodev,noexec,none,name=portage', 'tmpfs', cgroup_portage]) - # the ebuild cgroup - if not os.path.isdir(cgroup_path): - os.mkdir(cgroup_path) + cgroup_path = tempfile.mkdtemp(dir=cgroup_portage, + prefix='%s:%s.' % (self.settings["CATEGORY"], + self.settings["PF"])) except (subprocess.CalledProcessError, OSError): pass else: @@ -313,6 +313,13 @@ class AbstractEbuildProcess(SpawnProcess): def _set_returncode(self, wait_retval): SpawnProcess._set_returncode(self, wait_retval) + if self.cgroup is not None: + try: + shutil.rmtree(self.cgroup) + except EnvironmentError as e: + if e.errno != errno.ENOENT: + raise + if self._exit_timeout_id is not None: self.scheduler.source_remove(self._exit_timeout_id) self._exit_timeout_id = None