* [gentoo-portage-dev] [PATCH] ebuild.sh: start phases in temporary HOME if available (bug 595028)
@ 2016-09-25 1:49 Zac Medico
2016-09-26 15:49 ` Alexander Berntsen
0 siblings, 1 reply; 3+ messages in thread
From: Zac Medico @ 2016-09-25 1:49 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Zac Medico
This will avoid undesirable interactions with the python sitedir,
as reported in bug 574002. Since the temporary HOME is not guaranteed
to exist for some phases, use PORTAGE_PYM_PATH as a fallback. Also,
use PORTAGE_PYM_PATH inside __dyn_clean, since HOME is removed there.
X-Gentoo-Bug: 595028
X-Gentoo-Bug-URL: https://bugs.gentoo.org/595028
---
bin/ebuild.sh | 11 ++++++++---
bin/phase-functions.sh | 8 +++++---
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 5b3146d..4a431b4 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -167,9 +167,14 @@ export SANDBOX_ON=0
# Ensure that $PWD is sane whenever possible, to protect against
# exploitation of insecure search path for python -c in ebuilds.
-# See bug #239560 and bug #469338.
-cd "${PORTAGE_PYM_PATH}" || \
- die "PORTAGE_PYM_PATH does not exist: '${PORTAGE_PYM_PATH}'"
+# See bug #239560, bug #469338, and bug #595028.
+if [[ -d ${HOME} ]] then
+ # Use portage's temporary HOME directory if available.
+ cd "${HOME}" || die
+else
+ cd "${PORTAGE_PYM_PATH}" || \
+ die "PORTAGE_PYM_PATH does not exist: '${PORTAGE_PYM_PATH}'"
+fi
#if no perms are specified, dirs/files will have decent defaults
#(not secretive, but not stupid)
diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index d75f43f..50f0fdb 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -261,6 +261,11 @@ __dyn_clean() {
chflags -R nosunlnk,nouunlnk "${PORTAGE_BUILDDIR}" 2>/dev/null
fi
+ # Some kernels, such as Solaris, return EINVAL when an attempt
+ # is made to remove the current working directory.
+ cd "${PORTAGE_PYM_PATH}" || \
+ die "PORTAGE_PYM_PATH does not exist: '${PORTAGE_PYM_PATH}'"
+
rm -rf "${PORTAGE_BUILDDIR}/image" "${PORTAGE_BUILDDIR}/homedir"
rm -f "${PORTAGE_BUILDDIR}/.installed"
@@ -288,9 +293,6 @@ __dyn_clean() {
# result in it wiping the users distfiles directory (bad).
rm -rf "${PORTAGE_BUILDDIR}/distdir"
- # Some kernels, such as Solaris, return EINVAL when an attempt
- # is made to remove the current working directory.
- cd "$PORTAGE_BUILDDIR"/../..
rmdir "$PORTAGE_BUILDDIR" 2>/dev/null
true
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] ebuild.sh: start phases in temporary HOME if available (bug 595028)
2016-09-25 1:49 [gentoo-portage-dev] [PATCH] ebuild.sh: start phases in temporary HOME if available (bug 595028) Zac Medico
@ 2016-09-26 15:49 ` Alexander Berntsen
2016-09-26 17:21 ` Zac Medico
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Berntsen @ 2016-09-26 15:49 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1.1: Type: text/plain, Size: 187 bytes --]
No real opinion -- not familiar enough with this to suggest alternative
solutions. Patch itself looks OK.
--
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] ebuild.sh: start phases in temporary HOME if available (bug 595028)
2016-09-26 15:49 ` Alexander Berntsen
@ 2016-09-26 17:21 ` Zac Medico
0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2016-09-26 17:21 UTC (permalink / raw
To: gentoo-portage-dev
On Mon, Sep 26, 2016 at 8:49 AM, Alexander Berntsen <bernalex@gentoo.org> wrote:
> No real opinion -- not familiar enough with this to suggest alternative
> solutions. Patch itself looks OK.
>
> --
> Alexander
> bernalex@gentoo.org
> https://secure.plaimi.net/~alexander
>
Pushed:
https://gitweb.gentoo.org/proj/portage.git/commit/?id=120deae6d7e63a35fc068aa92ff2e4263c98e5b6
Thanks,
Zac
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-26 17:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-25 1:49 [gentoo-portage-dev] [PATCH] ebuild.sh: start phases in temporary HOME if available (bug 595028) Zac Medico
2016-09-26 15:49 ` Alexander Berntsen
2016-09-26 17:21 ` Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox