From b6252a0b6cd229fa315cecd06478d8bf0476ac1c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 2 Jan 2018 23:18:20 -0500 Subject: lib/common.sh: Adjust to work properly with `set -u` Support for working with `set -u` was broken by 94160d6. Egg on my face; I'm the one who wants `set -u` support, and I'm the author of that commit! libmakepkg does not work with `set -u`; but mostly because of the include guards! So we just need to temporarily disable `set -u` (nounset) while loading libmakepkg. Instead of introducing a new variable, just store the initial nounset status in _INCLUDE_COMMON_SH; rather than a useless fixed-string "true". While we're at it, disable POSIX-mode (just in case we're running as "sh" instead of "bash"), since libmakepkg uses bash-isms that won't parse in POSIX mode. --- lib/common.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/common.sh b/lib/common.sh index a0796bb..d3f4f7c 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -7,10 +7,12 @@ # License: Unspecified [[ -z ${_INCLUDE_COMMON_SH:-} ]] || return 0 -_INCLUDE_COMMON_SH=true +_INCLUDE_COMMON_SH="$(set +o|grep nounset)" +set +u +o posix # shellcheck disable=1091 . /usr/share/makepkg/util.sh +$_INCLUDE_COMMON_SH [[ -n ${TEXTDOMAIN:-} ]] || export TEXTDOMAIN='libretools' [[ -n ${TEXTDOMAINDIR:-} ]] || export TEXTDOMAINDIR='/usr/share/locale' -- cgit v1.2.3-70-g09d2