Closed overheadhunter closed 2 years ago
Note that the attrs in this method are not passed down to OpenCryptoFile#newFileChannel:
attrs
OpenCryptoFile#newFileChannel
https://github.com/cryptomator/cryptofs/blob/c5432f87b557408cca2a286f664ea6effbf931a6/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemImpl.java#L363-L395
https://github.com/cryptomator/cryptofs/blob/c5432f87b557408cca2a286f664ea6effbf931a6/src/main/java/org/cryptomator/cryptofs/fh/OpenCryptoFile.java#L68-L111
Which leads to atomic "create and set attributes" to fail. Here is an integration test showing the problem:
import java.nio.channels.*; import java.nio.file.*; import java.nio.file.attribute.*; var path = Path.of("/Volumes/foo/test.txt"); var oo = Set.of(StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW); var attr = PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxr-x---")); var fc = FileChannel.open(path, Set.of(StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW), attr); fc.write(java.nio.charset.StandardCharsets.UTF_8.encode("hello world")); fc.close();
Note that the
attrs
in this method are not passed down toOpenCryptoFile#newFileChannel
:https://github.com/cryptomator/cryptofs/blob/c5432f87b557408cca2a286f664ea6effbf931a6/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemImpl.java#L363-L395
https://github.com/cryptomator/cryptofs/blob/c5432f87b557408cca2a286f664ea6effbf931a6/src/main/java/org/cryptomator/cryptofs/fh/OpenCryptoFile.java#L68-L111
Which leads to atomic "create and set attributes" to fail. Here is an integration test showing the problem: