commit:     32496c53aa33da3c0122cb26ca9ae285f815ebf2
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Jun 24 04:59:32 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 28 02:28:40 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=32496c53

Generally check whether PORTAGE_BIN_PATH is unset or empty

Should the 'PORTAGE_BIN_PATH' environment variable be unset or empty,
many units will attempt to source "/isolated-functions.sh". Instead,
require for the variable to be set and non-empty, resulting in a better
diganostic message being shown in situations where a unit is being
sourced or executed outside of its appropriate operating environment.

BEFORE:

bin/ebuild.sh: line 13: /isolated-functions.sh: No such file or directory

AFTER:

bin/ebuild.sh: line 13: PORTAGE_BIN_PATH: parameter null or not set

Also, refrain from sourcing "isolated-functions.sh" twice in "doinitd".

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/ebuild-helpers/die                | 2 +-
 bin/ebuild-helpers/dobin              | 2 +-
 bin/ebuild-helpers/doconfd            | 2 +-
 bin/ebuild-helpers/dodir              | 2 +-
 bin/ebuild-helpers/dodoc              | 2 +-
 bin/ebuild-helpers/doenvd             | 2 +-
 bin/ebuild-helpers/doexe              | 2 +-
 bin/ebuild-helpers/dohard             | 2 +-
 bin/ebuild-helpers/doheader           | 2 +-
 bin/ebuild-helpers/dohtml             | 2 +-
 bin/ebuild-helpers/doinfo             | 2 +-
 bin/ebuild-helpers/doinitd            | 3 +--
 bin/ebuild-helpers/doins              | 2 +-
 bin/ebuild-helpers/dolib              | 2 +-
 bin/ebuild-helpers/doman              | 2 +-
 bin/ebuild-helpers/domo               | 2 +-
 bin/ebuild-helpers/dosbin             | 2 +-
 bin/ebuild-helpers/dosed              | 2 +-
 bin/ebuild-helpers/dosym              | 2 +-
 bin/ebuild-helpers/elog               | 2 +-
 bin/ebuild-helpers/emake              | 2 +-
 bin/ebuild-helpers/fowners            | 2 +-
 bin/ebuild-helpers/fperms             | 2 +-
 bin/ebuild-helpers/keepdir            | 2 +-
 bin/ebuild-helpers/newins             | 2 +-
 bin/ebuild-helpers/nonfatal           | 2 +-
 bin/ebuild-helpers/prepall            | 2 +-
 bin/ebuild-helpers/unprivileged/chown | 2 +-
 bin/ebuild-helpers/xattr/install      | 2 +-
 bin/ebuild-pyhelper                   | 2 +-
 bin/ebuild.sh                         | 2 +-
 bin/ecompress                         | 2 +-
 bin/ecompress-file                    | 2 +-
 bin/emerge-webrsync                   | 2 +-
 bin/estrip                            | 2 +-
 bin/helper-functions.sh               | 2 +-
 bin/install-qa-check.d/60pkgconfig    | 2 +-
 bin/isolated-functions.sh             | 2 +-
 bin/misc-functions.sh                 | 2 +-
 bin/portageq-wrapper                  | 2 +-
 misc/emerge-delta-webrsync            | 2 +-
 41 files changed, 41 insertions(+), 42 deletions(-)

diff --git a/bin/ebuild-helpers/die b/bin/ebuild-helpers/die
index 5348acbd31..2f32f589c3 100755
--- a/bin/ebuild-helpers/die
+++ b/bin/ebuild-helpers/die
@@ -2,6 +2,6 @@
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 die "$@"
 exit 1

diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin
index 123a3177a6..c9f9e52beb 100755
--- a/bin/ebuild-helpers/dobin
+++ b/bin/ebuild-helpers/dobin
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if [[ $# -lt 1 ]] ; then
        __helpers_die "${0##*/}: at least one argument needed"

diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index 9fbbc7d5a8..4f16c12459 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/bin/ebuild-helpers/doconfd
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if [[ $# -lt 1 ]] ; then
        __helpers_die "${0##*/}: at least one argument needed"

diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir
index 727f62a99f..e74d109619 100755
--- a/bin/ebuild-helpers/dodir
+++ b/bin/ebuild-helpers/dodir
@@ -2,7 +2,7 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if ! ___eapi_has_prefix_variables; then
        ED=${D}

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 240777aac1..e233ba8f66 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if ___eapi_dodoc_supports_-r; then
        __PORTAGE_HELPER='dodoc' exec doins "$@"

diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd
index 38b882c7e2..fa1cf889ed 100755
--- a/bin/ebuild-helpers/doenvd
+++ b/bin/ebuild-helpers/doenvd
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if [[ $# -lt 1 ]] ; then
        __helpers_die "${0##*/}: at least one argument needed"

diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe
index 490ac53bab..2ffcc1aac5 100755
--- a/bin/ebuild-helpers/doexe
+++ b/bin/ebuild-helpers/doexe
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if [[ $# -lt 1 ]] ; then
        __helpers_die "${0##*/}: at least one argument needed"

diff --git a/bin/ebuild-helpers/dohard b/bin/ebuild-helpers/dohard
index 326752b4f2..791f2580d7 100755
--- a/bin/ebuild-helpers/dohard
+++ b/bin/ebuild-helpers/dohard
@@ -2,7 +2,7 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if ! ___eapi_has_dohard; then
        die "'${0##*/}' has been banned for EAPI '${EAPI}'"

diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
index 5fc9febf5a..dd45ffaead 100755
--- a/bin/ebuild-helpers/doheader
+++ b/bin/ebuild-helpers/doheader
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if ! ___eapi_has_doheader; then
        die "${0##*/} is not supported in EAPI ${EAPI}"

diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
index b8929ceff8..3d76def7c9 100755
--- a/bin/ebuild-helpers/dohtml
+++ b/bin/ebuild-helpers/dohtml
@@ -2,7 +2,7 @@
 # Copyright 2009-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if ! ___eapi_has_dohtml; then
        die "'${0##*/}' has been banned for EAPI '${EAPI}'"

diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo
index 69de67026d..d039aab7e7 100755
--- a/bin/ebuild-helpers/doinfo
+++ b/bin/ebuild-helpers/doinfo
@@ -2,7 +2,7 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if [[ -z $1 ]] ; then
        __helpers_die "${0##*/}: at least one argument needed"

diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd
index cdeb1fef46..0c8845c703 100755
--- a/bin/ebuild-helpers/doinitd
+++ b/bin/ebuild-helpers/doinitd
@@ -2,10 +2,9 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if [[ $# -lt 1 ]] ; then
-       source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
        __helpers_die "${0##*/}: at least one argument needed"
        exit 1
 fi

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index ff5e88f3a5..17bb6293f6 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 helper=${__PORTAGE_HELPER:-${0##*/}}
 

diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
index d6d21314b7..c322e20a76 100755
--- a/bin/ebuild-helpers/dolib
+++ b/bin/ebuild-helpers/dolib
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if [[ -z ${PORTAGE_INTERNAL_DOLIB} ]] && ! ___eapi_has_dolib_libopts; then
        die "'${0##*/}' has been banned for EAPI '${EAPI}'"

diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman
index a7825b4705..b1909962be 100755
--- a/bin/ebuild-helpers/doman
+++ b/bin/ebuild-helpers/doman
@@ -2,7 +2,7 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if [[ $# -lt 1 ]] ; then
        __helpers_die "${0##*/}: at least one argument needed"

diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo
index 65cd6b8c16..e261da955e 100755
--- a/bin/ebuild-helpers/domo
+++ b/bin/ebuild-helpers/domo
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 mynum=${#}
 if [ ${mynum} -lt 1 ] ; then

diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin
index fac546c775..8976298886 100755
--- a/bin/ebuild-helpers/dosbin
+++ b/bin/ebuild-helpers/dosbin
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if [[ $# -lt 1 ]] ; then
        __helpers_die "${0##*/}: at least one argument needed"

diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed
index 748ab414ad..09cdabad40 100755
--- a/bin/ebuild-helpers/dosed
+++ b/bin/ebuild-helpers/dosed
@@ -2,7 +2,7 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if ! ___eapi_has_dosed; then
        die "'${0##*/}' has been banned for EAPI '${EAPI}'"

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index 89ee66a967..44e2920aa5 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 option_r=
 if ___eapi_has_dosym_r && [[ ${1} == -r ]]; then

diff --git a/bin/ebuild-helpers/elog b/bin/ebuild-helpers/elog
index e878a3da23..c941e1fec2 100755
--- a/bin/ebuild-helpers/elog
+++ b/bin/ebuild-helpers/elog
@@ -2,6 +2,6 @@
 # Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 ${0##*/} "$@"

diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake
index 3d8b31eee5..33af49f831 100755
--- a/bin/ebuild-helpers/emake
+++ b/bin/ebuild-helpers/emake
@@ -9,7 +9,7 @@
 #
 # With newer EAPIs, we also automatically fail the build if make itself fails.
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 cmd=(
        ${MAKE:-make} ${MAKEOPTS} "$@" ${EXTRA_EMAKE}

diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
index c675bea296..a6367e4c00 100755
--- a/bin/ebuild-helpers/fowners
+++ b/bin/ebuild-helpers/fowners
@@ -2,7 +2,7 @@
 # Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if ! ___eapi_has_prefix_variables; then
        ED=${D}

diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms
index aab8084ce6..6e640b8c65 100755
--- a/bin/ebuild-helpers/fperms
+++ b/bin/ebuild-helpers/fperms
@@ -2,7 +2,7 @@
 # Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if ! ___eapi_has_prefix_variables; then
        ED=${D}

diff --git a/bin/ebuild-helpers/keepdir b/bin/ebuild-helpers/keepdir
index eb969b11b8..9f3033ff12 100755
--- a/bin/ebuild-helpers/keepdir
+++ b/bin/ebuild-helpers/keepdir
@@ -2,7 +2,7 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if ! ___eapi_has_prefix_variables; then
        ED=${D}

diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins
index 8019475496..674e3a2399 100755
--- a/bin/ebuild-helpers/newins
+++ b/bin/ebuild-helpers/newins
@@ -2,7 +2,7 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 helper=${0##*/}
 

diff --git a/bin/ebuild-helpers/nonfatal b/bin/ebuild-helpers/nonfatal
index fd55a431d0..c555f0e9e1 100755
--- a/bin/ebuild-helpers/nonfatal
+++ b/bin/ebuild-helpers/nonfatal
@@ -2,7 +2,7 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 if ! ___eapi_has_nonfatal; then
        die "${0##*/} not supported in this EAPI"

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index 80fcecba60..ca79c7c107 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -2,7 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 die "'${0##*/}' is not allowed in ebuild scope"
 exit 1

diff --git a/bin/ebuild-helpers/unprivileged/chown 
b/bin/ebuild-helpers/unprivileged/chown
index 0788a8b153..3f6475865f 100755
--- a/bin/ebuild-helpers/unprivileged/chown
+++ b/bin/ebuild-helpers/unprivileged/chown
@@ -2,7 +2,7 @@
 # Copyright 2012-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 scriptpath=${BASH_SOURCE[0]}
 scriptname=${scriptpath##*/}

diff --git a/bin/ebuild-helpers/xattr/install b/bin/ebuild-helpers/xattr/install
index 52ecf5a538..aeb6cbc840 100755
--- a/bin/ebuild-helpers/xattr/install
+++ b/bin/ebuild-helpers/xattr/install
@@ -37,7 +37,7 @@ if [[ "${implementation}" == "c" ]]; then
        exec "${INSTALL_XATTR}" "$@"
 elif [[ "${implementation}" == "python" ]]; then
        PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
-               exec "${PORTAGE_PYTHON:-/usr/bin/python}" 
"${PORTAGE_BIN_PATH}/install.py" "$@"
+               exec "${PORTAGE_PYTHON:-/usr/bin/python}" 
"${PORTAGE_BIN_PATH:?}/install.py" "$@"
 else
        echo "Unknown implementation for PORTAGE_INSTALL_XATTR_IMPLEMENTATION"
        exit -1

diff --git a/bin/ebuild-pyhelper b/bin/ebuild-pyhelper
index 901277c96c..1af05f479f 100755
--- a/bin/ebuild-pyhelper
+++ b/bin/ebuild-pyhelper
@@ -11,7 +11,7 @@ fi
 
 # Use safe cwd, avoiding unsafe import for bug #469338.
 cd "${PORTAGE_PYM_PATH}" || exit 1
-for path in "${PORTAGE_BIN_PATH}/${0##*/}"{.py,}; do
+for path in "${PORTAGE_BIN_PATH:?}/${0##*/}"{.py,}; do
        if [[ -x "${path}" ]]; then
                PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
                        exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${path}" "$@"

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 2b56dc0157..95fdbb9c98 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -10,7 +10,7 @@ unalias -a
 unset BASH_COMPAT
 declare -F ___in_portage_iuse >/dev/null && export -n -f ___in_portage_iuse
 
-source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit 1
+source "${PORTAGE_BIN_PATH:?}/isolated-functions.sh" || exit
 
 # Set up the bash version compatibility level.  This does not disable
 # features when running with a newer version, but makes it so that when

diff --git a/bin/ecompress b/bin/ecompress
index 6a1d2ab472..2500bd5a2c 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -3,7 +3,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # shellcheck disable=SC1007
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 do_ignore() {
        local -x LC_ALL= LC_COLLATE=C

diff --git a/bin/ecompress-file b/bin/ecompress-file
index 3cee5f90a3..a1009c0289 100755
--- a/bin/ecompress-file
+++ b/bin/ecompress-file
@@ -2,7 +2,7 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 compress_file() {
        mask_ext_re=""

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index 4b84483078..e908a97cbc 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -643,7 +643,7 @@ portage_vars=(
 eval "$("${portageq}" envvar -v "${portage_vars[@]}")"
 export http_proxy https_proxy ftp_proxy
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 # The implementation of die() from isolated-functions.sh is over-engineered and
 # unsuitable for standalone scripts. This one mimics gentoo-functions.

diff --git a/bin/estrip b/bin/estrip
index 9b4250f768..67ceb4974f 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -3,7 +3,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # shellcheck disable=1007,2128
 
-source "${PORTAGE_BIN_PATH}"/helper-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/helper-functions.sh || exit
 
 # Atomically writes the standard input to a file whose name is formatted as
 # "estrip-%u.warning", <checksum of input>. The existing contents of the file,

diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh
index 93d80f5340..2f25fa8234 100644
--- a/bin/helper-functions.sh
+++ b/bin/helper-functions.sh
@@ -5,7 +5,7 @@
 # For routines we want to use in ebuild-helpers/ but don't want to
 # expose to the general ebuild environment.
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 #
 # API functions for doing parallel processing

diff --git a/bin/install-qa-check.d/60pkgconfig 
b/bin/install-qa-check.d/60pkgconfig
index 1e8a18ed9e..10484dce92 100644
--- a/bin/install-qa-check.d/60pkgconfig
+++ b/bin/install-qa-check.d/60pkgconfig
@@ -4,7 +4,7 @@
 
 # Ensure that ver_test is available.
 if ! ___eapi_has_version_functions; then
-       source "${PORTAGE_BIN_PATH}/eapi7-ver-funcs.sh" || exit 1
+       source "${PORTAGE_BIN_PATH:?}/eapi7-ver-funcs.sh" || exit
 fi
 
 pkgconfig_check() {

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index ceba971ae5..88f1913fdf 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -3,7 +3,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # shellcheck disable=SC2128
 
-source "${PORTAGE_BIN_PATH}/eapi.sh" || exit 1
+source "${PORTAGE_BIN_PATH:?}/eapi.sh" || exit
 
 if ___eapi_has_version_functions; then
        source "${PORTAGE_BIN_PATH}/eapi7-ver-funcs.sh" || exit 1

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 601f6b15bc..9ffe2274fc 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -16,7 +16,7 @@
 MISC_FUNCTIONS_ARGS="$@"
 shift $#
 
-source "${PORTAGE_BIN_PATH}/ebuild.sh" || exit 1
+source "${PORTAGE_BIN_PATH:?}/ebuild.sh" || exit
 
 install_symlink_html_docs() {
        if ! ___eapi_has_prefix_variables; then

diff --git a/bin/portageq-wrapper b/bin/portageq-wrapper
index 047d1d826c..4c7d1100eb 100755
--- a/bin/portageq-wrapper
+++ b/bin/portageq-wrapper
@@ -8,7 +8,7 @@ cd "${PORTAGE_PYM_PATH}" || exit 1
 IFS=":"
 set -f # in case ${PATH} contains any shell glob characters
 
-for path in "${PORTAGE_BIN_PATH}" ${PATH}; do
+for path in "${PORTAGE_BIN_PATH:?}" ${PATH}; do
        [[ -x ${path}/portageq ]] || continue
        PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
                exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${path}/portageq" 
"$@"

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 53cb8ce0a5..43ed6bac7c 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -97,7 +97,7 @@ eval "$("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \
        USERLAND http_proxy https_proxy ftp_proxy)"
 export http_proxy https_proxy ftp_proxy
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit
+source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
 
 repo_name=gentoo
 repo_location=$(__repo_attr "${repo_name}" location)

Reply via email to