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

Path.toRealPath behaves inconsistently with symlinks on subst:ed drives on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 12
    • core-libs
    • None
    • Fix Understood
    • windows

      The test java/nio/file/Path/Misc.java fails if -Djava.io.tmpdir is set to a directory on a subst:ed drive and running in elevated mode. This is caused by Path.toRealPath behaving differently for a link compared to the target file if both reside on a subst:ed drive. The link is completely resolved and will point to the original drive while the normal file is not and will point to the subst:ed drive. I believe this inconsistent behavior is a bug.

      I discovered this while working on JDK-8213214 where I'm intending to set -Djava.io.tmpdir by default when running tests. When trying this in Mach5, the mentioned test fails on Windows. This is because we currently run tests in elevated mode (so symlinks are supported) and the work directory where I point -Djava.io.tmpdir is subst:ed to shorten paths.

      To reproduce this, apply the attached patch, launch an elevated command or cygwin window. Run:

      $ subst t: <path to parent of current dir>
      $ cd /cygdrive/t/<jdk>
      $ bash configure ...
      $ make run-test TEST=java/nio/file/Path/Misc.java

            bpb Brian Burkhalter
            erikj Erik Joelsson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: