RFR: 8154364: Files.isSameFile() throws NoSuchFileException with broken symbolic links [v2]

Brian Burkhalter bpb at openjdk.org
Thu Aug 14 15:21:13 UTC 2025


On Thu, 14 Aug 2025 15:03:48 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java line 394:
>> 
>>> 392:         // check existence while following linkx
>>> 393:         boolean exists1 = exists(file1);
>>> 394:         boolean exists2 = exists(file2);
>> 
>> Did you try to using UnixFileAttribtues.getIfExists? That would remove the need for access(2) from the common case. We can add getIfExists(UnixPath path, boolean followLinks) if needed.
>
> No, but I'll investigate.

> Did you try to using UnixFileAttribtues.getIfExists?

I think you're correct that this would speed up the common case a bit, but as implied, it would require adding `getIfExists` which does not follow links.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26736#discussion_r2276941825


More information about the nio-dev mailing list