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 43EB31384B4 for ; Tue, 3 Nov 2015 21:13:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9BB5DE0845; Tue, 3 Nov 2015 21:13:25 +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 265AFE080D for ; Tue, 3 Nov 2015 21:13:24 +0000 (UTC) Received: from localhost.localdomain (unknown [100.42.98.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id C295C33FDBF; Tue, 3 Nov 2015 21:13:23 +0000 (UTC) From: Zac Medico To: gentoo-portage-dev@lists.gentoo.org Cc: Zac Medico Subject: [gentoo-portage-dev] [PATCH] AbstractEbuildProcess: validate cgroup release agent Date: Tue, 3 Nov 2015 13:13:03 -0800 Message-Id: <1446585183-1110-1-git-send-email-zmedico@gentoo.org> X-Mailer: git-send-email 2.4.9 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: 3f4e9508-0c8f-4122-ad4c-6f69ebecb92e X-Archives-Hash: e427b91ca12f3becb424e0f9aaca7bc3 Since commit e6be71af3f67ea274db455e9c24d5f84bd372c39, the release agent can refer to a temporary file if it was set while portage was updating itself. Fix it to reset the release agent when necessary. Fixes: e6be71af3f67 ("AbstractEbuildProcess: remove cgroup with release_agent (bug 561264)") --- pym/_emerge/AbstractEbuildProcess.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py index 2b5d9c7..8bd30a6 100644 --- a/pym/_emerge/AbstractEbuildProcess.py +++ b/pym/_emerge/AbstractEbuildProcess.py @@ -96,6 +96,24 @@ class AbstractEbuildProcess(SpawnProcess): with open(os.path.join( cgroup_portage, 'notify_on_release'), 'w') as f: f.write('1') + else: + # Update release_agent if it no longer exists, because + # it refers to a temporary path when portage is updating + # itself. + release_agent = os.path.join( + cgroup_portage, 'release_agent') + try: + with open(release_agent) as f: + release_agent_path = f.readline().rstrip('\n') + except EnvironmentError: + release_agent_path = None + + if (release_agent_path is None or + not os.path.exists(release_agent_path)): + with open(release_agent, 'w') as f: + f.write(os.path.join( + self.settings['PORTAGE_BIN_PATH'], + 'cgroup-release-agent')) cgroup_path = tempfile.mkdtemp(dir=cgroup_portage, prefix='%s:%s.' % (self.settings["CATEGORY"], -- 2.4.9