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

Alan Bateman alanb at openjdk.org
Thu Aug 14 06:45:11 UTC 2025


On Wed, 13 Aug 2025 16:56:52 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> This request proposes to broaden the definition of which paths are considered to be the same by `java.nio.file.Files.isSameFile()`. A new test is added to cover many comparisons.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8154364: Remove assertion that two non-existent files with equal normalized paths are equal

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.

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

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


More information about the nio-dev mailing list