From 023ed860aefe8da46bb27a264876b701ee4464c8 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 5 Apr 2023 15:53:00 +0200 Subject: [PATCH 1/9] avoid string concatenation if logging is disabled --- .../frontend/fuse/ReadOnlyAdapter.java | 8 ++++---- .../frontend/fuse/ReadWriteAdapter.java | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java b/src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java index 3dc7b52..ad9713e 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java +++ b/src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java @@ -123,7 +123,7 @@ public int statfs(String path, Statvfs stbuf) { LOG.trace("statfs {} ({} / {})", path, avail, total); return 0; } catch (IOException | RuntimeException e) { - LOG.error("statfs " + path + " failed.", e); + LOG.error("statfs {} failed.", path, e); return -errno.eio(); } } @@ -250,7 +250,7 @@ public int open(String path, FileInfo fi) { LOG.warn("Attempted to open file with unsupported flags.", e); return -errno.erofs(); } catch (IOException | RuntimeException e) { - LOG.error("open " + path + " failed.", e); + LOG.error("open {} failed.", path, e); return -errno.eio(); } } @@ -267,7 +267,7 @@ public int read(String path, ByteBuffer buf, long size, long offset, FileInfo fi LOG.warn("read {} failed, invalid file handle {}", path, fi.getFh()); return -errno.ebadf(); } catch (IOException | RuntimeException e) { - LOG.error("read " + path + " failed.", e); + LOG.error("read {} failed.", path, e); return -errno.eio(); } } @@ -283,7 +283,7 @@ public int release(String path, FileInfo fi) { LOG.warn("release {} failed, invalid file handle {}", path, fi.getFh()); return -errno.ebadf(); } catch (IOException | RuntimeException e) { - LOG.error("release " + path + " failed.", e); + LOG.error("release {} failed.", path, e); return -errno.eio(); } } diff --git a/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java b/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java index 98cc96a..c06cee1 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java +++ b/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java @@ -92,7 +92,7 @@ public int mkdir(String path, int mode) { } catch (FileSystemException e) { return getErrorCodeForGenericFileSystemException(e, "mkdir " + path); } catch (IOException | RuntimeException e) { - LOG.error("mkdir " + path + " failed.", e); + LOG.error("mkdir {} failed.", path, e); return -errno.eio(); } } @@ -137,7 +137,7 @@ public int create(String path, int mode, FileInfo fi) { } catch (FileSystemException e) { return getErrorCodeForGenericFileSystemException(e, "create " + path); } catch (IOException | RuntimeException e) { - LOG.error("create " + path + " failed.", e); + LOG.error("create {} failed.", path, e); return -errno.eio(); } } @@ -163,7 +163,7 @@ public int chmod(String path, int mode, FileInfo fi) { LOG.warn("Setting posix permissions not supported by underlying file system."); return -errno.enosys(); } catch (IOException | RuntimeException e) { - LOG.error("chmod " + path + " failed.", e); + LOG.error("chmod {} failed.", path, e); return -errno.eio(); } } @@ -184,7 +184,7 @@ public int unlink(String path) { LOG.warn("unlink {} failed, file not found.", path); return -errno.enoent(); } catch (IOException | RuntimeException e) { - LOG.error("unlink " + path + " failed.", e); + LOG.error("unlink {} failed.", path, e); return -errno.eio(); } } @@ -212,7 +212,7 @@ public int rmdir(String path) { LOG.warn("rmdir {} failed, directory not empty.", path); return -errno.enotempty(); } catch (IOException | RuntimeException e) { - LOG.error("rmdir " + path + " failed.", e); + LOG.error("rmdir {} failed.", path, e); return -errno.eio(); } } @@ -270,7 +270,7 @@ public int utimens(String path, TimeSpec atime, TimeSpec mtime, FileInfo fi) { LOG.warn("utimens {} failed, file not found.", path); return -errno.enoent(); } catch (IOException | RuntimeException e) { - LOG.error("utimens " + path + " failed.", e); + LOG.error("utimens {} failed.", path, e); return -errno.eio(); } } @@ -287,7 +287,7 @@ public int write(String path, ByteBuffer buf, long size, long offset, FileInfo f LOG.warn("write {} failed, invalid file handle {}", path, fi.getFh()); return -errno.ebadf(); } catch (IOException | RuntimeException e) { - LOG.error("write " + path + " failed.", e); + LOG.error("write {} failed.", path, e); return -errno.eio(); } } @@ -308,7 +308,7 @@ public int truncate(String path, long size, FileInfo fi) { LOG.warn("utimens {} failed, file not found.", path); return -errno.enoent(); } catch (IOException | RuntimeException e) { - LOG.error("truncate " + path + " failed.", e); + LOG.error("truncate {} failed.", path, e); return -errno.eio(); } } @@ -324,7 +324,7 @@ public int fsync(String path, int isdatasync, FileInfo fi) { LOG.warn("fsync {} failed, invalid file handle {}", path, fi.getFh()); return -errno.ebadf(); } catch (IOException | RuntimeException e) { - LOG.error("fsync " + path + " failed.", e); + LOG.error("fsync {} failed.", path, e); return -errno.eio(); } } From 2c4383dd85e66db0cbee0b189383761c4e24915c Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 21 Apr 2023 14:49:25 +0200 Subject: [PATCH 2/9] migrate to jdk20 --- .github/workflows/build.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/publish-central.yml | 2 +- .github/workflows/publish-github.yml | 2 +- .idea/misc.xml | 2 +- .idea/modules.xml | 8 -------- pom.xml | 9 +++++---- 7 files changed, 10 insertions(+), 17 deletions(-) delete mode 100644 .idea/modules.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf8004f..ca9e1df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - java-version: 19 + java-version: 20 distribution: 'zulu' cache: 'maven' - name: Ensure to use tagged version diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 0342aac..893923f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,7 +20,7 @@ jobs: fetch-depth: 2 - uses: actions/setup-java@v3 with: - java-version: 19 + java-version: 20 distribution: 'zulu' cache: 'maven' - name: Initialize CodeQL diff --git a/.github/workflows/publish-central.yml b/.github/workflows/publish-central.yml index 9ad01e7..5587f7b 100644 --- a/.github/workflows/publish-central.yml +++ b/.github/workflows/publish-central.yml @@ -15,7 +15,7 @@ jobs: ref: "refs/tags/${{ github.event.inputs.tag }}" - uses: actions/setup-java@v3 with: - java-version: 19 + java-version: 20 distribution: 'zulu' cache: 'maven' server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml diff --git a/.github/workflows/publish-github.yml b/.github/workflows/publish-github.yml index b233f6c..bdcc2f6 100644 --- a/.github/workflows/publish-github.yml +++ b/.github/workflows/publish-github.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - java-version: 19 + java-version: 20 distribution: 'zulu' cache: 'maven' gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import diff --git a/.idea/misc.xml b/.idea/misc.xml index b385302..bf3f4bb 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,5 +7,5 @@ - + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index c612358..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 93aac53..35c84f0 100644 --- a/pom.xml +++ b/pom.xml @@ -17,23 +17,24 @@ UTF-8 - 19 + 20 1.2.0 - 0.4.2 + 0.5.1 31.1-jre 2.0.3 3.1.4 5.9.0 - 4.7.0 + 5.2.0 2.4.3 8.1.2 3.1.0 + 0.8.9 @@ -175,7 +176,7 @@ org.jacoco jacoco-maven-plugin - 0.8.8 + ${jacoco.version} prepare-agent From 1eeeed0a725c8e3c0335bcaf0ee553a2f5417c38 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 21 Apr 2023 14:54:42 +0200 Subject: [PATCH 3/9] bump test dependencies --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 93aac53..a6fb4e3 100644 --- a/pom.xml +++ b/pom.xml @@ -27,9 +27,9 @@ 3.1.4 - 5.9.0 - 4.7.0 - 2.4.3 + 5.9.2 + 5.2.0 + 2.6.4 8.1.2 From 9f6ddbc0f4cf37634bf9c5b141f63da391e049bf Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 21 Apr 2023 14:55:17 +0200 Subject: [PATCH 4/9] fix wrong log message --- .../java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java b/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java index c06cee1..e8a8355 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java +++ b/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java @@ -305,7 +305,7 @@ public int truncate(String path, long size, FileInfo fi) { } return 0; } catch (NoSuchFileException e) { - LOG.warn("utimens {} failed, file not found.", path); + LOG.warn("truncate {} failed, file not found.", path); return -errno.enoent(); } catch (IOException | RuntimeException e) { LOG.error("truncate {} failed.", path, e); From c7822a3ee367932df467527c88abc05865dc5da6 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 21 Apr 2023 14:55:54 +0200 Subject: [PATCH 5/9] fix wrong logging control --- .../fuse/mount/MirroringFuseMountTest.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/cryptomator/frontend/fuse/mount/MirroringFuseMountTest.java b/src/test/java/org/cryptomator/frontend/fuse/mount/MirroringFuseMountTest.java index 5311b65..a593106 100644 --- a/src/test/java/org/cryptomator/frontend/fuse/mount/MirroringFuseMountTest.java +++ b/src/test/java/org/cryptomator/frontend/fuse/mount/MirroringFuseMountTest.java @@ -28,11 +28,6 @@ */ public class MirroringFuseMountTest { - static { - System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "debug"); - System.setProperty("org.slf4j.simpleLogger.showDateTime", "true"); - System.setProperty("org.slf4j.simpleLogger.dateTimeFormat", "HH:mm:ss.SSS"); - } private static final Logger LOG = LoggerFactory.getLogger(MirroringFuseMountTest.class); @@ -41,6 +36,14 @@ public class MirroringFuseMountTest { */ public static class Mirror { + static { + System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "debug"); + System.setProperty("org.slf4j.simpleLogger.log.org.cryptomator.frontend.fuse.locks.DataLock", "warn"); + System.setProperty("org.slf4j.simpleLogger.log.org.cryptomator.frontend.fuse.locks.PathLock", "warn"); + System.setProperty("org.slf4j.simpleLogger.showDateTime", "true"); + System.setProperty("org.slf4j.simpleLogger.dateTimeFormat", "HH:mm:ss.SSS"); + } + public static void main(String[] args) throws MountFailedException { var mountService = MountService.get().findAny().orElseThrow(() -> new MountFailedException("Did not find a mount provider")); LOG.info("Using mount provider: {}", mountService.displayName()); @@ -58,6 +61,14 @@ public static void main(String[] args) throws MountFailedException { */ public static class CryptoFsMirror { + static { + System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "debug"); + System.setProperty("org.slf4j.simpleLogger.log.org.cryptomator.frontend.fuse.locks.DataLock", "warn"); + System.setProperty("org.slf4j.simpleLogger.log.org.cryptomator.frontend.fuse.locks.PathLock", "warn"); + System.setProperty("org.slf4j.simpleLogger.showDateTime", "true"); + System.setProperty("org.slf4j.simpleLogger.dateTimeFormat", "HH:mm:ss.SSS"); + } + public static void main(String[] args) throws IOException, NoSuchAlgorithmException, MountFailedException { var mountService = MountService.get().findAny().orElseThrow(() -> new MountFailedException("Did not find a mount provider")); LOG.info("Using mount provider: {}", mountService.displayName()); From e57d0fb642201049489ee134ac43e15e8ccb53e1 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 24 Apr 2023 09:38:46 +0200 Subject: [PATCH 6/9] prevent log spam --- .../cryptomator/frontend/fuse/ReadWriteAdapter.java | 4 +++- .../org/cryptomator/frontend/fuse/WindowsUtil.java | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/cryptomator/frontend/fuse/WindowsUtil.java diff --git a/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java b/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java index e8a8355..810c312 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java +++ b/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java @@ -160,7 +160,9 @@ public int chmod(String path, int mode, FileInfo fi) { LOG.warn("chmod {} failed, file not found.", path); return -errno.enoent(); } catch (UnsupportedOperationException e) { - LOG.warn("Setting posix permissions not supported by underlying file system."); + if (!WindowsUtil.IS_RUNNING_OS) { //prevent spamming warnings + LOG.warn("Setting posix permissions not supported by underlying file system."); + } return -errno.enosys(); } catch (IOException | RuntimeException e) { LOG.error("chmod {} failed.", path, e); diff --git a/src/main/java/org/cryptomator/frontend/fuse/WindowsUtil.java b/src/main/java/org/cryptomator/frontend/fuse/WindowsUtil.java new file mode 100644 index 0000000..d5705a1 --- /dev/null +++ b/src/main/java/org/cryptomator/frontend/fuse/WindowsUtil.java @@ -0,0 +1,10 @@ +package org.cryptomator.frontend.fuse; + +public class WindowsUtil { + + public static final boolean IS_RUNNING_OS = System.getProperty("os.name").toLowerCase().contains("windows"); + + private WindowsUtil() {} + + +} From d06b7d08c7a8f5d332cf1e05088c4c312bab2f11 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 24 Apr 2023 09:49:14 +0200 Subject: [PATCH 7/9] prepare 3.0.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e86b045..e4f0734 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 org.cryptomator fuse-nio-adapter - 2.1.0-SNAPSHOT + 3.0.0 FUSE-NIO-Adapter Access resources at a given NIO path via FUSE. https://github.com/cryptomator/fuse-nio-adapter From 9187778d9d0d965c67dfc62026cb75987747d5ef Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 8 May 2023 17:24:36 +0200 Subject: [PATCH 8/9] [ci skip] Updated README * removed Property section --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index eb93eb4..395b4e4 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,6 @@ Provides directory contents specified by a `java.nio.file.Path` via a FUSE files Uses [jfuse](https://github.com/cryptomator/jfuse), i.e. you need to install the specified fuse drivers for your OS. -## Configuration Parameters -The following system properties are used: -* `org.cryptomator.frontend.fuse.mountTimeOut` - The mount timeout threshold in milliseonds. If the mounting operation exceeds it, the mounting is aborted. - ## License This project is dual-licensed under the AGPLv3 for FOSS projects as well as a commercial license for independent software vendors and resellers. If you want to use this library in applications, that are *not* licensed under the AGPL, feel free to contact our [support team](https://cryptomator.org/help/). From 5f63894fbef9cef1ed62727396cc5d34228eb020 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 8 May 2023 17:44:00 +0200 Subject: [PATCH 9/9] update dependencies --- pom.xml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index e4f0734..745b155 100644 --- a/pom.xml +++ b/pom.xml @@ -23,16 +23,16 @@ 1.2.0 0.5.1 31.1-jre - 2.0.3 - 3.1.4 + 2.0.7 + 3.1.6 - 5.9.2 - 5.2.0 + 5.9.3 + 5.3.1 2.6.4 - 8.1.2 + 8.2.1 3.1.0 0.8.9 @@ -138,12 +138,6 @@ ${mockito.version} test - - org.mockito - mockito-inline - ${mockito.version} - test - org.cryptomator cryptofs