RFR: 8306882: (fs) Path.toRealPath(LinkOption.NOFOLLOW_LINKS) fails when "../../" follows a link

Brian Burkhalter bpb at openjdk.org
Wed Aug 23 01:30:18 UTC 2023


On Wed, 23 Aug 2023 01:09:16 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Modify `Path.toRealPath` such that it does not collapse links such as "link/.." or "link/../.." when `LinkOption.NOFOLLOW_LINKS` is specified or, in some cases, not.

On Windows, the function `GetFullPathName()` does not access the file system and so is susceptible to collapsing links resulting in a path to a non-existent file. The path is examined to see whether it is one for which `GetFullPathName` would generate an incorrect result. If that is **not** the case, then `GetFullPathName` is used as before and there is no effective change.  So this modification should affect only cases which would otherwise generate an incorrect result or fail.

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

PR Comment: https://git.openjdk.org/jdk/pull/15397#issuecomment-1689119683


More information about the nio-dev mailing list