cryptomator / fuse-nio-adapter

FUSE-based adapter to provide directory contents specified by a java.nio.file.Path
GNU Affero General Public License v3.0
24 stars 14 forks source link

Xattr+Winfsp: Wrong return code if underlying FS does not support extended attributes #86

Closed infeo closed 1 year ago

infeo commented 1 year ago

Fuse-nio-adapter version: 4.0.0-beta4

With commit 5ce3f13944afe9885b3952ff120122b7d710f3c8 fuse-nio-adapter supports extended attributes. But since backend filesystem also needs to support extended attributes by implementing the UserDefinedFileAttributeView.

In the adapter, we check if this is implemented with https://github.com/cryptomator/fuse-nio-adapter/blob/0066fe450bd19a1b9beb60769109c3a8f10e0f50/src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java#L229-L231

So far so good. Unfortunately, ENOTSUP error code is mapped in WinFSP to the NTSTATUS code STATUS_ACCESS_DENIED, leading to unexpected results. The reason is, that winfsp uses the function fsp_fuse_ntstatus_from_errno to map POSIX errors to Windows NTSTATUSes. The actual mapping is defined in errno.i and if none is found, by default ACCESS_DENIED is returned, which is here the case. (The actual value of ENOTSUP is defined in the Windows version of errno.h)

infeo commented 1 year ago

Actual fix depends on https://github.com/winfsp/winfsp/issues/531.

For now, xattr support will be deactivated in the Winfsp mounters.

infeo commented 1 year ago

Closed with https://github.com/cryptomator/fuse-nio-adapter/commit/e53e1003b9e9049d17a5f4f9bd959af939bde6ce