RFR: 8287843: File::getCanonicalFile doesn't work for \?\C:\ style paths DOS device paths [v2]

Brian Burkhalter bpb at openjdk.org
Mon Sep 11 16:27:40 UTC 2023


On Sat, 9 Sep 2023 08:32:44 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> For `\\\?\`, the normalization will drop the trailing slash so the path string is actually `\\\?`. I think that case is okay.

This results in "Bad pathname" with both the master and the change.

> For input such as `\\\?\\foo` and `\\\?\\C:`, the stripping results in a relative path, `foo` and `C:` in these examples, which means the canonicalize code is starting with a relative path. We have to be careful here as the path has always been make absolute before attempting to canonicalize.

These also fail with "Bad pathname" with the master but give the erroneous results `C:\<user.dir>\\foo` and `C:`, respectively, with the patch. This needs to be fixed.

> For `\\\?\\UNC` and `\\\?\\UNC\`, the stripping means these will be treated as `\`, which is the root directory of the current volume. I know these will fail with "The network path was not path" but I can't help thinking it should be rejected/throw early.

These actually fail with "Bad pathname" for both the master and the patch.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15603#issuecomment-1714210254


More information about the core-libs-dev mailing list