<div dir="ltr"><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 6, 2023 at 3:34 PM Alan Bateman <<a href="mailto:Alan.Bateman@oracle.com">Alan.Bateman@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 06/04/2023 14:03, Fabian Meumertzheim wrote:<br>
> Hi,<br>
><br>
> The build system Bazel would benefit from having a non-trivial <br>
> implementation of WindowsFileAttributes#fileKey available - the <br>
> function currently always returns null, even if <br>
> sun.nio.fs.ensureAccurateMetadata is set to true.<br>
><br>
> Based on my understanding of the API contract, changing this function <br>
> to return an object with information equivalent to what is encoded in <br>
> src/java.base/windows/classes/sun/nio/ch/FileKey.java, but only if the <br>
> WindowsFileAttributes were created via fromFileInformation, would be a <br>
> backwards compatible change.<br>
><br>
I have a vague memory that there were issues with the volume serial <br>
number and file ID being problematic in some environment (issues with <br>
uniqueness and/or the file ID changing over time). The usage in the <br>
FileLock code is very limited. An up to date survey on the stability <br>
and feasibility of the vol serial number and file ID could be useful.<br></blockquote><div><br></div><div>Thanks, I will see whether I can gather some input on that.</div><div><br></div><div>It looks like `Files#isSameFile()` is already backed by these fields though: <a href="https://github.com/openjdk/jdk/blob/ddd50d0db31e50c0fcedafa290d6eac277ddae3e/src/java.base/windows/classes/sun/nio/fs/WindowsFileAttributes.java#L349-L356">https://github.com/openjdk/jdk/blob/ddd50d0db31e50c0fcedafa290d6eac277ddae3e/src/java.base/windows/classes/sun/nio/fs/WindowsFileAttributes.java#L349-L356</a>. </div><div>Issues with volume serial number and file ID as unique identifiers should thus already be reachable directly via public API.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
-Alan<br>
</blockquote></div></div>