RFR: 8062795: (fs) Files.setPermissions requires read access when NOFOLLOW_LINKS specified [v3]

Alan Bateman alanb at openjdk.org
Wed Aug 16 08:19:11 UTC 2023


On Tue, 15 Aug 2023 15:02:32 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> If setting POSIX permissions while not following links fails with `AccessDeniedException` but the path does not contain any symbolic links, then retry the operation as if the `NOFOLLOW_LINKS` option had not been specified.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8062795: Open the path with write access instead of checking for links

Marked as reviewed by alanb (Reviewer).

src/java.base/unix/classes/sun/nio/fs/UnixFileAttributeViews.java line 284:

> 282:                 fd = open(file, O_RDONLY, O_NOFOLLOW);
> 283:             } catch (UnixException e1) {
> 284:                 if (e1.errno() == EACCES) {

Maybe we should add a comment like "// retry with write access in case there is no read permission" ?

-------------

PR Review: https://git.openjdk.org/jdk/pull/15214#pullrequestreview-1580054966
PR Review Comment: https://git.openjdk.org/jdk/pull/15214#discussion_r1295543996


More information about the nio-dev mailing list