On Sun, 7 Feb 2021 20:16:08 GMT, Michael McMahon <micha...@openjdk.org> wrote:

>> Could I get the following change reviewed please? It fixes a problem (in 
>> JEP380) on Windows where some file operations on Unix domain sockets were 
>> not working and led to the feature being disabled on Windows 2019 Server in 
>> JDK 16. So, the fix re-enables the feature on all versions of Windows that 
>> support it.
>> 
>> The test checks all the file APIs that were affected by the problem. The 
>> change touches the code that handles symbolic links in Windows (since they 
>> are implemented as NTFS reparse points, like Unix sockets), but I didn't add 
>> any specific testing in this area, as I assume the existing unit tests for 
>> NIO symbolic links should cover that. If I should add more tests here, then 
>> I can do that.
>> 
>> Thanks,
>> Michael
>
> Michael McMahon has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 11 additional 
> commits since the last revision:
> 
>  - Merge branch 'master' into 8252971-socket-attributes
>  - add specific check for unix domain socket
>  - Merge branch 'master' into 8252971-socket-attributes
>  - update
>  - update
>  - update
>  - update
>  - update after Alan's first review
>  - Merge branch 'master' into 8252971-socket-attributes
>  - test update
>  - ... and 1 more: 
> https://git.openjdk.java.net/jdk/compare/77ac60d6...746b4762

src/java.base/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java line 
346:

> 344:                                 
> Set.of(WindowsChannelFactory.OPEN_REPARSE_POINT),
> 345:                                 0L);
> 346:                     fc.close();

The new version looks a bit strange. As I read it, the attempt to open the file 
fails with ERROR_CANT_ACCESS_FILE so you then check test if the file is a 
socket file. That succeeds so we should be done. What is the reason for opening 
the file again?

src/java.base/windows/classes/sun/nio/fs/WindowsPath.java line 862:

> 860:      * and a handle to the socket file if it is.
> 861:      */
> 862:     private long openSocketForReadAttributeAccess() {

The methods here throw WindowsException when they fail and might be better to 
keep it consistent and throw WindowsException rather than returning 
INVALID_HANDLE_VALUE.

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

PR: https://git.openjdk.java.net/jdk/pull/2424

Reply via email to