summary refs log tree commit diff
path: root/pkgs/build-support/fetchzip/default.nix
diff options
context:
space:
mode:
authorLuke Granger-Brown <git@lukegb.com>2020-12-04 03:28:00 +0000
committerLuke Granger-Brown <git@lukegb.com>2020-12-04 03:28:00 +0000
commit1f6d7500974e62895f8c1c07385ca8bc3fe0502a (patch)
treefed9a92aa9383c87ea56ffa8e9108eb9f75e2b89 /pkgs/build-support/fetchzip/default.nix
parent35a5eb9d2ccbc0d35135fffefe46f0b70d5f2356 (diff)
downloadnixpkgs-1f6d7500974e62895f8c1c07385ca8bc3fe0502a.tar
nixpkgs-1f6d7500974e62895f8c1c07385ca8bc3fe0502a.tar.gz
nixpkgs-1f6d7500974e62895f8c1c07385ca8bc3fe0502a.tar.bz2
nixpkgs-1f6d7500974e62895f8c1c07385ca8bc3fe0502a.tar.lz
nixpkgs-1f6d7500974e62895f8c1c07385ca8bc3fe0502a.tar.xz
nixpkgs-1f6d7500974e62895f8c1c07385ca8bc3fe0502a.tar.zst
nixpkgs-1f6d7500974e62895f8c1c07385ca8bc3fe0502a.zip
fetchzip: get write permission on unpacked directory
This is a workaround for NixOS/nix#4295, which caused single-user Linux
Nix installations using sandboxed builds to start failing to build
fetchzip derivations after 4a5c49363a58e711c2016b9ebb6f642e3c9c1be5.

In short: removing write permissions for the entire directory is great,
except we then can't rename(2) it to the final Nix store path out of the
sandbox, because we don't have write permission on the directory and
thus cannot update the ".." directory entry.
Diffstat (limited to 'pkgs/build-support/fetchzip/default.nix')
-rw-r--r--pkgs/build-support/fetchzip/default.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchzip/default.nix b/pkgs/build-support/fetchzip/default.nix
index 44748f231bc..a1744b48deb 100644
--- a/pkgs/build-support/fetchzip/default.nix
+++ b/pkgs/build-support/fetchzip/default.nix
@@ -48,8 +48,15 @@
     + extraPostFetch
     # Remove write permissions for files unpacked with write bits set
     # Fixes https://github.com/NixOS/nixpkgs/issues/38649
+    #
+    # However, we should (for the moment) retain write permission on the directory
+    # itself, to avoid tickling https://github.com/NixOS/nix/issues/4295 in
+    # single-user Nix installations. This is because in sandbox mode we'll try to
+    # move the path, and if we don't have write permissions on the directory,
+    # then we can't update the ".." entry.
     + ''
       chmod -R a-w "$out"
+      chmod u+w "$out"
     '';
 } // removeAttrs args [ "stripRoot" "extraPostFetch" ])).overrideAttrs (x: {
   # Hackety-hack: we actually need unzip hooks, too