On Linux, permissions of symlinks do not matter in most cases. However some BSD variants such as MacOS require reading permissions on symlinks to have some tools working, like readlink. On those systems it is possible to change the permission of a symbolic link with chmod -h
.
Rusts internal std::sys::unix::fs::set_perm
uses libc::chmod
which will always dereference symlink paths.
To change permissions of a link, it would probably require Rust to determine the file descriptor and use libc::fchmod
instead, I'm not sure about this.