RFR: 8154364: Files.isSameFile() throws NoSuchFileException with broken symbolic links [v2]
Brian Burkhalter
bpb at openjdk.org
Thu Aug 14 16:44:10 UTC 2025
On Thu, 14 Aug 2025 16:17:59 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>>> 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.
>
> For some reason TBD, `UnixFileAttributes.get` succeeds with a symlink loop but `UnixFileAttributes.getIfExists` fails with `ELOOP`.
The `ELOOP` apparently is from the `stat` syscall and does not occur in the current version because `access` is called before `stat` and does not fail in that way. So I am not sure that `getIfExists` is the way to go here unless we want to punt the link loop cases.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26736#discussion_r2277142337
More information about the nio-dev
mailing list