···1616 hardeningDisableMap[$flag]=1
1717done
18181919-if [[ -n "${NIX_DEBUG:-}" ]]; then
1919+if (( "${NIX_DEBUG:-0}" >= 1 )); then
2020 printf 'HARDENING: disabled flags:' >&2
2121 (( "${#hardeningDisableMap[@]}" )) && printf ' %q' "${!hardeningDisableMap[@]}" >&2
2222 echo >&2
2323fi
24242525if [[ -z "${hardeningDisableMap[all]:-}" ]]; then
2626- if [[ -n "${NIX_DEBUG:-}" ]]; then
2626+ if (( "${NIX_DEBUG:-0}" >= 1 )); then
2727 echo 'HARDENING: Is active (not completely disabled with "all" flag)' >&2;
2828 fi
2929 for flag in "${hardeningFlags[@]}"
···3131 if [[ -z "${hardeningDisableMap[$flag]:-}" ]]; then
3232 case $flag in
3333 fortify)
3434- if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling fortify >&2; fi
3434+ if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling fortify >&2; fi
3535 hardeningCFlags+=('-O2' '-D_FORTIFY_SOURCE=2')
3636 ;;
3737 stackprotector)
3838- if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling stackprotector >&2; fi
3838+ if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling stackprotector >&2; fi
3939 hardeningCFlags+=('-fstack-protector-strong' '--param' 'ssp-buffer-size=4')
4040 ;;
4141 pie)
4242- if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling CFlags -fPIE >&2; fi
4242+ if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling CFlags -fPIE >&2; fi
4343 hardeningCFlags+=('-fPIE')
4444 if [[ ! ("$*" =~ " -shared " || "$*" =~ " -static ") ]]; then
4545- if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling LDFlags -pie >&2; fi
4545+ if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling LDFlags -pie >&2; fi
4646 hardeningCFlags+=('-pie')
4747 hardeningLDFlags+=('-pie')
4848 fi
4949 ;;
5050 pic)
5151- if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling pic >&2; fi
5151+ if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling pic >&2; fi
5252 hardeningCFlags+=('-fPIC')
5353 ;;
5454 strictoverflow)
5555- if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling strictoverflow >&2; fi
5555+ if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling strictoverflow >&2; fi
5656 hardeningCFlags+=('-fno-strict-overflow')
5757 ;;
5858 format)
5959- if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling format >&2; fi
5959+ if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling format >&2; fi
6060 hardeningCFlags+=('-Wformat' '-Wformat-security' '-Werror=format-security')
6161 ;;
6262 relro)
6363- if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling relro >&2; fi
6363+ if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling relro >&2; fi
6464 hardeningLDFlags+=('-z' 'relro')
6565 ;;
6666 bindnow)
6767- if [[ -n "${NIX_DEBUG:-}" ]]; then echo HARDENING: enabling bindnow >&2; fi
6767+ if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling bindnow >&2; fi
6868 hardeningLDFlags+=('-z' 'now')
6969 ;;
7070 *)
+1-1
pkgs/build-support/cc-wrapper/cc-wrapper.sh
···161161fi
162162163163# Optionally print debug info.
164164-if [ -n "${NIX_DEBUG:-}" ]; then
164164+if (( "${NIX_DEBUG:-0}" >= 1 )); then
165165 # Old bash workaround, see ld-wrapper for explanation.
166166 echo "extra flags before to @prog@:" >&2
167167 printf " %q\n" ${extraBefore+"${extraBefore[@]}"} >&2
+1-1
pkgs/build-support/cc-wrapper/gnat-wrapper.sh
···109109#fi
110110111111# Optionally print debug info.
112112-if [ -n "${NIX_DEBUG:-}" ]; then
112112+if (( "${NIX_DEBUG:-0}" >= 1 )); then
113113 echo "extra flags before to @prog@:" >&2
114114 printf " %q\n" "${extraBefore[@]}" >&2
115115 echo "original flags to @prog@:" >&2
+1-1
pkgs/build-support/cc-wrapper/gnatlink-wrapper.sh
···2424#export NIX_@infixSalt@_LDFLAGS_SET=1
25252626# Optionally print debug info.
2727-if [ -n "${NIX_DEBUG:-}" ]; then
2727+if (( "${NIX_DEBUG:-0}" >= 1 )); then
2828 echo "extra flags before to @prog@:" >&2
2929 printf " %q\n" "${extraBefore[@]}" >&2
3030 echo "original flags to @prog@:" >&2
+1-1
pkgs/build-support/cc-wrapper/ld-wrapper.sh
···156156157157158158# Optionally print debug info.
159159-if [ -n "${NIX_DEBUG:-}" ]; then
159159+if (( "${NIX_DEBUG:-0}" >= 1 )); then
160160 # Old bash workaround, see above.
161161 echo "extra flags before to @prog@:" >&2
162162 printf " %q\n" ${extraBefore+"${extraBefore[@]}"} >&2
+1-1
pkgs/build-support/cc-wrapper/utils.sh
···11skip () {
22- if [ -n "${NIX_DEBUG:-}" ]; then
22+ if (( "${NIX_DEBUG:-0}" >= 1 )); then
33 echo "skipping impure path $1" >&2
44 fi
55}
+3-3
pkgs/stdenv/generic/setup.sh
···269269 addToSearchPath PATH "$i/bin"
270270done
271271272272-if [ "${NIX_DEBUG:-}" = 1 ]; then
272272+if (( "${NIX_DEBUG:-0}" >= 1 )); then
273273 echo "initial path: $PATH"
274274fi
275275···429429430430431431PATH="${_PATH-}${_PATH:+${PATH:+:}}$PATH"
432432-if [ "${NIX_DEBUG:-}" = 1 ]; then
432432+if (( "${NIX_DEBUG:-0}" >= 1 )); then
433433 echo "final path: $PATH"
434434fi
435435···539539 local -a args=()
540540541541 for varName in $(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }'); do
542542- if [ "${NIX_DEBUG:-}" = "1" ]; then
542542+ if (( "${NIX_DEBUG:-0}" >= 1 )); then
543543 printf "@%s@ -> %q\n" "${varName}" "${!varName}"
544544 fi
545545 args+=("--subst-var" "$varName")