[EXTERNAL] Re: Bug in Files.isSameFile(Path,Path)

Nhat Nguyen honguye at microsoft.com
Thu Oct 29 00:13:33 UTC 2020


Hi everyone,

We looked into the issue and found that the values of volSerialNumber, fileIndexHigh, and fileIndexLow
in the file attributes, which are used to determine if the two files are the same, are all zeroes when used
with webdav drives. However, this looks like a known issue as cpython seems to suffer from the same
behaviour as well [1].

We have a suggested fix [2] that falls back to using GetFinalPathByHandle and comparing the two paths
when the volSerialNumber is zero. We have also reached out to the Windows team to confirm if this is
the preferred way to detect such cases; we will get back when we have hear back from them.

[1]: https://github.com/python/cpython/pull/5764#discussion_r169221544
[2]: https://github.com/nhat-nguyen/jdk/commit/bd8fdc2809ed08e5564fe1eab4a7c1c2f32df84b

Thanks,
Nhat
----------------------
From: Alan Bateman <Alan.Bateman at oracle.com> 
Sent: Saturday, October 24, 2020 1:26 AM
To: Nikola Grcevski <Nikola.Grcevski at microsoft.com>; WarnerJan Veldhuis <veldhuis at freedom.nl>; nio-dev at openjdk.java.net
Cc: Nhat Nguyen <honguye at microsoft.com>
Subject: [EXTERNAL] Re: Bug in Files.isSameFile(Path,Path)


On 23/10/2020 20:46, Nikola Grcevski wrote:
Thanks for reporting this WarnerJan, we'll take a look.

It would be useful to know what GetFileInformationByHandle returns when the handle is to a file that is accessed with the WebDAV redirector. It might be that isSameFile needs a fallback implementation for degenerative cases, meaning if is no volume or unique file id available then it might have to check the real paths for equality.

-Alan


More information about the nio-dev mailing list