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

[FUSE API] invalid command line options are ignored instead of causing an error #516

Open
mhx opened this issue Jul 1, 2023 · 4 comments

Comments

@mhx
Copy link

mhx commented Jul 1, 2023

Bug Report

Running a FUSE driver on Linux with an invalid option:

$ ./dwarfs boost.dwarfs mnt -oasdfasdf
fuse: unknown option(s): `-o asdfasdf'

The same on Windows using WinFsp:

C:\Users\mhx\git\dwarfs\build-vcpkg>.\dwarfs.exe boost.dwarfs mnt -oasdfasdf
The service dwarfs has been started.

In particular, even valid options with invalid values just seem to be ignored (it's hard to tell due to the lack of feedback):

C:\Users\mhx\git\dwarfs\build-vcpkg>.\dwarfs.exe boost.dwarfs mnt -oumask=foobar
The service dwarfs has been started.

For options internal to my FUSE driver, invalid values are actually handled:

C:\Users\mhx\git\dwarfs\build-vcpkg>.\dwarfs.exe boost.dwarfs mnt -odebuglevel=foo
error: invalid logger level: foo

How to Reproduce

See above.

Behaviors

I'd expect both invalid options as well as invalid values for valid options to cause an error to be reported.

Environment

  • OS version and build: 10.0.22621
  • WinFsp version and build: 2.0.23075
@billziss-gh
Copy link
Collaborator

I believe this was done on purpose. I do not recall the exact reason why, but I believe this was to match the behavior of OSXFUSE at the time the WinFsp-FUSE layer was written.

(I seem to recall that I was porting an OSXFUSE file system to Windows at the time, which relied on the OSXFUSE libfuse command line parser ignoring unknown options. I may also be completely hallucinating this as it has been 7+ years since this work was done.)

@mhx
Copy link
Author

mhx commented Aug 7, 2023

Thanks for getting back!

Interesting. If failing is not a option for whatever reason, maybe as least a warning could be added in case an invalid option is being ignored?

@billziss-gh
Copy link
Collaborator

A warning might make sense.

BTW, are you using fuse_main/fuse_main_real? Because if you are not, you have control of the options you accept via fuse_opt_parse.

@mhx
Copy link
Author

mhx commented Aug 7, 2023

BTW, are you using fuse_main/fuse_main_real? Because if you are not, you have control of the options you accept via fuse_opt_parse.

I am using all of fuse_opt_parse, fuse_parse_cmdline and fuse_main.

However, I can't decide if an option like umask that is internal to the FUSE layer is valid or not. That's for the FUSE layer to decide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants
@mhx @billziss-gh and others