cc-wrapper: Use set -u throughout

Now is an opportune time to do this, as the infixSalt conversion in
`add-flags.sh` ensures that all the relevant `NIX_*` vars will be
defined even if empty.
This commit is contained in:
John Ericson
2017-08-07 03:05:51 -04:00
parent a8bd415fa0
commit 2493454e13
6 changed files with 68 additions and 50 deletions
+10 -7
View File
@@ -1,7 +1,10 @@
#! @shell@
set -e -o pipefail
set -eu -o pipefail
shopt -s nullglob
# N.B. Gnat is not used during bootstrapping, so we don't need to
# worry about the old bash empty array `set -u` workarounds.
path_backup="$PATH"
# phase separation makes this look useless
@@ -10,12 +13,12 @@ if [ -n "@coreutils_bin@" ]; then
PATH="@coreutils_bin@/bin"
fi
if [ -n "$NIX_@infixSalt@_GNAT_WRAPPER_START_HOOK" ]; then
source "$NIX_@infixSalt@_GNAT_WRAPPER_START_HOOK"
if [ -z "${NIX_@infixSalt@_GNAT_WRAPPER_FLAGS_SET:-}" ]; then
source @out@/nix-support/add-flags.sh
fi
if [ -z "$NIX_@infixSalt@_GNAT_WRAPPER_FLAGS_SET" ]; then
source @out@/nix-support/add-flags.sh
if [ -n "$NIX_@infixSalt@_GNAT_WRAPPER_START_HOOK" ]; then
source "$NIX_@infixSalt@_GNAT_WRAPPER_START_HOOK"
fi
source @out@/nix-support/utils.sh
@@ -52,7 +55,7 @@ fi
# Optionally filter out paths not refering to the store.
params=("$@")
if [[ "$NIX_ENFORCE_PURITY" = 1 && -n "$NIX_STORE" ]]; then
if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "$NIX_STORE" ]]; then
rest=()
for p in "${params[@]}"; do
if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
@@ -110,7 +113,7 @@ fi
#fi
# Optionally print debug info.
if [ -n "$NIX_DEBUG" ]; then
if [ -n "${NIX_DEBUG:-}" ]; then
echo "extra flags before to @prog@:" >&2
printf " %q\n" "${extraBefore[@]}" >&2
echo "original flags to @prog@:" >&2