RFR: 8338884: java/nio/file/attribute/BasicFileAttributeView/CreationTime.java#tmp fails on alinux3
Brian Burkhalter
bpb at openjdk.org
Fri Aug 23 17:05:04 UTC 2024
On Fri, 23 Aug 2024 03:58:37 GMT, SendaoYan <syan at openjdk.org> wrote:
> Hi all,
> On alinux3(alibaba cloud linux version 3) system, the `/tmp` disk partition is mounted as tmpfs filesystem type, this filesystem type doesn't support create time(birth time).
>
> Before this PR, this test [check](https://github.com/openjdk/jdk/blob/master/test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java#L110) if there is `statx` system call present or not to determise the test environment support birth time or not. I think it's not enough when the tested filesystem type is `tmpfs`. When the tested filesystem type is `tmpfs`, then the tested file doesn't support birth time.
>
> Test fix only, the change has been verified, no risk.
test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java line 112:
> 110: supportsCreationTimeRead = Linker.nativeLinker().defaultLookup().find("statx").isPresent();
> 111: // Linux system doesn't support birth time on tmpfs filesystem for now
> 112: if( Files.getFileStore(file).type().contentEquals("tmpfs") ) {
`if( ` should be `if (` but I would suggest instead:
// Creation time read depends on statx system call support and on the file
// system storing the birth time. The tmpfs file system type does not store
// the birth time.
boolean statxIsPresent = Linker.nativeLinker().defaultLookup().find("statx").isPresent();
if (statxIsPresent && !Files.getFileStore(file).type().contentEquals("tmpfs")) {
supportsCreationTimeRead = true;
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20687#discussion_r1729269938
More information about the nio-dev
mailing list