RFR: 8315273: (fs) Path.toRealPath(LinkOption.NOFOLLOW_LINKS) fails when "../../" follows a link (win) [v5]

Brian Burkhalter bpb at openjdk.org
Thu Sep 12 20:43:21 UTC 2024


On Fri, 1 Mar 2024 21:48:22 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Windows implementation of integrated pull request #15397. The test java/nio/file/Path/ToRealPath.java is also removed from the problem list.
>
> Brian Burkhalter has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits:
> 
>  - 8315273: Re-remove ToRealPath test
>  - Merge
>  - 8315273: Revert ProblemList
>  - Merge
>  - Merge
>  - 8315273: Add bug ID to test
>  - 8315273: (fs) Path.toRealPath(LinkOption.NOFOLLOW_LINKS) fails when "../../" follows a link (win)

This does not address your example above with respect to `toRealPath`, but the behavior it shows seems inconsistent. 

The setup is the same:

`/tmp/cwd/dir/subdir` or `C:\tmp\cwd\dir\subdir` where `link` is a symbolic link in `cwd` with the relatve target `dir/subdir`.

Then running jshell in `cwd`, the call

`Files.createFile(Path.of("link/../../file")`

creates `/tmp/cwd/file` on macOS whereas on Windows it creates `C:\tmp\file`.

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

PR Comment: https://git.openjdk.org/jdk/pull/15525#issuecomment-2347200176


More information about the nio-dev mailing list