RFR: 8368633: (fs) Path.toRealPath(NOFOLLOW_LINKS) very slow on macOS
Alan Bateman
alanb at openjdk.org
Thu Oct 9 15:50:04 UTC 2025
On Thu, 9 Oct 2025 15:26:05 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> src/java.base/unix/classes/sun/nio/fs/UnixPath.java line 965:
>>
>>> 963: path = path.resolve(entry);
>>> 964: break;
>>> 965: } else if (name.toString().equalsIgnoreCase(elementName)) {
>>
>> The compareTo at L961 looks right but the using toString is problematic here as it may be lossy. If the name and element are not equal then I think it has to use file key.
>
>> If the name and element are not equal then I think it has to use file key.
>
> Do you intend that file key alone should be used here and drop toString? Is it possible that equalsIgnoreCase returns false when the file keys are equal?
I think the compareTo == 0 to see byte representation is equal is good, that will avoid the stat to get the fileKey. The concern with the String/equalsIgnoreCase is that there may be false positives.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27709#discussion_r2417211249
More information about the nio-dev
mailing list