Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection to WinFsp broken #75

Closed
TriangularIT opened this issue Apr 30, 2019 · 5 comments
Closed

Connection to WinFsp broken #75

TriangularIT opened this issue Apr 30, 2019 · 5 comments

Comments

@TriangularIT
Copy link

When I try to run HelloFuse with the current WinFsp release (2019.2) on a fully updated Win 10 (1809), the drive is shown, but unavailable. The error message says "Location is not available".

I guess that some of WinFsp's headers have moved and are incompatible with the defined structs in ru.serce.jnrfuse.struct, but I am far too inexperienced with both libraries to attempt a fix.

WinFsp on its own does work – MemFS runs without a hitch and jnr-fuse also works to some extent, because I see some log messages, when I turn on the debug-option:

The service java has been started.
java[TID=1984]: FFFFC305C8D786D0: >>Create [UT---C] "\", FILE_OPEN, CreateOptions=21, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=00000000000004A0[PID=f40], DesiredAccess=100000, GrantedAccess=0, ShareAccess=3
java[TID=1984]: FFFFC305C8D786D0: <<Create IoStatus=0[1] UserContext=0000000000000000:000000000089ED90, GrantedAccess=100000, FileInfo={FileAttributes=10, ReparseTag=0, AllocationSize=0:0, FileSize=0:0, CreationTime=1970-01-01T00:00:00.000Z, LastAccessTime=1970-01-01T00:00:00.000Z, LastWriteTime=1970-01-01T00:00:00.000Z, ChangeTime=1970-01-01T00:00:00.000Z, IndexNumber=0:0}
java[TID=1984]: FFFFC305C99379A0: >>QueryVolumeInformation
java[TID=1984]: FFFFC305C99379A0: <<QueryVolumeInformation IoStatus=0[0] VolumeInfo={TotalSize=0:40000000, FreeSize=0:40000000, VolumeLabel=""}
java[TID=1984]: FFFFC305C8D786D0: >>QueryVolumeInformation
java[TID=1984]: FFFFC305C8D786D0: <<QueryVolumeInformation IoStatus=0[0] VolumeInfo={TotalSize=0:40000000, FreeSize=0:40000000, VolumeLabel=""}
java[TID=1984]: FFFFC305C93BE9A0: >>Close 0000000000000000:000000000089ED90
java[TID=1984]: FFFFC305C93BE9A0: <<Close IoStatus=0[0]
java[TID=1984]: FFFFC305C8B4F990: >>Create [UT---C] "\", FILE_OPEN, CreateOptions=21, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=0000000000000498[PID=198c], DesiredAccess=100000, GrantedAccess=0, ShareAccess=3
java[TID=1984]: FFFFC305C8B4F990: <<Create IoStatus=c0000034[0]
java[TID=1984]: FFFFC305C8B4F990: >>Create [UT---C] "\", FILE_OPEN, CreateOptions=21, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=0000000000000488[PID=198c], DesiredAccess=100020, GrantedAccess=0, ShareAccess=3
java[TID=1984]: FFFFC305C8B4F990: <<Create IoStatus=c0000034[0]
java[TID=1984]: FFFFC305C8B4F990: >>Create [UT---C] "\", FILE_OPEN, CreateOptions=21, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=0000000000000488[PID=198c], DesiredAccess=100020, GrantedAccess=0, ShareAccess=3
java[TID=1984]: FFFFC305C8B4F990: <<Create IoStatus=c0000034[0]
java[TID=02a4]: FFFFC305C6E2AE00: >>Create [UT---C] "\", FILE_OPEN, CreateOptions=21, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=00000000000004C4[PID=f40], DesiredAccess=100000, GrantedAccess=0, ShareAccess=3
java[TID=02a4]: FFFFC305C6E2AE00: <<Create IoStatus=c0000034[0]
java[TID=02a4]: FFFFC305C6E2AE00: >>Create [UT---C] "\", FILE_OPEN, CreateOptions=21, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=00000000000004C4[PID=f40], DesiredAccess=100000, GrantedAccess=0, ShareAccess=3
java[TID=02a4]: FFFFC305C6E2AE00: <<Create IoStatus=c0000034[0]
java[TID=02a4]: FFFFC305C8D786D0: >>Create [UT---C] "\", FILE_OPEN, CreateOptions=21, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=0000000000000488[PID=f40], DesiredAccess=100000, GrantedAccess=0, ShareAccess=3
java[TID=02a4]: FFFFC305C8D786D0: <<Create IoStatus=c0000034[0]
java[TID=1984]: FFFFC305C9196760: >>Create [UT---C] "\", FILE_OPEN, CreateOptions=800021, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=00000000000004C4[PID=f40], DesiredAccess=100000, GrantedAccess=0, ShareAccess=0
java[TID=1984]: FFFFC305C9196760: <<Create IoStatus=c0000034[0]
java[TID=02a4]: FFFFC305C87D27C0: >>Create [UT---C] "\", FILE_OPEN, CreateOptions=800021, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=00000000000004C4[PID=f40], DesiredAccess=100000, GrantedAccess=0, ShareAccess=0
java[TID=02a4]: FFFFC305C87D27C0: <<Create IoStatus=c0000034[0]
java[TID=1984]: FFFFC305C9166D80: >>Create [UT---C] "\", FILE_OPEN, CreateOptions=21, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=00000000000004C4[PID=f40], DesiredAccess=100000, GrantedAccess=0, ShareAccess=3
java[TID=1984]: FFFFC305C9166D80: <<Create IoStatus=c0000034[0]
The service java has been stopped.
@ab3dat
Copy link

ab3dat commented May 10, 2019

Investigating this issue leads to the result that the connection to WinFSP is not broken.
IoStatus=c0000034[0] says, that the object cannot be found.

All you have to do is setting the correct file encoding. Java uses CP1252 as default encoding on Windows which only uses 1 byte per character. The interface in WinFSP expects UTF-8 encoding which is 1-4 bytes per character. This means that there are invalid characters in your path when trying to access the file system.
image

Simply change the file encoding in the IDE to UTF-8 or use the parameter -Dfile.encoding=UTF-8 when compiling in the commandline. This solves the issues.

@SerCeMan
Copy link
Owner

Hey, @ab3dat, @TriangularIT! Yes, sorry, I missed the issue initially. It's true, the encoding might need to be explicitly specified on windows, https://github.com/SerCeMan/jnr-fuse/blob/master/INSTALLATION.md#troubleshooting.

We might also need to add some runtime warnings to make sure there is some logging that warns abut the encoding at runtime.

@ab3dat
Copy link

ab3dat commented May 10, 2019

I just now saw that you already pointed to this issue in the troubleshooting section. I mean, I read that sentence quite a few times. Unfortunately the highlighted error service java has failed to start takes over the focus when reading and one totally ignores the rest of the sentence if you do not have that error.

A runtime warning would be a great solution.

@ab3dat
Copy link

ab3dat commented May 10, 2019

@SerCeMan I implemented a runtime warning now in AbstractFuseFS.java

            case WINDOWS:
        		if (!System.getProperty("file.encoding").equals("UTF-8"))
        		{	
        			System.out.println("UTF-8 encoding required! Current encoding: " + System.getProperty("file.encoding"));
        		}
        		String winFspPath = WinPathUtils.getWinFspPath();
            	libFuse = loader.load(winFspPath);
            	break;

In case Windows is detected as platform and the codepage is not UTF-8, a message will be printed in the command line.

image

Guess that should do it. If you are fine with this fix, I'm going to create a pull request.

@TriangularIT
Copy link
Author

Thank you, @ab3dat for your help! It all works – I have missed the warning on the Installation page! 🤦‍♂️

ab3dat added a commit to ab3dat/jnr-fuse that referenced this issue Jul 9, 2019
This implementation checks whether the UTF-8 file encoding is set when working on windows. If the wrong file encoding is set mounting the drive works, but accessing and working on it doesn't work.

Details see pull request SerCeMan#75
ab3dat added a commit to ab3dat/jnr-fuse that referenced this issue Jul 9, 2019
Replace output to stdout and throw exception if file encoding is not UTF-8 if running on Windows

Details see pull request SerCeMan#75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants