Skip to content

setPermissions and setTimes on symlinks don't behave as on Unix/macOS #119

@mbarbero

Description

@mbarbero

The following:

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.

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)

Metadata

Metadata

Assignees

Labels

P3type=defectBug, not working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions