cryptomator / dokany-nio-adapter

Dokany-based adapter to provide directory contents specified by a java.nio.file.Path (via dokan-java)
GNU Affero General Public License v3.0
14 stars 4 forks source link

InvalidPathException #20

Closed infeo closed 5 years ago

infeo commented 5 years ago

Dokany-nio-adapter version: c3c91de2626010534e417ed3472e808ffa89f265 Dokany version: 1.2.1.2000 OS: Windows 10 Pro 1809

Description

Some windows tools (e.g. fsutil) don't check the filename when creating new files. This leads to the throw of an uncatched exception and the wrong or none error code is returned, such that the programs report succes even if the inteded action failed.

Steps to reproduce:

  1. Start the ReadWriteMirrorExample with an arbitrary directory
  2. Open a terminal
  3. Change to the mounted directory
  4. enter fsutil.exe file createnew test<.txt 4096

Results

Expected: The file is not created and an error message is displayed "Error: The file name, directory name or volume lable syntax is incorrect" Actual: The file is not created, but the tool returns a success message "Creation of file test<.txt successful."

Log

15:40:39:846 [Thread-1927] TRACE org.cryptomator.frontend.dokany.ReadWriteAdapter - (241) File Information successful read from M:\test.
JNA: Callback com.dokany.java.DokanyOperationsProxy$ZwCreateFileProxy@9eb590 threw the following exception:
java.nio.file.InvalidPathException: Illegal char <?> at index 3: yol?
    at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
    at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
    at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
    at java.base/java.nio.file.Path.resolve(Path.java:515)
    at org.cryptomator.frontend.dokany.ReadWriteAdapter.getRootedPath(ReadWriteAdapter.java:865)
    at org.cryptomator.frontend.dokany.ReadWriteAdapter.zwCreateFile(ReadWriteAdapter.java:89)
    at com.dokany.java.DokanyOperationsProxy$ZwCreateFileProxy.callback(DokanyOperationsProxy.java:56)
    at jdk.internal.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:520)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:551)
JNA: Callback com.dokany.java.DokanyOperationsProxy$GetFileInformationProxy@307617be threw the following exception:
java.nio.file.InvalidPathException: Illegal char <?> at index 3: yol?
    at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
    at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
    at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
    at java.base/java.nio.file.Path.resolve(Path.java:515)
    at org.cryptomator.frontend.dokany.ReadWriteAdapter.getRootedPath(ReadWriteAdapter.java:865)
    at org.cryptomator.frontend.dokany.ReadWriteAdapter.getFileInformation(ReadWriteAdapter.java:430)
    at com.dokany.java.DokanyOperationsProxy$GetFileInformationProxy.callback(DokanyOperationsProxy.java:96)
    at jdk.internal.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:520)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:551)
JNA: Callback com.dokany.java.DokanyOperationsProxy$GetFileInformationProxy@307617be threw the following exception:
java.nio.file.InvalidPathException: Illegal char <?> at index 3: yol?
    at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
    at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
    at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
    at java.base/java.nio.file.Path.resolve(Path.java:515)
    at org.cryptomator.frontend.dokany.ReadWriteAdapter.getRootedPath(ReadWriteAdapter.java:865)
    at org.cryptomator.frontend.dokany.ReadWriteAdapter.getFileInformation(ReadWriteAdapter.java:430)
    at com.dokany.java.DokanyOperationsProxy$GetFileInformationProxy.callback(DokanyOperationsProxy.java:96)
    at jdk.internal.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:520)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:551)
15:40:39:862 [Thread-1943] TRACE org.cryptomator.frontend.dokany.ReadWriteAdapter - (241) cleanup() is called for M:\test.
15:40:39:862 [Thread-1944] TRACE org.cryptomator.frontend.dokany.ReadWriteAdapter - (241) closeFile() is called for M:\test.