From 4b1b6ee6d1a12501e9383748fa07423a0dc1718f Mon Sep 17 00:00:00 2001 From: Yegor Timoshenko Date: Mon, 1 Jan 2018 17:05:46 +0000 Subject: patchShebangs: preserve times, resolves #33084 Close #33281. Edits by vcunat: - use Eelco's idea: empty file instead of full copy - use longer name suffix to decrease the likelihood of collision --- pkgs/build-support/setup-hooks/patch-shebangs.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkgs/build-support/setup-hooks/patch-shebangs.sh') diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh index 4317a5f4dade..1433d1e1f144 100644 --- a/pkgs/build-support/setup-hooks/patch-shebangs.sh +++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh @@ -54,7 +54,11 @@ patchShebangs() { echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\"" # escape the escape chars so that sed doesn't interpret them escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g') + # Preserve times, see: https://github.com/NixOS/nixpkgs/pull/33281 + touch -r "$f" "$f.timestamp" sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f" + touch -r "$f.timestamp" "$f" + rm "$f.timestamp" fi fi done -- cgit 1.4.1