about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2021-02-09 01:33:33 +0100
committerMartin Weinelt <hexa@darmstadt.ccc.de>2021-02-09 01:33:33 +0100
commitdf21fb8afa235a71b4e814f1ed1c4003ce34b220 (patch)
treebcb81cc4816c41ae01510124c34b4c3c3267fcf9 /pkgs/build-support
parent1848e071c98814742bdea07976d511e0866e0f86 (diff)
downloadnixlib-df21fb8afa235a71b4e814f1ed1c4003ce34b220.tar
nixlib-df21fb8afa235a71b4e814f1ed1c4003ce34b220.tar.gz
nixlib-df21fb8afa235a71b4e814f1ed1c4003ce34b220.tar.bz2
nixlib-df21fb8afa235a71b4e814f1ed1c4003ce34b220.tar.lz
nixlib-df21fb8afa235a71b4e814f1ed1c4003ce34b220.tar.xz
nixlib-df21fb8afa235a71b4e814f1ed1c4003ce34b220.tar.zst
nixlib-df21fb8afa235a71b4e814f1ed1c4003ce34b220.zip
Revert "stdenv/patchShebangs: avoid temporary time reference file"
This reverts commit 6e3f4c90790f112f6b6da54b9f1eb0e85310ee64.

This apparently breaks the x86_64 darwin stdenv. Details in #112417.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/setup-hooks/patch-shebangs.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh
index d0efe039ced8..bd254be24f96 100644
--- a/pkgs/build-support/setup-hooks/patch-shebangs.sh
+++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh
@@ -88,15 +88,17 @@ patchShebangs() {
         newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}}
 
         if [[ -n "$oldPath" && "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]]; then
-            if [[ -n "$newPath" && "$newPath" != "$oldPath" ]]; then
+            if [[ -n "$newPath" ]] && [[ "$newPath" != "$oldPath" ]]; then
                 echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""
                 # escape the escape chars so that sed doesn't interpret them
                 escapedInterpreterLine=${newInterpreterLine//\\/\\\\}
 
                 # Preserve times, see: https://github.com/NixOS/nixpkgs/pull/33281
-                timestamp=$(stat --printf "%y" "$f")
+                timestamp=$(mktemp)
+                touch -r "$f" "$timestamp"
                 sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
-                touch --date "$timestamp" "$f"
+                touch -r "$timestamp" "$f"
+                rm "$timestamp"
             fi
         fi
     done < <(find "$@" -type f -perm -0100 -print0)