RFR: 8355342: File.getCanonicalPath on Java 24 resolves paths on network drives to UNC format [v6]
Alan Bateman
alanb at openjdk.org
Tue Oct 21 13:46:13 UTC 2025
On Fri, 17 Oct 2025 22:54:17 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> `File.getCanonicalPath` invokes `GetFinalPathNameByHandle` on the result of `canonicalize0` which causes the drive letter of a mapped drive to be converted to a UNC prefix. If such a substitution is detected, this request proposes to revert the conversion of drive letter to UNC prefix before returning the canonical path.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8355342: Do not check for backslash as third character of input pathname string
> In the following, the `getCanonicalPath` output is with commit [68af87c](https://github.com/openjdk/jdk/commit/68af87c7dfe720dbe488b7407036a1536bd24031), and the `toRealPath` output is with no changes versus mainline.
Can you do the same for without the patch? Also I think keep links out of the examples for now as we need to establish a baseline for the common cases where the file exists or does not exist (toRealPath should fail for all cases where the file does not exist). I suspect the mental model is "hard links" where the real path is not unique.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27324#issuecomment-3426751086
More information about the core-libs-dev
mailing list