For the file configuration
/working/directory/dir/subdir is a directory
/working/directory/aaa is a link to /working/directory/dir/subdir
/working/directory/out.txt is a file
then on Unix
Path.of("aaa/../../out.txt").toRealPath()
returns /working/directory/out.txt but on Windows
Path.of("aaa\\..\\..\\out.txt").toRealPath()
throws
| Exception java.nio.file.NoSuchFileException: C:\working\out.txt
when it should have returned C:\working\directory\out.txt. This situation appears to occur when a link in the path is followed by "../..". The Windows result appears incorrect.
/working/directory/dir/subdir is a directory
/working/directory/aaa is a link to /working/directory/dir/subdir
/working/directory/out.txt is a file
then on Unix
Path.of("aaa/../../out.txt").toRealPath()
returns /working/directory/out.txt but on Windows
Path.of("aaa\\..\\..\\out.txt").toRealPath()
throws
| Exception java.nio.file.NoSuchFileException: C:\working\out.txt
when it should have returned C:\working\directory\out.txt. This situation appears to occur when a link in the path is followed by "../..". The Windows result appears incorrect.
- duplicates
-
JDK-8306882 (fs) Path.toRealPath(LinkOption.NOFOLLOW_LINKS) fails when "../../" follows a link
- Closed
- relates to
-
JDK-8306882 (fs) Path.toRealPath(LinkOption.NOFOLLOW_LINKS) fails when "../../" follows a link
- Closed
- links to