Skip to content
Snippets Groups Projects
Commit aee72cae authored by Luke Shumaker's avatar Luke Shumaker Committed by Bartłomiej Piotrowski
Browse files

lib/common.sh: Adjust to work properly with `set -u`

Support for working with `set -u` was broken by 94160d62.  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.
parent 5ab8f843
No related branches found
No related tags found
No related merge requests found
...@@ -4,10 +4,12 @@ ...@@ -4,10 +4,12 @@
# License: Unspecified # License: Unspecified
[[ -z ${_INCLUDE_COMMON_SH:-} ]] || return 0 [[ -z ${_INCLUDE_COMMON_SH:-} ]] || return 0
_INCLUDE_COMMON_SH=true _INCLUDE_COMMON_SH="$(set +o|grep nounset)"
set +u +o posix
# shellcheck disable=1091 # shellcheck disable=1091
. /usr/share/makepkg/util.sh . /usr/share/makepkg/util.sh
$_INCLUDE_COMMON_SH
# Avoid any encoding problems # Avoid any encoding problems
export LANG=C export LANG=C
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment