adoptium / adoptium/adoptium-support
Files.readAttributes() will throw exception on WSL2 file ownership requests
- Dominant language
- No language data
- Stars
- 59
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
On Windows 10 a call of _Files.readAttributes(path, "owner:*", LinkOption.NOFOLLOW_LINKS)_ in the special case where the _path_ is located on Windows Subsystem Linux 2 mapped network drive. will produce exception.
_java.nio.file.FileSystemException: U:\path_to_file\filename.ext: Incorrect function._
This case is related to Maven builds not running as expected as with the case descriptions here https://github.com/codehaus-plexus/plexus-io/issues/36
## Steps to reproduce
A call with _path.getFileSystem()_ returns object of type
sun.nio.fs.WindowsFileSystem
A call with _path.getFileSystem().supportedFileAttributeViews()_ returns
[owner, dos, acl, basic, user]
A call to _Files.readAttributes( path, "basic:*", LinkOption.NOFOLLOW_LINKS)_ returns
{
lastAccessTime=2021-01-26T12:37:41.11Z,
lastModifiedTime=2021-01-26T12:37:41.12Z,
size=2085,
creationTime=2021-01-26T12:37:41.11Z,
isSymbolicLink=false,
isRegularFile=true,
fileKey=null,
isOther=false,
isDirectory=false
}
When expecting that file ownership information is available running call _Files.readAttributes(path, "owner:*", LinkOption.NOFOLLOW_LINKS)_ will produce exception.
_java.nio.file.FileSystemException: U:\path_to_file\filename.ext: Incorrect function._
## Expected results
I would expect this to return _null_ or more subtle way. This case
## Actual results
_java.nio.file.FileSystemException: U:\path_to_file\filename.ext: Incorrect function._
## Triaging info
Java version:
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK Client VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
What is your operating system and platform?
Windows 10 Enterprise 2004 on x86-64
How did you install Java?
Unzipped zip file.
Did you test with other Java versions?
Tested with a little bit older AdoptOpenJDK 10.0.9.1+9 and results are the same.
Contributor guide
Research direction
No repository files or tests are named. Start by reproducing Files.readAttributes(path, "owner:*", LinkOption.NOFOLLOW_LINKS) on a Windows 10 WSL2 mapped network drive and compare it with the working basic:* request. Done means the ownership request no longer throws FileSystemException and its unsupported-ownership behavior is defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100