[9] RFC on 8066943: (fs) Path.relativize() gives incorrect result for ".." on Windows

Brian Burkhalter brian.burkhalter at oracle.com
Fri May 1 20:37:54 UTC 2015


On May 1, 2015, at 1:07 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:

>>> Which case, there are two: ../x
>> This one.
> 
> I sort of figured that out in the intervening time.
> 
>> For the "".relativize("x") then you are going from the current directory to "x" so the answer should be "x". We seem to have it right everywhere except Windows.
> 
> Was working on Windows yesterday with JDK 9 but I shall re-test.


JDK 9 on Windows copy-paste:

— begin —

$ cat JDK8066943.java
package scratch;

import java.nio.file.Paths;

public class JDK8066943 {
    public static void main(String[] args) throws Throwable {
        System.out.println(Paths.get("..").relativize(Paths.get("x")));
        System.out.println(Paths.get("").relativize(Paths.get("x")));

    }
}

$ ./build/windows-x86_64-normal-server-release/jdk/bin/java -cp . scratch.JDK8066943
..\x
x

— end —

So the issue description is accurate and an IAW should be thrown for that case, but the behavior in Max’s comment is no longer reproducible so a new, separate issue does not need to be filed for it.

Thanks,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20150501/e23175cc/attachment.html>


More information about the nio-dev mailing list