Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8314245

(fs) Path::toRealPath gives divergent results for link/../.. on Unix and Windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • None
    • 21
    • core-libs
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              bpb Brian Burkhalter
              bpb Brian Burkhalter
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: