Implement WindowsFileAttributes#fileKey
Fabian Meumertzheim
fabian at meumertzhe.im
Thu Apr 6 14:22:33 UTC 2023
On Thu, Apr 6, 2023 at 3:34 PM Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 06/04/2023 14:03, Fabian Meumertzheim wrote:
> > Hi,
> >
> > The build system Bazel would benefit from having a non-trivial
> > implementation of WindowsFileAttributes#fileKey available - the
> > function currently always returns null, even if
> > sun.nio.fs.ensureAccurateMetadata is set to true.
> >
> > Based on my understanding of the API contract, changing this function
> > to return an object with information equivalent to what is encoded in
> > src/java.base/windows/classes/sun/nio/ch/FileKey.java, but only if the
> > WindowsFileAttributes were created via fromFileInformation, would be a
> > backwards compatible change.
> >
> I have a vague memory that there were issues with the volume serial
> number and file ID being problematic in some environment (issues with
> uniqueness and/or the file ID changing over time). The usage in the
> FileLock code is very limited. An up to date survey on the stability
> and feasibility of the vol serial number and file ID could be useful.
>
Thanks, I will see whether I can gather some input on that.
It looks like `Files#isSameFile()` is already backed by these fields
though:
https://github.com/openjdk/jdk/blob/ddd50d0db31e50c0fcedafa290d6eac277ddae3e/src/java.base/windows/classes/sun/nio/fs/WindowsFileAttributes.java#L349-L356
.
Issues with volume serial number and file ID as unique identifiers should
thus already be reachable directly via public API.
> -Alan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/nio-dev/attachments/20230406/324bc649/attachment-0001.htm>
More information about the nio-dev
mailing list