zargony / fuse-rs

Rust library for filesystems in userspace (FUSE)
MIT License
1.05k stars 131 forks source link

Examples panic if not providing any mount point #146

Open gsurrel opened 4 years ago

gsurrel commented 4 years ago

I have a panic with the two examples. I have installed fuse first with brew (with a reboot), then with the package provided on the website, but the behavior is the same:

Am I missing anything? I was following the readme at the project's root.

$ RUST_BACKTRACE=1 cargo run --example hello
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/examples/hello`
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', examples/hello.rs:94:22
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:472
  11: rust_begin_unwind
             at src/libstd/panicking.rs:380
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  13: core::panicking::panic
             at src/libcore/panicking.rs:52
  14: core::option::Option<T>::unwrap
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/macros/mod.rs:10
  15: hello::main
             at examples/hello.rs:94
  16: std::rt::lang_start::{{closure}}
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/rt.rs:67
  17: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  18: std::panicking::try::do_call
             at src/libstd/panicking.rs:305
  19: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:86
  20: std::panicking::try
             at src/libstd/panicking.rs:281
  21: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  22: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  23: std::rt::lang_start
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/rt.rs:67
  24: hello::main
gsurrel commented 4 years ago

Ah, reading the source, it seems it requires a mount path. I assumed it would take . by default. That means it works. Maybe the example can be either more descriptive (print a better error message) or automatic (if nothing is provided, mount .)