diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-12-12 21:28:54 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-12-12 21:28:54 +0000 |
commit | ffd4b46475bfeee8ac6d90e48d8751169e432b30 (patch) | |
tree | a24da27583d24c63a5aa6fce7f8da2a617875b81 /bin/ebuild.sh | |
parent | 2fa6a6ac1aa99626bc001a979f17f8d07e709504 (diff) | |
download | portage-ffd4b46475bfeee8ac6d90e48d8751169e432b30.tar.gz portage-ffd4b46475bfeee8ac6d90e48d8751169e432b30.tar.bz2 portage-ffd4b46475bfeee8ac6d90e48d8751169e432b30.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. (trunk r12189)
svn path=/main/branches/2.1.6/; revision=12222
Diffstat (limited to 'bin/ebuild.sh')
-rwxr-xr-x | bin/ebuild.sh | 28 |
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. |