public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Brian Dolbec <dolsen@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH] AbstractEbuildProcess: validate cgroup release agent
Date: Tue, 3 Nov 2015 15:53:27 -0800	[thread overview]
Message-ID: <20151103155327.6b912abb.dolsen@gentoo.org> (raw)
In-Reply-To: <1446585183-1110-1-git-send-email-zmedico@gentoo.org>

On Tue,  3 Nov 2015 13:13:03 -0800
Zac Medico <zmedico@gentoo.org> wrote:

> 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"],

yeah, looks good :)

-- 
Brian Dolbec <dolsen>



      reply	other threads:[~2015-11-03 23:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 21:13 [gentoo-portage-dev] [PATCH] AbstractEbuildProcess: validate cgroup release agent Zac Medico
2015-11-03 23:53 ` Brian Dolbec [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151103155327.6b912abb.dolsen@gentoo.org \
    --to=dolsen@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox