-
Enhancement
-
Resolution: Fixed
-
P3
-
openjdk8u402, 11.0.20, 17.0.8, 21, 22
-
b20
-
generic
-
linux
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8319533 | 21.0.2 | Severin Gehwolf | P3 | Resolved | Fixed | b06 |
JDK-8324842 | 17.0.11 | Severin Gehwolf | P3 | Resolved | Fixed | b01 |
This code:
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
public class LastModified {
public static void main(String[] args) throws Exception {
var attrs = Files.readAttributes(Path.of(args[0]), BasicFileAttributes.class);
System.out.printf(
"created: %s\nmodified: %s\n%n",
attrs.creationTime(),
attrs.lastModifiedTime()
);
}
}
... shows the last modified time as the creation time on Linux. Example sequence:
$ echo testme > testing.txt
$ touch -m -t 200001010101 testing.txt
$ java LastModified testing.txt
created: 2000-01-01T00:01:00Z
modified: 2000-01-01T00:01:00Z
$ stat testing.txt | grep Birth
Birth: 2023-09-14 17:43:04.893739324 +0200
The expected output of the above program would be something resembling the "Birth:" time as shown by the native 'stat' tool (which internally uses 'statx').
- backported by
-
JDK-8319533 (fs) Add support for BasicFileAttributes.creationTime() for Linux
- Resolved
-
JDK-8324842 (fs) Add support for BasicFileAttributes.creationTime() for Linux
- Resolved
- relates to
-
JDK-8319922 libCreationTimeHelper.so fails to link in JDK 21
- Resolved
-
JDK-8338696 (fs) BasicFileAttributes.creationTime() falls back to epoch if birth time is unavailable (Linux)
- Resolved
-
JDK-8337966 (fs) Files.readAttributes fails with Operation not permitted on older docker releases
- Resolved
-
JDK-8338879 Revert the fix for 8316304
- Resolved
-
JDK-8331533 (fs) BasicFileAttributes is unable to return a file creation time
- Closed
-
JDK-8334339 Test java/nio/file/attribute/BasicFileAttributeView/CreationTime.java fails on alinux3
- Closed
-
JDK-8338884 java/nio/file/attribute/BasicFileAttributeView/CreationTime.java#tmp fails on alinux3
- Closed
-
JDK-8337275 Files.setTimes and creationTime APIs inconsistent
- Closed
-
JDK-8338767 (fs) BasicFileAttributes.creationTime() falls back to epoch if birth time is unavailable (Linux)
- Closed
- links to
-
Commit openjdk/jdk17u-dev/184fac8a
-
Commit openjdk/jdk21u/4cf572e3
-
Commit openjdk/jdk/0275efac
-
Review openjdk/jdk17u-dev/2175
-
Review openjdk/jdk21u/282
-
Review openjdk/jdk/15792