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

(fs) UnixPath::toRealPath does not return correct case when links not followed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • core-libs
    • None
    • b23
    • generic
    • os_x

      If one has for example

      $ ls -l link ~/TheTarget
      -rw-r--r-- 1 bpb staff 0 Oct 19 10:49 /Users/bpb/TheTarget
      lrwxr-xr-x 1 bpb staff 10 Oct 19 10:48 link@ -> /Users/bpb

      and one calls Path.of("link/thetarget").toRealPath() the result is

      /Users/bpb/TheTarget

      but if one calls Path.of("link/thetarget").toRealPath(NOFOLLOW_LINKS) the result it

      /Users/bpb/dev/bugs/jdk/Path-toRealPath/link/thetarget

      In the latter result the retained case of "thetarget" is not obtained. This appears to be because realpath(3) is used when links are followed, but if they are not followed then the code goes down the hierarchy and the case is not preserved. This example is on APFS.

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

              Created:
              Updated:
              Resolved: