Revert "stdenv/patchShebangs: avoid temporary time reference file"

This reverts commit 6e3f4c90790f112f6b6da54b9f1eb0e85310ee64.

This apparently breaks the x86_64 darwin stdenv. Details in #112417.

+5 -3
+5 -3
pkgs/build-support/setup-hooks/patch-shebangs.sh
··· 88 88 newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}} 89 89 90 90 if [[ -n "$oldPath" && "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]]; then 91 - if [[ -n "$newPath" && "$newPath" != "$oldPath" ]]; then 91 + if [[ -n "$newPath" ]] && [[ "$newPath" != "$oldPath" ]]; then 92 92 echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\"" 93 93 # escape the escape chars so that sed doesn't interpret them 94 94 escapedInterpreterLine=${newInterpreterLine//\\/\\\\} 95 95 96 96 # Preserve times, see: https://github.com/NixOS/nixpkgs/pull/33281 97 - timestamp=$(stat --printf "%y" "$f") 97 + timestamp=$(mktemp) 98 + touch -r "$f" "$timestamp" 98 99 sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f" 99 - touch --date "$timestamp" "$f" 100 + touch -r "$timestamp" "$f" 101 + rm "$timestamp" 100 102 fi 101 103 fi 102 104 done < <(find "$@" -type f -perm -0100 -print0)