diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2015-01-11 20:07:38 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2015-01-13 10:53:57 +0100 |
commit | 2533a1124192c9da20087514986c3d37cc106c15 (patch) | |
tree | 023a9041f50a4fb94c49fab594a29a80e088a7bd /pkgs/stdenv | |
parent | 9b7b2ce8eb855b99598183b06bbd2f021e01d359 (diff) | |
download | nixlib-2533a1124192c9da20087514986c3d37cc106c15.tar nixlib-2533a1124192c9da20087514986c3d37cc106c15.tar.gz nixlib-2533a1124192c9da20087514986c3d37cc106c15.tar.bz2 nixlib-2533a1124192c9da20087514986c3d37cc106c15.tar.lz nixlib-2533a1124192c9da20087514986c3d37cc106c15.tar.xz nixlib-2533a1124192c9da20087514986c3d37cc106c15.tar.zst nixlib-2533a1124192c9da20087514986c3d37cc106c15.zip |
stdenv substitute: avoid using a temporary file
- IMO using a temporary is not needed here (anymore), - temporary at that location can cause a problem (in a specific case): for example, when using the substituteAll function from nixpkgs on a single file directly under /nix/store/ (or ./foo-file), the stdenv's substitute tries to create a temporary directly under /nix/store, which causes problems on chrooted darwin (according to @copumpkin earlier today on IRC)
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 1cc60ebf02bc..d72fddf439eb 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -370,9 +370,8 @@ substitute() { content="${content//"$pattern"/$replacement}" done - printf "%s" "$content" > "$output".tmp - if [ -x "$output" ]; then chmod +x "$output".tmp; fi - mv -f "$output".tmp "$output" + chmod -f +w "$output" || true + printf "%s" "$content" > "$output" } |