diff options
author | Yegor Timoshenko <yegortimoshenko@gmail.com> | 2018-01-01 17:05:46 +0000 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2018-01-21 12:09:07 +0100 |
commit | 4b1b6ee6d1a12501e9383748fa07423a0dc1718f (patch) | |
tree | b8528da26fffc8cc1b6ded120d04acfea79e8e05 /pkgs/build-support/setup-hooks/patch-shebangs.sh | |
parent | ba6e0ae33df36306b065c7876d42ec483edac7cd (diff) | |
download | nixlib-4b1b6ee6d1a12501e9383748fa07423a0dc1718f.tar nixlib-4b1b6ee6d1a12501e9383748fa07423a0dc1718f.tar.gz nixlib-4b1b6ee6d1a12501e9383748fa07423a0dc1718f.tar.bz2 nixlib-4b1b6ee6d1a12501e9383748fa07423a0dc1718f.tar.lz nixlib-4b1b6ee6d1a12501e9383748fa07423a0dc1718f.tar.xz nixlib-4b1b6ee6d1a12501e9383748fa07423a0dc1718f.tar.zst nixlib-4b1b6ee6d1a12501e9383748fa07423a0dc1718f.zip |
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
Diffstat (limited to 'pkgs/build-support/setup-hooks/patch-shebangs.sh')
-rw-r--r-- | pkgs/build-support/setup-hooks/patch-shebangs.sh | 4 |
1 files changed, 4 insertions, 0 deletions
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 |