noBrokenSymlinks: use umask instead of chmod to make unreadable symlinks

The stage2 stdenv uses Coreutils 9.4, which doesn't have `chmod -h` yet.
This commit is contained in:
Rhys-T
2025-03-05 15:46:37 -05:00
parent 693c7b3dad
commit 1a9fd7866b
+4 -2
View File
@@ -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"}