android / android/ndk

[BUG] fchmodat with AT_SYMLINK_NOFOLLOW is very inconsistent

Open
#1,258 1 comment 0 reactions 1 assignee Claimed by @rprichard View on GitHub
bug
Dominant language
No language data
Stars
2.3k
Forks
310
PR merge metrics
No merged PRs in 30d

Description

I'm seeing three different behaviors from `fchmodat` on a symlink when using `AT_SYMLINK_NOFOLLOW`:

1. The flag is completely ignored because the kernel doesn't implement it; the mode of the referent is changed (this was fixed in early 2015, so this is the case prior to API 23 devices).
2. Symlink permissions are not supported and `ENOSUP` is set
3. Symlink permissions are supported and the symlink mode is set appropriately

Both 2 and 3 provide a conformant implementation of `std::filesystem::permissions(symlink_path, p perms, std::filesystem::perm_options::nofollow)`, but 1 does not. The permissions of the symlink need to either be set or an error needs to be returned.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.