commit:     a49a7a29189e6a29da47bc9059739d54d72e2aca
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 17 20:11:24 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Nov 17 20:15:31 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a49a7a29

helper-functions.sh: __multijob_init: handle errors

Also add mkfifo to ResolverPlayground essential_binaries, since it's
required by __multijob_init.

Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/helper-functions.sh                          | 7 ++++---
 bin/isolated-functions.sh                        | 5 +++--
 lib/portage/tests/resolver/ResolverPlayground.py | 1 +
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh
index 2d359762a..f76703f0c 100644
--- a/bin/helper-functions.sh
+++ b/bin/helper-functions.sh
@@ -19,15 +19,16 @@ __multijob_init() {
        # read and write to not block ourselve, but use it for reading only.
        # The second fd really is opened for write only, as Cygwin supports
        # just one single read fd per FIFO. #583962
-       local pipe=$(mktemp -t multijob.XXXXXX)
+       local pipe
+       pipe=$(mktemp -t multijob.XXXXXX) || die
        rm -f "${pipe}"
-       mkfifo -m 600 "${pipe}"
+       mkfifo -m 600 "${pipe}" || die
        __redirect_alloc_fd mj_read_fd "${pipe}"
        __redirect_alloc_fd mj_write_fd "${pipe}" '>'
        rm -f "${pipe}"
 
        # See how many children we can fork based on the user's settings.
-       mj_max_jobs=$(___makeopts_jobs "$@")
+       mj_max_jobs=$(___makeopts_jobs "$@") || die
        mj_num_jobs=0
 }
 

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 893c02f9b..e8d41fd64 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -453,8 +453,9 @@ fi
 
 ___makeopts_jobs() {
        # Copied from eutils.eclass:makeopts_jobs()
-       local jobs=$(echo " ${MAKEOPTS} " | \
-               sed -r -n 
's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p')
+       local jobs
+       jobs=$(echo " ${MAKEOPTS} " | \
+               sed -r -n 
's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p') || die
        echo ${jobs:-1}
 }
 

diff --git a/lib/portage/tests/resolver/ResolverPlayground.py 
b/lib/portage/tests/resolver/ResolverPlayground.py
index 3d48c244f..cc3056ab4 100644
--- a/lib/portage/tests/resolver/ResolverPlayground.py
+++ b/lib/portage/tests/resolver/ResolverPlayground.py
@@ -99,6 +99,7 @@ class ResolverPlayground(object):
                                "install",
                                "ln",
                                "mkdir",
+                               "mkfifo",
                                "mktemp",
                                "mv",
                                "readlink",

Reply via email to