commit:     b4a90d77ea10bf9ca993c7b464d4d789535e1577
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 29 13:47:45 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Jul 29 20:02:21 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=b4a90d77

gen_determineargs.sh: determine_real_args(): Don't allow TMPDIR with spaces

This just won't work -- many packages like util-linux don't support spaces
in builddir path and will fail when applying libtool magic.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_determineargs.sh |  7 +++++++
 gen_funcs.sh         | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index b64cdba..9170080 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -380,6 +380,13 @@ determine_real_args() {
 
        dump_debugcache
 
+       if isTrue "$(has_space_characters "${TMPDIR}")"
+       then
+               # Packages like util-linux will fail to compile when path to
+               # build dir contains spaces
+               gen_die "--tmpdir '${TMPDIR}' contains space character(s) which 
are not supported!"
+       fi
+
        if [ ! -d "${TMPDIR}" ]
        then
                mkdir -p "${TMPDIR}" || gen_die "Failed to create '${TMPDIR}'!"

diff --git a/gen_funcs.sh b/gen_funcs.sh
index e700ae1..c042513 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -209,6 +209,22 @@ can_run_programs_compiled_by_genkernel() {
        echo "${can_run_programs}"
 }
 
+has_space_characters() {
+       [[ ${#} -ne 1 ]] \
+               && gen_die "$(get_useful_function_stack "${FUNCNAME}")Invalid 
usage of ${FUNCNAME}(): Function takes exactly one argument (${#} given)!"
+
+       local testvalue=${1}
+       local has_space_characters=no
+
+       local space_pattern='[[:space:]]'
+       if [[ "${testvalue}" =~ ${space_pattern} ]]
+       then
+               has_space_characters=yes
+       fi
+
+       echo "${has_space_characters}"
+}
+
 is_gzipped() {
        [[ ${#} -ne 1 ]] \
                && gen_die "$(get_useful_function_stack "${FUNCNAME}")Invalid 
usage of ${FUNCNAME}(): Function takes exactly one argument (${#} given)!"

Reply via email to