RFR: 8343417: (fs) BasicFileAttributeView.setTimes uses microsecond precision with NOFOLLOW_LINKS [v2]

Alan Bateman alanb at openjdk.org
Tue Nov 5 18:41:32 UTC 2024


On Tue, 5 Nov 2024 17:58:10 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Add support for setting the last access and last modification times of symbolic links with nanosecond precision on Linux where the system call `utimensat(2)` is available.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8343417: Make Java method utimensat() signature match that of the corresponding system call

src/java.base/unix/classes/sun/nio/fs/UnixFileAttributeViews.java line 88:

> 86:                         useLutimes = lutimesSupported();
> 87:                 }
> 88:                 if (!useUtimensat && !useLutimes) {

Changing the utimesat method to match the sys call is good. Now I wonder if we go further and use fd from openForAttribtueAccess(false) with utimesat. That would remove the window between the lstat and  utimesat(AT_FDCWD...) where the file may be replaced.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21886#discussion_r1829838511


More information about the nio-dev mailing list