graal
graal copied to clipboard
[GR-31166] Native Image: NOFOLLOW_LINKS is not supported on this platform
Describe the issue
Using GraalVM graalvm-ce-java8-21.1.0/bin/native-image to build an application which uses the NOFOLLOW_LINKS option fails at runtime with the error "NOFOLLOW_LINKS is not supported on this platform". However the output of find --version
does show O_NOFOLLOW(enabled)
. OS is AmazonLinux 2 x64 kernel 5.4.95-47.164.amzn2int.x86_64
.
Steps to reproduce the issue Please include both build steps as well as run steps
The following example code will trigger the error:
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFileAttributeView;
import java.util.HashSet;
class Scratch {
public static void main(String[] args) throws IOException {
Files.createFile(Paths.get("./file"));
PosixFileAttributeView view = Files.getFileAttributeView(Paths.get("./file"), PosixFileAttributeView.class,
LinkOption.NOFOLLOW_LINKS);
view.readAttributes().permissions();
view.setPermissions(new HashSet<>());
}
}
Describe GraalVM and your environment:
- GraalVM version (latest snapshot builds can be found here), or commit id if built from source: [e.g. EE 19.3, CE 20.0, CE 20.1.0-dev-20200304_0848]: CE 21.1.0
- JDK major version: [e.g.:8]: 8
- OS: [e.g. macOS Catalina]: AmazonLinux 2
- Architecture: [e.g.: AMD64]: AMD64
More details
Consider adding the --native-image-info
and --verbose
flags when building your native image and paste output below.
Add any other information about the problem here. Especially important are stack traces or log output. Feel free to link to gists or to screenshots if necessary.
Caused by: java.io.IOException: NOFOLLOW_LINKS is not supported on this platform
at sun.nio.fs.UnixPath.openForAttributeAccess(UnixPath.java:773)
at sun.nio.fs.UnixFileAttributeViews$Posix.setMode(UnixFileAttributeViews.java:230)
at sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions(UnixFileAttributeViews.java:260)
@MikeDombo thanks for reporting the issue We will look into it and get back to you
@MikeDombo I tried your example on ubuntu using the latest dev builds and it works fine. please try the same https://github.com/graalvm/graalvm-ce-dev-builds/releases/tag/21.2.0-dev-20210504_1952
Same problem.
./graalvm-ce-java8-21.2.0-dev/bin/native-image -cp . Scratch
[scratch:16069] classlist: 6,928.44 ms, 1.32 GB
[scratch:16069] (cap): 474.95 ms, 1.37 GB
[scratch:16069] setup: 2,107.98 ms, 1.81 GB
[scratch:16069] (clinit): 117.93 ms, 1.85 GB
[scratch:16069] (typeflow): 6,014.65 ms, 1.85 GB
[scratch:16069] (objects): 5,897.07 ms, 1.85 GB
[scratch:16069] (features): 168.42 ms, 1.85 GB
[scratch:16069] analysis: 12,366.35 ms, 1.85 GB
[scratch:16069] universe: 306.57 ms, 1.85 GB
[scratch:16069] (parse): 836.60 ms, 1.86 GB
[scratch:16069] (inline): 953.96 ms, 1.90 GB
[scratch:16069] (compile): 4,911.45 ms, 2.00 GB
[scratch:16069] compile: 7,026.55 ms, 2.00 GB
[scratch:16069] image: 789.70 ms, 2.08 GB
[scratch:16069] write: 126.30 ms, 2.08 GB
# Printing build artifacts to:
[scratch:16069] [total]: 29,803.83 ms, 2.08 GB
---
./scratch
Exception in thread "main" java.io.IOException: NOFOLLOW_LINKS is not supported on this platform
at sun.nio.fs.UnixPath.openForAttributeAccess(UnixPath.java:773)
at sun.nio.fs.UnixFileAttributeViews$Posix.setMode(UnixFileAttributeViews.java:230)
at sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions(UnixFileAttributeViews.java:260)
at Scratch.main(Scratch.java:13)
How does Graal determine the O_NOFOLLOW setting?
@MikeDombo it may be an issue of compatibility of GraalVM native-image with Amazon Linux. I will check with the team and let you know
Unless there is a good way for us to reproduce that on one of the Linux systems available to us, we can't really do anything about that. It might be an issue just on AmazonLinux?