On Fri, 17 Oct 2025 22:54:17 GMT, Brian Burkhalter <[email protected]> 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 Thanks for the table of before/after results. I'm still nervous that there will be cases where it will not given the right answer, specifically when there there is a sym link to a UNC. One alternative to try is to use canonicalize0 as before, then test if the sym is a sym link. If the file is a sym link use getFinalPath and return that if it succeeds. That should align it with toRealPath for the case that the file exist and is accessible. It will give identical results to JDK 23 for the common case where the file is not a sym link (or is not accessible). ------------- PR Comment: https://git.openjdk.org/jdk/pull/27324#issuecomment-3432864143
