Skip to content

Add Fuse mounting support.#33

Merged
overheadhunter merged 1 commit into
cryptomator:developfrom
ndob:add_fuse_support
Aug 26, 2020
Merged

Add Fuse mounting support.#33
overheadhunter merged 1 commit into
cryptomator:developfrom
ndob:add_fuse_support

Conversation

@ndob
Copy link
Copy Markdown
Contributor

@ndob ndob commented Aug 20, 2020

Add support for mounting vaults to filesystem with fuse-nio-adapter.

Tested on Linux.

Fixes #25.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Aug 20, 2020

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Member

@overheadhunter overheadhunter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat PR. Just two remarks from my side.

Comment on lines +111 to +114
private static WebDav initWebDavServer(Args args) {
WebDav server = null;
if (args.hasValidWebDavConf()) {
server = new WebDav(args.getBindAddr(), args.getPort());
}
return server;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better return an Optional<WebDav> instead of null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to Optional.

Comment on lines +122 to +125
try {
while (true) {
System.in.read();
}
} catch (IOException e) {
e.printStackTrace();
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to retain the previous functionality for FUSE mounts (if no WebDAV server is not running): Starting the app mounts the vault and ctrl-c quits the app + umounts. If there is no loop for stdin it just quits the app immediately.

Please let me know if you have suggestions how to achieve this more cleanly!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please let me know if you have suggestions how to achieve this more cleanly!

You can run FUSE in "blocking mode" (second argument of the mount method), but you'd need to also overload the Mounter's mount method, as blocking is currently always false:

https://github.com/cryptomator/fuse-nio-adapter/blob/develop/src/main/java/org/cryptomator/frontend/fuse/mount/LinuxMounter.java#L22

I'd prefer this approach but leave it open to you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. I have a couple of concerns, though. Please let me know if they are valid:

  • If I mount in blocking mode it implies that I can only have a single FUSE mount when running the CLI-app, right? Or surely I could add some threading, but that would IMO complicate this app unnecessarily. With the current approach there can be multiple simultaneous FUSE and/or WebDAV mounts running with a single CLI-app instance and the logic is fairly straight forward.
  • What is the release cadence of fuse-nio-adapter? I mean if I make a pull request, when will it be available in Maven?
  • I probably should also make similar changes to MacMounter.java. I currently do not have means to test that it works.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I mount in blocking mode it implies that I can only have a single FUSE mount when running the CLI-app, right? Or surely I could add some threading, but that would IMO complicate this app unnecessarily. With the current approach there can be multiple simultaneous FUSE and/or WebDAV mounts running with a single CLI-app instance and the logic is fairly straight forward.

You're right. You can only have a single mount in this case. Ctrl+C will unmount it and end the process.

What is the release cadence of fuse-nio-adapter? I mean if I make a pull request, when will it be available in Maven?

It can be released any time, there is no schedule we need to follow. It is just a matter of tagging and letting CI do its job.

I probably should also make similar changes to MacMounter.java. I currently do not have means to test that it works.

MacMounter has the same boolean flag, which works the same way. I have already tested it locally.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I think I would then keep this functionality as it is currently implemented as the previous WebDAV implementation also supports multiple mounts. Now you can basically add any number of WebDAV and/or FUSE mounts with a single instance.

From my side this PR is ready to be merged now in case it's fine for you too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now you can basically add any number of WebDAV and/or FUSE mounts with a single instance.

I still think this is a debatable feature, since you can as well spawn multiple processes and thus have better control over each mounted vault. However, this is out of scope of this PR and should be discussed in a separate issue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might this cause #35?

@ndob ndob force-pushed the add_fuse_support branch from 59f60bf to 197b9ad Compare August 21, 2020 19:22
@ndob
Copy link
Copy Markdown
Contributor Author

ndob commented Aug 21, 2020

Thanks for the feedback @overheadhunter ! Please let me know if you have other improvement ideas.

@ndob ndob force-pushed the add_fuse_support branch from 197b9ad to 9976fb8 Compare August 21, 2020 19:34
@overheadhunter
Copy link
Copy Markdown
Member

Please let me know if you have other improvement ideas.

Well you have a lot of places where you simply e.printStackTrace() and then proceed in the program as if there was no error. Why don't you let the error propagate back to the caller?

@ndob ndob force-pushed the add_fuse_support branch from 9976fb8 to 6bc57db Compare August 24, 2020 19:26
@ndob
Copy link
Copy Markdown
Contributor Author

ndob commented Aug 24, 2020

Please let me know if you have other improvement ideas.

Well you have a lot of places where you simply e.printStackTrace() and then proceed in the program as if there was no error. Why don't you let the error propagate back to the caller?

True. Added some better handling/logging. I prefer keeping the org.cryptomator.frontend.fuse.mount namespaced Exceptions (CommandException) contained in FuseMount-class.

overheadhunter added a commit to cryptomator/fuse-nio-adapter that referenced this pull request Aug 25, 2020
…ug, EnvironmentVariables envVars)` to Mounter

(might be required by cryptomator/cli#33)
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

Successfully merging this pull request may close these issues.

FUSE support for linux?

3 participants