aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2021-06-21 19:42:28 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2021-06-21 19:42:28 +0100
commit0f2a105de5c407a2fa0113d0815d54e0067bbb4b (patch)
tree996da2ca1a8be4ab91c0c927b9eda4e8a1170579
parentcrossdev: use die() in eval() context to avoid error message swallowing (diff)
downloadcrossdev-0f2a105de5c407a2fa0113d0815d54e0067bbb4b.tar.gz
crossdev-0f2a105de5c407a2fa0113d0815d54e0067bbb4b.tar.bz2
crossdev-0f2a105de5c407a2fa0113d0815d54e0067bbb4b.zip
crossdev: fail eval when multilib.eclass sourcing fails
Before the change failure to source 'multilib.eclass' resuled in a fallback mode to be used instead of hard failure. It was caused by two expansion layers of 'eval $(...)'. After the change falure to source 'mmultilib.eclass' hard fails early: ``` $ PORTAGE_CONFIGROOT=$(pwd)/foo EPREFIX=$(pwd)/foo PORT_LOGDIR=$(pwd)/foo ./crossdev -t mmix -P -p * error: : EAPI 0 not supported * * If you file a bug, please attach the following logfiles: * /home/slyfox/dev/git/crossdev/foo/cross--info.log * * error: could not load multilib settings for 'HCHOST' * * If you file a bug, please attach the following logfiles: * /home/slyfox/dev/git/crossdev/foo/cross-mmix-info.log ``` Reported-by: Marco Scardovi (scardracs) Bug: https://bugs.gentoo.org/797367 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rwxr-xr-xcrossdev5
1 files changed, 5 insertions, 0 deletions
diff --git a/crossdev b/crossdev
index 1a2b030..619603f 100755
--- a/crossdev
+++ b/crossdev
@@ -968,6 +968,9 @@ fi
# parse multilib settings until profiles are sane
load_multilib_env() {
local var=$1
+ # TODO: avoid eval+subshell and use subshell only. It will make error
+ # handling simpler.
+ local eval_result=failed
eval $(
# see what target to parse
CTARGET=${!var}
@@ -1016,7 +1019,9 @@ load_multilib_env() {
echo ${_v}=\'${!d}\'
done
done
+ echo "eval_result='succeeded'"
)
+ [[ $eval_result = succeeded ]] || die "could not load multilib settings for '${var}'"
}
# Load settings for the host.
MULTILIB_ABIS=${HOST_ABI} load_multilib_env HCHOST