diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-11-26 11:58:31 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-11-26 11:58:31 +0000 |
commit | 639741c0eb011ba39231e28bd6e76e5fc8ccdc0c (patch) | |
tree | 4825df5e37bf1045e6fe87574de792b182bbae80 /bin | |
parent | e71261fb424af2f70073384968d84dc1b623eb5a (diff) | |
download | portage-639741c0eb011ba39231e28bd6e76e5fc8ccdc0c.tar.gz portage-639741c0eb011ba39231e28bd6e76e5fc8ccdc0c.tar.bz2 portage-639741c0eb011ba39231e28bd6e76e5fc8ccdc0c.zip |
Bug #200313 - Detect and report when an ebuild phase
exits unexpectedly. This is type of behavior is known
to be triggered by things such as failed variable
assignments (bug #190128) or bad substitution errors
(bug #200313).
We use a EBUILD_EXIT_STATUS_FILE environment variable
to specify a file that the shell code is supposed to
create when it exits in a normal manner. If the file
does not get created like it's supposed to be then we
can conclude that the shell has exited in some
unexpected way.
(trunk r8682)
svn path=/main/branches/2.1.2/; revision=8684
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ebuild.sh | 3 | ||||
-rw-r--r-- | bin/isolated-functions.sh | 5 | ||||
-rwxr-xr-x | bin/misc-functions.sh | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 46651e76a..a6969c9d8 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1726,7 +1726,7 @@ if [ -n "${EBUILD_SH_ARGS}" ] ; then 9>&- fi set +f - #make sure it is writable by our group: + touch "${EBUILD_EXIT_STATUS_FILE}" &>/dev/null exit 0 ;; *) @@ -1737,6 +1737,7 @@ if [ -n "${EBUILD_SH_ARGS}" ] ; then exit 1 ;; esac + touch "${EBUILD_EXIT_STATUS_FILE}" &>/dev/null fi # Save the env only for relevant phases. diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index ae418389d..9eaf9bffb 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -124,6 +124,8 @@ diefunc() { done fi + touch "${EBUILD_EXIT_STATUS_FILE}" &>/dev/null + # subshell die support kill -s SIGTERM ${EBUILD_MASTER_PID} exit 1 @@ -416,7 +418,8 @@ save_ebuild_env() { # portage config variables and variables set directly by portage unset BAD BRACKET BUILD_PREFIX COLS \ - DISTCC_DIR DISTDIR DOC_SYMLINKS_DIR EBUILD_MASTER_PID \ + DISTCC_DIR DISTDIR DOC_SYMLINKS_DIR \ + EBUILD_EXIT_STATUS_FILE EBUILD_MASTER_PID \ ECLASSDIR ECLASS_DEPTH ENDCOL FAKEROOTKEY FEATURES \ GOOD HILITE HOME IMAGE \ KV LAST_E_CMD LAST_E_LEN LD_PRELOAD MOPREFIX \ diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 31ad9d8e8..633b3c37d 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -587,4 +587,6 @@ if [ -n "${MISC_FUNCTIONS_ARGS}" ]; then done fi +touch "${EBUILD_EXIT_STATUS_FILE}" &>/dev/null + : |