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

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P3
    • None
    • Affects Version/s: 21
    • Component/s: core-libs
    • None

      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.

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

              Created:
              Updated:
              Resolved: