From: Zac Medico <zmedico@gentoo.org>
Date: Fri, 13 Aug 2010 17:32:48 +0000 (-0700)
Subject: Move EBUILD_MASTER_PID and associated SIGTERM trap into ebuild_main()
X-Git-Tag: v2.2_rc68~239
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c192ad9dcd9e70e206340caa0a4bbd70fd0582bf;p=portage.git

Move EBUILD_MASTER_PID and associated SIGTERM trap into ebuild_main()
since it seems more reliable this way. This helps us avoid having
EbuildIpcDaemon need to send a kill signal (and triggering the
zombie message too). This is especially important for the die helper
which is called by other helpers for EAPI 4.
---

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 8b458705d..1b1c054f1 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -54,10 +54,6 @@ qa_call() {
 	return $retval
 }
 
-# Subshell/helper die support (must export for the die helper).
-export EBUILD_MASTER_PID=$$
-trap 'exit 1' SIGTERM
-
 EBUILD_SH_ARGS="$*"
 
 shift $#
@@ -2034,6 +2030,11 @@ if [ "${EBUILD_PHASE}" != "depend" ] ; then
 fi
 
 ebuild_main() {
+
+	# Subshell/helper die support (must export for the die helper).
+	export EBUILD_MASTER_PID=$BASHPID
+	trap 'exit 1' SIGTERM
+
 	local f x
 
 	if [[ $EBUILD_PHASE != depend ]] ; then