Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 547086 - Builds can't be resumed if ._portage_reinstall_ magic happened
Summary: Builds can't be resumed if ._portage_reinstall_ magic happened
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 484436
  Show dependency tree
 
Reported: 2015-04-19 13:09 UTC by Michał Górny
Modified: 2015-05-19 19:41 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-04-19 13:09:17 UTC
Long story short, if build is interrupted during emerge run which reinstalled Portage, environment has:

declare -x PATH="/usr/lib64/distcc/bin:/tmp/portage/._portage_reinstall_.na88mey6/bin/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.2:/usr/i686-pc-linux-gnu/gcc-bin/4.9.2"

which means it's not going to work via 'ebuild ... install' resume. Would be nice to keep the original Portage directory somewhere later in $PATH too, as a fallback.
Comment 1 Zac Medico gentoo-dev 2015-04-19 19:30:54 UTC
There's a patch in the following branch:

https://github.com/zmedico/portage/tree/bug_547086

I've posted it for review here:

https://archives.gentoo.org/gentoo-portage-dev/message/7d89f9421341737c6c231cb789551ad9
Comment 2 Zac Medico gentoo-dev 2015-04-21 23:54:13 UTC
This is in the master branch now:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=130c01b9e561dd6ff7733a4905b21a0a921e9a22
Comment 3 Arfrever Frehtes Taifersar Arahesis 2015-04-27 06:45:31 UTC
(In reply to Zac Medico from comment #2)
> This is in the master branch now:
> 
> https://gitweb.gentoo.org/proj/portage.git/commit/
> ?id=130c01b9e561dd6ff7733a4905b21a0a921e9a22

This change causes forkbomb during reinstallation of Portage with FEATURES="xattr".


/var/tmp/portage/._portage_reinstall_.6d7lm6j5/bin/phase-functions.sh: linia 234:  1263 Killed            install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}"
 * ERROR: sys-apps/portage-9999::local failed (unpack phase):
 *   Failed to create dir '/var/tmp/portage/sys-apps/portage-9999/work'
 * 
 * Call stack:
 *            ebuild.sh, line 757:  Called __ebuild_main 'unpack'
 *   phase-functions.sh, line 975:  Called __dyn_unpack
 *   phase-functions.sh, line 240:  Called die
 * The specific snippet of code:
 *              install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
Comment 4 Zac Medico gentoo-dev 2015-04-27 16:24:59 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #3)
> (In reply to Zac Medico from comment #2)
> > This is in the master branch now:
> > 
> > https://gitweb.gentoo.org/proj/portage.git/commit/
> > ?id=130c01b9e561dd6ff7733a4905b21a0a921e9a22
> 
> This change causes forkbomb during reinstallation of Portage with
> FEATURES="xattr".

It will probably do the same thing on FreeBSD due to the sed wrapper.

We should revert this patch until we come up with a way to avoid the forkbombs.
Comment 5 Zac Medico gentoo-dev 2015-04-27 16:50:02 UTC
One possible solution for the install/sed wrapper forkbombs would be to have the wrappers internally filter paths that begin with $EPREFIX/usr/lib*/portage/ or contain _portage_reinstall_.
Comment 6 Zac Medico gentoo-dev 2015-04-27 20:31:38 UTC
There's a patch for the fork bomb in the following branch:

https://github.com/zmedico/portage/tree/bug_547086

You can install my branch for testing purposes like this:

portage_LIVE_REPO=https://github.com/zmedico/portage.git \
portage_LIVE_BRANCH=bug_547086 \
ACCEPT_KEYWORDS="**" emerge --oneshot =sys-apps/portage-9999
Comment 7 Zac Medico gentoo-dev 2015-04-28 01:32:24 UTC
My branch is updated now with fixes to address issues raised in comments on github.
Comment 9 Brian Dolbec (RETIRED) gentoo-dev 2015-05-19 19:41:01 UTC
Released in portage-2.2.19