From 0f7b2df6fbe0685c3189f0c62ce92c845dbee7e2 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 24 Apr 2009 02:18:34 +0000 Subject: [PATCH] =?utf8?q?Add=20dohard=20and=20doset=20helper=20which=20di?= =?utf8?q?e=20for=20EAPI=203.=20TODO:=20Make=20the=20die=20helper=20use=20?= =?utf8?q?pipe=20or=20socket=20IPC=20instead=20of=20a=20signal,=20to=20avo?= =?utf8?q?id=20a=20potential=20race=20condition=20in=20signal=20delivery.?= =?utf8?q?=20Thanks=20to=20to=20Tiziano=20M=C3=BCller=20=20f?= =?utf8?q?or=20the=20initial=20patch.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit svn path=/main/trunk/; revision=13389 --- bin/banned-helper | 7 +++++++ bin/ebuild-helpers/3/dohard | 1 + bin/ebuild-helpers/3/dosed | 1 + bin/ebuild-helpers/die | 12 ++++++++++++ bin/ebuild.sh | 4 ++-- 5 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 bin/banned-helper create mode 120000 bin/ebuild-helpers/3/dohard create mode 120000 bin/ebuild-helpers/3/dosed create mode 100755 bin/ebuild-helpers/die diff --git a/bin/banned-helper b/bin/banned-helper new file mode 100755 index 000000000..aa962a1f6 --- /dev/null +++ b/bin/banned-helper @@ -0,0 +1,7 @@ +#!/bin/bash +# Copyright 2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +die "'${0##*/}' has been banned for EAPI '$EAPI'" +exit 1 diff --git a/bin/ebuild-helpers/3/dohard b/bin/ebuild-helpers/3/dohard new file mode 120000 index 000000000..1a6b57a39 --- /dev/null +++ b/bin/ebuild-helpers/3/dohard @@ -0,0 +1 @@ +../../banned-helper \ No newline at end of file diff --git a/bin/ebuild-helpers/3/dosed b/bin/ebuild-helpers/3/dosed new file mode 120000 index 000000000..1a6b57a39 --- /dev/null +++ b/bin/ebuild-helpers/3/dosed @@ -0,0 +1 @@ +../../banned-helper \ No newline at end of file diff --git a/bin/ebuild-helpers/die b/bin/ebuild-helpers/die new file mode 100755 index 000000000..e871bd9fe --- /dev/null +++ b/bin/ebuild-helpers/die @@ -0,0 +1,12 @@ +#!/bin/bash +# Copyright 2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# TODO: Eliminate race condition in signal delivery by using pipe or socket +# IPC to guarantee that the ebuild process and all of its children (including +# this helper) are killed immediately, ensuring that "false success" is +# impossible. +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +die "$@" +exit 1 diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 5f78c8e41..9cbd748e6 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -56,8 +56,8 @@ qa_call() { return $retval } -# subshell die support -EBUILD_MASTER_PID=$$ +# Subshell/helper die support (must export for the die helper). +export EBUILD_MASTER_PID=$$ trap 'exit 1' SIGTERM EBUILD_SH_ARGS="$*" -- 2.26.2