From 982c0075fc974bf19394ed94f6151b671ddd8767 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 19 Mar 2012 11:12:32 -0700 Subject: [PATCH] spawn_nofetch: clone locked config, bug #408817 It's unsafe to pass in an unlocked config instance, since that can trigger issues like bug #408817 due to fragile assumptions involving the config state inside doebuild_environment(). --- pym/_emerge/resolver/output.py | 3 +-- pym/portage/package/ebuild/_spawn_nofetch.py | 6 +++++- pym/portage/package/ebuild/digestgen.py | 3 +-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py index 53ec4f02f..bec6619a1 100644 --- a/pym/_emerge/resolver/output.py +++ b/pym/_emerge/resolver/output.py @@ -914,8 +914,7 @@ class Display(object): writemsg_stdout("\nFetch instructions for %s:\n" % (pkg.cpv,), noiselevel=-1) spawn_nofetch(self.conf.trees[pkg.root]["porttree"].dbapi, - pkg_info.ebuild_path, - settings=self.conf.pkgsettings[pkg.root]) + pkg_info.ebuild_path) if self.conf.changelog: self.print_changelog() diff --git a/pym/portage/package/ebuild/_spawn_nofetch.py b/pym/portage/package/ebuild/_spawn_nofetch.py index bda1dc078..94f8c79a3 100644 --- a/pym/portage/package/ebuild/_spawn_nofetch.py +++ b/pym/portage/package/ebuild/_spawn_nofetch.py @@ -20,7 +20,11 @@ def spawn_nofetch(portdb, ebuild_path, settings=None): to cache metadata. It will be cloned internally, in order to prevent any changes from interfering with the calling code. If settings is None then a suitable config instance will be - acquired from the given portdbapi instance. + acquired from the given portdbapi instance. Do not use the + settings parameter unless setcpv has been called on the given + instance, since otherwise it's possible to trigger issues like + bug #408817 due to fragile assumptions involving the config + state inside doebuild_environment(). A private PORTAGE_BUILDDIR will be created and cleaned up, in order to avoid any interference with any other processes. diff --git a/pym/portage/package/ebuild/digestgen.py b/pym/portage/package/ebuild/digestgen.py index f14368d23..38e9991bd 100644 --- a/pym/portage/package/ebuild/digestgen.py +++ b/pym/portage/package/ebuild/digestgen.py @@ -148,8 +148,7 @@ def digestgen(myarchives=None, mysettings=None, myportdb=None): if not fetch({myfile : uris}, mysettings): myebuild = os.path.join(mysettings["O"], catsplit(cpv)[1] + ".ebuild") - spawn_nofetch(myportdb, myebuild, - settings=mysettings) + spawn_nofetch(myportdb, myebuild) writemsg(_("!!! Fetch failed for %s, can't update " "Manifest\n") % myfile, noiselevel=-1) if myfile in dist_hashes and \ -- 2.26.2