Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mbarbero opened this issue Sep 14, 2020 · 0 comments
Open
Assignees
Labels
P3 type=defect Bug, not working as expected

Comments

@mbarbero
Copy link
Contributor

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)

@kluever kluever added P2 type=defect Bug, not working as expected labels Sep 15, 2020
@netdpb netdpb added P3 and removed P2 labels Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 type=defect Bug, not working as expected
Projects
None yet
Development

No branches or pull requests

4 participants