-
Bug
-
Resolution: Unresolved
-
P4
-
7, 8, 25
-
x86_64
-
windows
ADDITIONAL SYSTEM INFORMATION :
Java version: 21.0.7, vendor: Eclipse Adoptium
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Filesystem: NTFS 3.1
A DESCRIPTION OF THE PROBLEM :
NTFS Junctions are not correctly reported (on Windows).
When reading the BasicFileAttributes of a junction (with NOFOLLOW_LINKS) it is reported that the junction is a directory AND other. This is a violation of the NIO BasicFileAttributes API which states (in isOther's JavaDoc):
> Tells whether the file is something other than a regular file, directory, or symbolic link.
This also causes various downstream problems. For example FileTreeWalker (used in Files#walk/ Files#find) runs into an "infinite" loop (if there are enough files present) or a FileSystemException when encountering a recursive junction.
Recursive junctions are e.g. created by NPM that's where I encountered this problem in the first place.
I would also appreciate it if you could tell me if it's somehow possible to workaround the problem on older / affected java versions.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A NTFS Junction should
* not be reported as a directory with NOFOLLOW_LINKS
* reported as symlink or other
If the change is not possible:
* The API/docs of BasicFileAttributes needs to be addressed to allow for not mutually exclusive states being reported
* FileTreeWalker should not run into the above mentioned problems. Please note that this might cause a performance impact
ACTUAL -
NTFS Junction is reported as directory AND other.
FileTreeWalker crashes or runs into "infinite" loop.
Java version: 21.0.7, vendor: Eclipse Adoptium
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Filesystem: NTFS 3.1
A DESCRIPTION OF THE PROBLEM :
NTFS Junctions are not correctly reported (on Windows).
When reading the BasicFileAttributes of a junction (with NOFOLLOW_LINKS) it is reported that the junction is a directory AND other. This is a violation of the NIO BasicFileAttributes API which states (in isOther's JavaDoc):
> Tells whether the file is something other than a regular file, directory, or symbolic link.
This also causes various downstream problems. For example FileTreeWalker (used in Files#walk/ Files#find) runs into an "infinite" loop (if there are enough files present) or a FileSystemException when encountering a recursive junction.
Recursive junctions are e.g. created by NPM that's where I encountered this problem in the first place.
I would also appreciate it if you could tell me if it's somehow possible to workaround the problem on older / affected java versions.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A NTFS Junction should
* not be reported as a directory with NOFOLLOW_LINKS
* reported as symlink or other
If the change is not possible:
* The API/docs of BasicFileAttributes needs to be addressed to allow for not mutually exclusive states being reported
* FileTreeWalker should not run into the above mentioned problems. Please note that this might cause a performance impact
ACTUAL -
NTFS Junction is reported as directory AND other.
FileTreeWalker crashes or runs into "infinite" loop.
- relates to
-
JDK-8069345 (fs) FileTreeWalker throws NotDirectoryException on file junction points
-
- Open
-