RFR: 8364277: (fs) BasicFileAttributes.isDirectory and isOther return true for NTFS directory junctions when links not followed

Brian Burkhalter bpb at openjdk.org
Tue Aug 5 21:10:19 UTC 2025


On Tue, 5 Aug 2025 06:53:24 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> I'm specifically wondering about toRealPath and Files.list/walk behave now and how they will behave with the change.

For a file tree rooted at dir

dir:
file1*  file2*  file3*  subdir/

dir/subdir:
file4*  file5*

and a directory junction `junction` whose target is `dir`, then for `p = Path.of("junction")`, the results of `p.toRealPath()`, `p.toRealPath(NOFOLLOW_LINKS)`, `Files.list(p)`, and `Files.walk(p, FOLLOW_LINKS)` are identical before and after this change. Only the results of `Files.walk(p)` differ and are as follows:

- **before**
```[junction, junction\file1, junction\file2, junction\file3, junction\subdir, junction\subdir\file4, junction\subdir\file5]```
- **after**
```[junction]```.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26631#issuecomment-3156651833


More information about the nio-dev mailing list