From e779511e09d80b15a798e3e239e9944e9b55f2e1 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 21 Nov 2023 12:53:36 +0100 Subject: [PATCH 1/2] respect enableXattr flag --- .../frontend/fuse/ReadOnlyAdapter.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java b/src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java index 9c2d833..0b5707c 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java +++ b/src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java @@ -37,10 +37,14 @@ import java.util.Set; import java.util.function.BooleanSupplier; +import static org.cryptomator.jfuse.api.FuseOperations.Operation.GET_XATTR; +import static org.cryptomator.jfuse.api.FuseOperations.Operation.LIST_XATTR; + public sealed class ReadOnlyAdapter implements FuseNioAdapter permits ReadWriteAdapter { private static final Logger LOG = LoggerFactory.getLogger(ReadOnlyAdapter.class); private static final int BLOCKSIZE = 4096; + protected final Errno errno; protected final Path root; private final int maxFileNameLength; @@ -88,15 +92,14 @@ public Errno errno() { @Override public Set supportedOperations() { - // FIXME: respect enableXattr - return Set.of(Operation.ACCESS, + var supportedOps = EnumSet.of(Operation.ACCESS, Operation.CHMOD, Operation.CREATE, Operation.DESTROY, Operation.GET_ATTR, - Operation.GET_XATTR, + GET_XATTR, Operation.INIT, - Operation.LIST_XATTR, + LIST_XATTR, Operation.OPEN, Operation.OPEN_DIR, Operation.READ, @@ -105,6 +108,11 @@ public Set supportedOperations() { Operation.RELEASE, Operation.RELEASE_DIR, Operation.STATFS); + if (!enableXattr) { + supportedOps.remove(GET_XATTR); + supportedOps.remove(LIST_XATTR); + } + return supportedOps; } private String stripLeadingFrom(String string) { From e53e1003b9e9049d17a5f4f9bd959af939bde6ce Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 21 Nov 2023 12:17:08 +0100 Subject: [PATCH 2/2] references #86 --- .../cryptomator/frontend/fuse/mount/WinFspMountProvider.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspMountProvider.java b/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspMountProvider.java index 16824f4..666917a 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspMountProvider.java +++ b/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspMountProvider.java @@ -119,7 +119,8 @@ public Mount mount() throws MountFailedException { var builder = Fuse.builder(); var libPath = WinfspUtil.getWinFspInstallDir() + "bin\\" + (OS_ARCH.contains("aarch64") ? "winfsp-a64.dll" : "winfsp-x64.dll"); builder.setLibraryPath(libPath); - var fuseAdapter = ReadWriteAdapter.create(builder.errno(), vfsRoot, FuseNioAdapter.DEFAULT_MAX_FILENAMELENGTH, FileNameTranscoder.transcoder(), true); + //xattr disabled due to https://github.com/cryptomator/fuse-nio-adapter/issues/86 + var fuseAdapter = ReadWriteAdapter.create(builder.errno(), vfsRoot, FuseNioAdapter.DEFAULT_MAX_FILENAMELENGTH, FileNameTranscoder.transcoder(), false); try { var fuse = builder.build(fuseAdapter); fuse.mount("fuse-nio-adapter", mountPoint, combinedMountFlags().toArray(String[]::new));