From 1a9fd7866b789ef99e4f4ac353e4da6bfe740aa3 Mon Sep 17 00:00:00 2001 From: Rhys-T <108157737+Rhys-T@users.noreply.github.com> Date: Sat, 22 Feb 2025 15:15:13 -0500 Subject: [PATCH] noBrokenSymlinks: use umask instead of chmod to make unreadable symlinks The stage2 stdenv uses Coreutils 9.4, which doesn't have `chmod -h` yet. --- pkgs/test/stdenv/no-broken-symlinks.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/test/stdenv/no-broken-symlinks.nix b/pkgs/test/stdenv/no-broken-symlinks.nix index 88777008c5cc..344f8b5afc1d 100644 --- a/pkgs/test/stdenv/no-broken-symlinks.nix +++ b/pkgs/test/stdenv/no-broken-symlinks.nix @@ -23,8 +23,10 @@ let # 'pass', to make sure the tests work properly for both kinds of platform. mkUnreadableSymlink = absolute: failIfUnsupported: '' touch "$out/unreadable-symlink-target" - ln -s${optionalString (!absolute) "r"} "$out/unreadable-symlink-target" "$out/unreadable-symlink" - chmod -h ugo-rwx "$out/unreadable-symlink" + ( + umask 777 + ln -s${optionalString (!absolute) "r"} "$out/unreadable-symlink-target" "$out/unreadable-symlink" + ) if readlink "$out/unreadable-symlink" >/dev/null 2>&1; then nixErrorLog "symlink permissions not supported" ${optionalString failIfUnsupported "exit 1"}