cberner / fuser

Filesystem in Userspace (FUSE) for Rust
MIT License
835 stars 114 forks source link

SetAttr crtime error on macos #217

Open ykxVK8yL5L opened 2 years ago

ykxVK8yL5L commented 2 years ago

When i set FileAttr of crtime to SystemTime::now() in the create function, the compiler give me error:thread 'main' panicked at 'overflow when adding duration to instant', library/std/src/time.rs:584:31. that's the full TRACE:

stack backtrace:
   0:        0x10a3a7a74 - std::backtrace_rs::backtrace::libunwind::trace::hee82a97921985ffc
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:        0x10a3a7a74 - std::backtrace_rs::backtrace::trace_unsynchronized::hd2f3f197f68d4196
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x10a3a7a74 - std::sys_common::backtrace::_print_fmt::hef7f7070435a43cf
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:66:5
   3:        0x10a3a7a74 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6ab6a4b798848da1
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:45:22
   4:        0x10a3c414b - core::fmt::write::h3cfeb2e4a41b5943
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/fmt/mod.rs:1196:17
   5:        0x10a3a2188 - std::io::Write::write_fmt::h207c490a0e714424
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/io/mod.rs:1654:15
   6:        0x10a3a932d - std::sys_common::backtrace::_print::h2c39637d8acc9668
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:48:5
   7:        0x10a3a932d - std::sys_common::backtrace::print::ha24f17eeb0536253
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:35:9
   8:        0x10a3a932d - std::panicking::default_hook::{{closure}}::h2dad0ca14a5f6fb3
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:295:22
   9:        0x10a3a9011 - std::panicking::default_hook::he28ca1b524a71648
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:314:9
  10:        0x10a3a98ae - std::panicking::rust_panic_with_hook::hc50fd680dab3e13f
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:698:17
  11:        0x10a3a97a3 - std::panicking::begin_panic_handler::{{closure}}::h73da24fc37eba97b
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:588:13
  12:        0x10a3a7ef7 - std::sys_common::backtrace::__rust_end_short_backtrace::hff104f8fa804dc90
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:138:18
  13:        0x10a3a947a - rust_begin_unwind
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5
  14:        0x10a3e3163 - core::panicking::panic_fmt::hf5e95a7953f70bca
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14
  15:        0x10a3c1e4b - core::panicking::panic_display::hc57c13fbe332f5e8
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:72:5
  16:        0x10a3c1dfc - core::panicking::panic_str::h3bbc57af2d14b509
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:56:5
  17:        0x10a3e2ff9 - core::option::expect_failed::had3cf339f5a7c17b
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/option.rs:1854:5
  18:        0x10a3a77d6 - core::option::Option<T>::expect::h08bb8dad6c7db613
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/option.rs:718:21
  19:        0x10a3a77d6 - <std::time::SystemTime as core::ops::arith::Add<core::time::Duration>>::add::hc334e798d72db88c
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/time.rs:584:9
  20:        0x10a1ea4ee - fuser::ll::request::op::SetAttr::crtime::h75023184b032eecb
                               at /Users/coder/.cargo/registry/src/github.com-1ecc6299db9ec823/fuser-0.11.0/src/ll/request.rs:417:21
  21:        0x1099b239f - fuser::request::Request::dispatch_req::h111fc8e12f25c8b7
                               at /Users/coder/.cargo/registry/src/github.com-1ecc6299db9ec823/fuser-0.11.0/src/request.rs:223:21
  22:        0x1099b3380 - fuser::request::Request::dispatch::h6bb17fa07d659537
                               at /Users/coder/.cargo/registry/src/github.com-1ecc6299db9ec823/fuser-0.11.0/src/request.rs:56:25
  23:        0x1099b929a - fuser::session::Session<FS>::run::h3c530573062220f1
                               at /Users/coder/.cargo/registry/src/github.com-1ecc6299db9ec823/fuser-0.11.0/src/session.rs:132:34
  24:        0x1099864f1 - fuser::mount2::{{closure}}::h98d3ef2e670e4e40
                               at /Users/coder/.cargo/registry/src/github.com-1ecc6299db9ec823/fuser-0.11.0/src/lib.rs:992:78
  25:        0x1099795e4 - core::result::Result<T,E>::and_then::h449456aa54009e4a
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/result.rs:1332:22
  26:        0x10998648a - fuser::mount2::h85e2d68e49f480b6
                               at /Users/coder/.cargo/registry/src/github.com-1ecc6299db9ec823/fuser-0.11.0/src/lib.rs:992:5
  27:        0x10996e6ed - pikpak_fuse::main::hf39fa054824bd48a
                               at /Users/coder/Desktop/pikpak-fuse/src/main.rs:101:5
  28:        0x1099b443e - core::ops::function::FnOnce::call_once::hca44c1b465dfcf93
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/function.rs:248:5
  29:        0x1099e2781 - std::sys_common::backtrace::__rust_begin_short_backtrace::haf809f4f9b12e149
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:122:18
  30:        0x1099b9404 - std::rt::lang_start::{{closure}}::h4109673dd3e864e0
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/rt.rs:145:18
  31:        0x10a39c90e - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h95efaa71c50a181d
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/function.rs:280:13
  32:        0x10a39c90e - std::panicking::try::do_call::h9e262f45d279a668
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:492:40
  33:        0x10a39c90e - std::panicking::try::hcfa2ff7c3ef05946
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:456:19
  34:        0x10a39c90e - std::panic::catch_unwind::h6e5f05af2d5ed125
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panic.rs:137:14
  35:        0x10a39c90e - std::rt::lang_start_internal::{{closure}}::ha6428ebd453bcc4b
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/rt.rs:128:48
  36:        0x10a39c90e - std::panicking::try::do_call::h1897e56454854402
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:492:40
  37:        0x10a39c90e - std::panicking::try::h18317894fcdd1ee4
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:456:19
  38:        0x10a39c90e - std::panic::catch_unwind::h953eb8e106926f6b
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panic.rs:137:14
  39:        0x10a39c90e - std::rt::lang_start_internal::h3a2ed64a839cce39
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/rt.rs:128:20
  40:        0x1099b93de - std::rt::lang_start::haeba9a9e39b4099e
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/rt.rs:144:17
  41:        0x109970cc6 - _main

rust version: rustc 1.62.0 (a8314ef7d 2022-06-27)

By the way: as i failed at create file, so the write function never worked. Can you provide an example of write data to server. Help please. Thank you very much.

ykxVK8yL5L commented 2 years ago

There is something wrong for my code . sorry for the issue.

ykxVK8yL5L commented 2 years ago

😂 not my code fault.

FirelightFlagboy commented 2 days ago

I'm having the same issue with fuser@0.15.0:

Stacktrace ``` thread '' panicked at library/std/src/time.rs:601:31: overflow when adding duration to instant stack backtrace: 0: rust_begin_unwind at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5 1: core::panicking::panic_fmt at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14 2: core::panicking::panic_display at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:264:5 3: core::option::expect_failed at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/option.rs:2030:5 4: core::option::Option::expect at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/option.rs:933:21 5: >::add at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/time.rs:601:31 6: fuser::ll::request::op::SetAttr::crtime at [redacted]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuser-0.15.0/src/ll/request.rs:431:21 7: ::fmt at [redacted]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuser-0.15.0/src/ll/request.rs:487:17 8: core::fmt::rt::Argument::fmt at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/rt.rs:173:76 9: core::fmt::run at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/mod.rs:1232:14 10: core::fmt::write at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/mod.rs:1199:26 11: core::fmt::Formatter::write_fmt at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/mod.rs:1654:13 12: ::fmt 13: core::fmt::rt::Argument::fmt at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/rt.rs:173:76 14: core::fmt::write at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/mod.rs:1182:21 15: core::fmt::rt::Argument::fmt at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/rt.rs:173:76 16: core::fmt::write at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/mod.rs:1182:21 17: std::io::Write::write_fmt at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/io/mod.rs:1827:15 18: env_logger::fmt::DefaultFormat::write_args at [redacted]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/env_logger-0.10.2/src/fmt/mod.rs:448:21 19: env_logger::fmt::DefaultFormat::write at [redacted]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/env_logger-0.10.2/src/fmt/mod.rs:297:9 20: env_logger::fmt::Builder::build::{{closure}} at [redacted]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/env_logger-0.10.2/src/fmt/mod.rs:249:17 21: as core::ops::function::Fn>::call at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2084:9 22: ::log::{{closure}} at [redacted]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/env_logger-0.10.2/src/logger.rs:625:21 23: ::log::{{closure}} at [redacted]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/env_logger-0.10.2/src/logger.rs:644:33 24: std::thread::local::LocalKey::try_with at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/thread/local.rs:283:12 25: ::log at [redacted]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/env_logger-0.10.2/src/logger.rs:631:27 26: log::__private_api::log_impl at [redacted]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/log-0.4.22/src/__private_api.rs:61:5 27: fuser::request::Request::dispatch at [redacted]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuser-0.15.0/src/request.rs:56:9 28: fuser::session::Session::run at [redacted]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuser-0.15.0/src/session.rs:158:34 29: libparsec_platform_mountpoint::unix::mount::Mountpoint::mount::{{closure}}::{{closure}}::{{closure}} at ./libparsec/crates/platform_mountpoint/src/unix/mount.rs:75:59 ```

The panic is raised from this line:

https://github.com/cberner/fuser/blob/e18bd9bf9071ecd8be62993726e06ff11d6ec709/src/ll/request.rs#L431

That is caused by the debug display at:

https://github.com/cberner/fuser/blob/e18bd9bf9071ecd8be62993726e06ff11d6ec709/src/request.rs#L56

ykxVK8yL5L commented 2 days ago

I'm having the same issue with fuser@0.15.0:

Stacktrace The panic is raised from this line:

https://github.com/cberner/fuser/blob/e18bd9bf9071ecd8be62993726e06ff11d6ec709/src/ll/request.rs#L431

That is caused by the debug display at:

https://github.com/cberner/fuser/blob/e18bd9bf9071ecd8be62993726e06ff11d6ec709/src/request.rs#L56

I’ve given up this 😂