RFR: 8368165: (fs) Path.toRealPath does not perform correctly for symbolic links in a mapped drive (win) [v3]
Brian Burkhalter
bpb at openjdk.org
Tue Jan 20 23:24:38 UTC 2026
On Wed, 14 Jan 2026 22:27:04 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> If `getFinalPath` throws an exception, or converts a drive path to a UNC path, then fall back to the slow path which uses `resolveAllLinks`.
>
> Brian Burkhalter has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>
> - Merge
> - 8368165: Improve fallback mechanism when a link cannot be opened for attribute access
> - 8368165: (fs) Path.toRealPath does not perform correctly for symbolic links in a mapped drive (win)
src/java.base/windows/classes/sun/nio/fs/WindowsLinkSupport.java line 273:
> 271: handle = input.openForReadAttributeAccess(false);
> 272: CloseHandle(handle);
> 273: handle = INVALID_HANDLE_VALUE;
Lines 272-273 look suspicious. Even if `openForReadAttributeAccess` succeeds at line 271, then `handle` will still be `INVALID_HANDLE_VALUE` and the conditional check in the `if`-block at line 288 will be `false` so `GetFinalPathNameByHandle` will not be called. This logic needs to be reevaluated and retested for the various cases.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28032#discussion_r2710409869
More information about the nio-dev
mailing list