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

Alan Bateman alanb at openjdk.org
Tue Aug 12 06:45:12 UTC 2025


On Tue, 12 Aug 2025 01:15:35 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.

src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java line 429:

> 427: 
> 428:         // neither exists, compare normalized paths without filesystem access
> 429:         return obj1.normalize().equals(obj2.normalize());

normalize is to deal with user input, I don't think we should be using it here.

(I will try to add review the changes soon but I'm concerned that this will require spec changes).

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

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


More information about the nio-dev mailing list