On Thu, 17 Oct 2024 06:09:42 GMT, Alan Bateman <al...@openjdk.org> wrote:
> The JDK supports sym links on Windows and adding support for other unusual > junctions types has the potential to introduce inconsistencies and weirdness > that are outside the scope of the APIs. There appear to be two types of junctions for reparse points with tag `IO_REPARSE_TAG_MOUNT_POINT`: directory junctions and volume junctions. The reparse tag is set on a directory which is empty. Both of these reparse points contain a target string which represents a path. For directory junctions, the path is an absolute path beginning with a drive letter such as C:\Users\username\directory\subdirectory This path is intended to be to a directory, but there is nothing preventing storing the path to a file or a symbolic link. For volume junctions, the path uses a GUID, for example, like this \?\Volume{blah-foo-bar-gus-blah}\ Presently, the JDK _appears_ already to support "true" directory junctions, i.e., where the target path begins with a drive letter and is an absolute path to a directory. The two new tests proposed in this request verify at least a portion of this behavior. All but two sub-tests of these tests already pass with no source changes. > [...] this is not a change that we should rush into. Agreed. Note that the only actual implementation changes being proposed here are 1. `Files.isSymbolicLink` would return `true` for directory junctions. 2. `Files.readSymbolicLink` would return the target of the mount point. It is incomplete in the current form of this request, but I think tighter checks should be performed to ensure that the target does not represent a volume mount point, nor a regular file, nor a symbolic link. ------------- PR Comment: https://git.openjdk.org/jdk/pull/21555#issuecomment-2420886803