summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-12-10 01:31:10 +0000
committerZac Medico <zmedico@gentoo.org>2008-12-10 01:31:10 +0000
commite7b171c7a5accdae760596144bebb602871d4a95 (patch)
tree668b65e3c602abc3002c530192d7faf0238ecdc0
parentf66d305cbf2920b0d0e6c9247ac99b20e00b5f33 (diff)
downloadportage-e7b171c7a5accdae760596144bebb602871d4a95.tar.gz
portage-e7b171c7a5accdae760596144bebb602871d4a95.tar.bz2
portage-e7b171c7a5accdae760596144bebb602871d4a95.zip
Bug #250148 - Prevent ebuild.sh subprocess from inheriting file descriptor
9, since otherwise if a daemon process such as udevd gets spawned then it can inherit the file descriptor and hang emerge. svn path=/main/trunk/; revision=12189
-rwxr-xr-xbin/ebuild.sh28
1 files changed, 19 insertions, 9 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 0a16e8a7a..ce6a06738 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -2086,16 +2086,26 @@ ebuild_main() {
fi
}
-[[ -n $EBUILD_SH_ARGS ]] && ebuild_main
+if [[ $EBUILD_PHASE = depend ]] ; then
+ ebuild_main
+elif [[ -n $EBUILD_SH_ARGS ]] ; then
+ (
+ # Don't allow subprocesses to inherit the pipe which
+ # emerge uses to monitor ebuild.sh.
+ exec 9>&-
-# Save the env only for relevant phases.
-if [ -n "${EBUILD_SH_ARGS}" ] && \
- ! hasq ${EBUILD_SH_ARGS} clean depend help info nofetch ; then
- # Save current environment and touch a success file. (echo for success)
- umask 002
- save_ebuild_env | filter_readonly_variables > "${T}/environment"
- chown portage:portage "${T}/environment" &>/dev/null
- chmod g+w "${T}/environment" &>/dev/null
+ ebuild_main
+
+ # Save the env only for relevant phases.
+ if ! hasq "$EBUILD_SH_ARGS" clean help info nofetch ; then
+ umask 002
+ save_ebuild_env | filter_readonly_variables > "$T/environment"
+ chown portage:portage "$T/environment" &>/dev/null
+ chmod g+w "$T/environment" &>/dev/null
+ fi
+ exit 0
+ )
+ exit $?
fi
# Do not exit when ebuild.sh is sourced by other scripts.