Skip to content

Symlink permissions aren't canonicalised on BSDs and Darwin #16348

Description

@xokdvium

Describe the bug

Steps To Reproduce

Unlike Linux, where symlinks get 0777 permission bits regardless and can't be changed, apparently macos and some other BSDs do carry permission bits around (it's not clear to me whether they do anything useful though).

   -h         If the file is a symbolic link, change the mode of the link
              itself rather than the file that the link points to.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html

AT_SYMLINK_NOFOLLOW
If path names a symbolic link, then the mode of the symbolic link is changed.

[EOPNOTSUPP]
The AT_SYMLINK_NOFOLLOW bit is set in the flag argument, path names a symbolic link, and the system does not support changing the mode of a symbolic link.

I'd presume that macOS does support AT_SYMLINK_NOFOLLOW in that context, unlike Linux.

I've confirmed this by looking into my store on a macOS machine and yes there are 755 symlinks in there.

Expected behavior

Symlink permissions are canonicalised too. Currently newly created files are restricted by the umask.

Metadata

Additional context

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions