Quote variable references (#144838)
* pkgs/build-support: Quote variable name * pkgs/build-support: Quote variable reference * pkgs/build-support: Quote variable references Leads to a minor behavior change: there's no trailing space in the output when `[[ "$linkType" == "static-pie" ]]` is true.
This commit is contained in:
parent
1f4911e267
commit
3ce3e50053
1 changed files with 7 additions and 7 deletions
|
@ -21,13 +21,13 @@ mangleVarListGeneric() {
|
|||
local -a role_suffixes=("$@")
|
||||
|
||||
local outputVar="${var}_@suffixSalt@"
|
||||
declare -gx ${outputVar}+=''
|
||||
declare -gx "$outputVar"+=''
|
||||
# For each role we serve, we accumulate the input parameters into our own
|
||||
# cc-wrapper-derivation-specific environment variables.
|
||||
for suffix in "${role_suffixes[@]}"; do
|
||||
local inputVar="${var}${suffix}"
|
||||
if [ -v "$inputVar" ]; then
|
||||
export ${outputVar}+="${!outputVar:+$sep}${!inputVar}"
|
||||
export "${outputVar}+=${!outputVar:+$sep}${!inputVar}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ mangleVarBool() {
|
|||
local -a role_suffixes=("$@")
|
||||
|
||||
local outputVar="${var}_@suffixSalt@"
|
||||
declare -gxi ${outputVar}+=0
|
||||
declare -gxi "${outputVar}+=0"
|
||||
for suffix in "${role_suffixes[@]}"; do
|
||||
local inputVar="${var}${suffix}"
|
||||
if [ -v "$inputVar" ]; then
|
||||
|
@ -146,7 +146,7 @@ checkLinkType() {
|
|||
# When building static-pie executables we cannot have rpath
|
||||
# set. At least glibc requires rpath to be empty
|
||||
filterRpathFlags() {
|
||||
local linkType=$1 ret="" i
|
||||
local linkType=$1 ret i
|
||||
shift
|
||||
|
||||
if [[ "$linkType" == "static-pie" ]]; then
|
||||
|
@ -156,11 +156,11 @@ filterRpathFlags() {
|
|||
# also skip its argument
|
||||
shift
|
||||
else
|
||||
ret+="$i "
|
||||
ret+=("$i")
|
||||
fi
|
||||
done
|
||||
else
|
||||
ret=$@
|
||||
ret=("$@")
|
||||
fi
|
||||
echo $ret
|
||||
echo "${ret[@]}"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue