From eee562ffb5a570ab7eea88f4620d442e248c96be Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Sun, 20 Dec 2020 12:55:44 +0100 Subject: bintools-wrapper: fix inverted link32 check The new skip for the dynamic linker introduced in ccfd26ef14ea ("bintools-wrapper: skip dynamic linker for static binaries") includes a change in behaviour, previously the $link32 variable was checked using an arithmetic expression via (( )). This returns zero if the output of the arithmetic expression is nonzero, i.e. link32=1 would return zero and the if condition would be executed. The code refactored this to use "$link32" = "0" which is incorrect in this case, since we want this if conditional to run if $link32 is 1. Small shell excerpt for clarity: $ export link32=1 $ export cookie=1 $ if [[ "$cookie" = "1" ]] && (( "$link32" )); then echo "do some stuff"; fi; do some stuff $ if [[ "$cookie" = "1" && "$link32" = "0" ]]; then echo "do some stuff"; fi; $ Change it to check for $link32 = "1", as the previous code did. --- pkgs/build-support/bintools-wrapper/ld-wrapper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/build-support/bintools-wrapper/ld-wrapper.sh') diff --git a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh index abecf6a8e5d1e..bdffdc3b7855c 100644 --- a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh @@ -145,7 +145,7 @@ then done fi -if [[ "$link32" = "0" && "$setDynamicLinker" = 1 && -e "@out@/nix-support/dynamic-linker-m32" ]]; then +if [[ "$link32" = "1" && "$setDynamicLinker" = 1 && -e "@out@/nix-support/dynamic-linker-m32" ]]; then # We have an alternate 32-bit linker and we're producing a 32-bit ELF, let's # use it. extraAfter+=( -- cgit 1.4.1