From 94015a2fe3b2d886b71e874c10bdd2504e54a133 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 2 Sep 2010 12:13:59 -0700 Subject: [PATCH] When signaling successful exit from an ebuild phase via ebuild-ipc, first check for non-empty $SANDBOX_LOG and signal unsuccessful exit if necessary. This fixes an issue with phases being treated as successful even when there were sandbox violations. --- bin/ebuild.sh | 24 +++++++++++++++++++++++- bin/misc-functions.sh | 5 ++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index b3b23aabb..73ea8c807 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -2266,6 +2266,25 @@ ebuild_main() { esac } +if [[ -s $SANDBOX_LOG ]] ; then + # We use SANDBOX_LOG to check for sandbox violations, + # so we ensure that there can't be a stale log to + # interfere with our logic. + x= + if [[ -n SANDBOX_ON ]] ; then + x=$SANDBOX_ON + export SANDBOX_ON=0 + fi + + rm -f "$SANDBOX_LOG" || \ + die "failed to remove stale sandbox log: '$SANDBOX_LOG'" + + if [[ -n $x ]] ; then + export SANDBOX_ON=$x + fi + unset x +fi + if [[ $EBUILD_PHASE = depend ]] ; then ebuild_main elif [[ -n $EBUILD_SH_ARGS ]] ; then @@ -2285,7 +2304,10 @@ elif [[ -n $EBUILD_SH_ARGS ]] ; then chmod g+w "$T/environment" &>/dev/null fi [[ -n $PORTAGE_EBUILD_EXIT_FILE ]] && > "$PORTAGE_EBUILD_EXIT_FILE" - [[ -n $PORTAGE_IPC_DAEMON ]] && "$PORTAGE_BIN_PATH"/ebuild-ipc exit 0 + if [[ -n $PORTAGE_IPC_DAEMON ]] ; then + [[ ! -s $SANDBOX_LOG ]] + "$PORTAGE_BIN_PATH"/ebuild-ipc exit $? + fi exit 0 ) exit $? diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 32d3bfc00..1edacadca 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -952,7 +952,10 @@ if [ -n "${MISC_FUNCTIONS_ARGS}" ]; then done unset x [[ -n $PORTAGE_EBUILD_EXIT_FILE ]] && > "$PORTAGE_EBUILD_EXIT_FILE" - [[ -n $PORTAGE_IPC_DAEMON ]] && "$PORTAGE_BIN_PATH"/ebuild-ipc exit 0 + if [[ -n $PORTAGE_IPC_DAEMON ]] ; then + [[ ! -s $SANDBOX_LOG ]] + "$PORTAGE_BIN_PATH"/ebuild-ipc exit $? + fi fi : -- 2.26.2