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

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

XMLWordPrintable

    • b14
    • generic
    • linux, os_x
    • Verified

      A DESCRIPTION OF THE PROBLEM :
      The function Path.toRealPath(LinkOption... options) when called with LinkOption.NOFOLLOW_LINKS contain logic that does not eliminate ".." where the previous element is a link.
      That logic fails to work when a link is followed by "../..".

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a symbolic link "/path/to/link" that point to "/absolute/path/to/target"
      Create a file "/absolute/path/some_file.txt"
      Create a Path object "/path/to/link/../../some_file.txt"
      Call the function toRealPath(LinkOption.NOFOLLOW_LINKS), the result will be a non-exiting path "/path/to/some_file.txt" instead of "/path/to/link/../../some_file.txt".


      FREQUENCY : always


            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: