setPermissions and setTimes on symlinks don't behave as on Unix/macOS
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 296
- Avg merge
- 9m
- Merged PRs (30d)
- 7
Description
The following:
```java
BasicFileAttributeView attributes = Files.getFileAttributeView(symlink, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
if (attributes != null) {
attributes.setTimes(fileTime, null, null);
}
```
only works in openjdk since JDK11 https://bugs.openjdk.java.net/browse/JDK-8220793, so it may be worth adding a special behavior to fail when running on earlier versions.
```java
PosixFileAttributeView attributes = Files.getFileAttributeView(symlink, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
if (attributes != null) {
attributes.setPermissions(modes);
}
```
should fail when the link is dangling (as it should only operates on the target of the link on Unix - it's possible on macOS, but there is no such support in `java.nio`)
Contributor guide
Assessment
This issue has not been assessed yet.