cberner / fuser

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

Logic error in simple.rs #168

Closed hellow554 closed 3 years ago

hellow554 commented 3 years ago

Running the simple example: cargo run --example simple -- -vvvvvvv --mount-point /tmp/tmp.vvpWpL7CNz/

and executing touch tmp.vvpWpL7CNz/a; touch tmp.vvpWpL7CNz/b (where a and b are non exiting directories) will result in

[2021-07-22T12:51:40.832444400Z INFO  fuser::session] Mounting /tmp/tmp.vvpWpL7CNz/
[2021-07-22T12:51:40.833270400Z DEBUG fuser::request] FUSE(  2) ino 0x0000000000000000 INIT kernel ABI 7.31, capabilities 0x3fffffb, max readahead 131072
[2021-07-22T12:51:40.833455700Z DEBUG fuser::request] INIT response: ABI 7.8, flags 0x1, max readahead 131072, max write 16777216
[2021-07-22T12:51:41.500178000Z DEBUG fuser::request] FUSE(  4) ino 0x0000000000000001 LOOKUP name "a"
[2021-07-22T12:51:41.500772800Z DEBUG fuser::request] FUSE(  6) ino 0x0000000000000001 LOOKUP name "b"
[2021-07-22T12:51:41.502478600Z DEBUG fuser::request] FUSE(  8) ino 0x0000000000000001 LOOKUP name "a"
[2021-07-22T12:51:41.502737600Z DEBUG fuser::request] FUSE( 10) ino 0x0000000000000001 CREATE name "a", mode 0o100644, flags 0x8841
[2021-07-22T12:51:41.502814300Z DEBUG simple] create() called with 1 "a"
[2021-07-22T12:51:41.503143800Z DEBUG fuser::request] FUSE( 12) ino 0x0000000000000002 FLUSH fh FileHandle(4611686018427387905), lock owner LockOwner(17644300273756746576)
[2021-07-22T12:51:41.503319100Z DEBUG fuser::request] FUSE( 14) ino 0x0000000000000002 SETATTR mode: None, uid: None, gid: None, size: None, atime: Some(SpecificTime(SystemTime { tv_sec: 1626958301, tv_nsec: 490000000 })), mtime: Some(SpecificTime(SystemTime { tv_sec: 1626958301, tv_nsec: 490000000 })), ctime: None, file_handle: None, crtime: None, chgtime: None, bkuptime: None, flags: None
[2021-07-22T12:51:41.503501200Z DEBUG simple] utimens() called with 2, atime=SpecificTime(SystemTime { tv_sec: 1626958301, tv_nsec: 490000000 })
[2021-07-22T12:51:41.503623000Z DEBUG simple] utimens() called with 2, mtime=SpecificTime(SystemTime { tv_sec: 1626958301, tv_nsec: 490000000 })
[2021-07-22T12:51:41.503779200Z DEBUG fuser::request] FUSE( 16) ino 0x0000000000000002 RELEASE fh FileHandle(4611686018427387905), flags 0x8801, flush false, lock owner Some(LockOwner(0))
thread 'main' panicked at 'attempt to subtract with overflow', examples/simple.rs:1462:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2021-07-22T12:51:41.503982600Z WARN  fuser::reply] Reply not sent for operation 16, replying with I/O error
[2021-07-22T12:51:41.504041100Z INFO  fuser::session] Unmounted /tmp/tmp.vvpWpL7CNz/
fusermount3: /tmp/tmp.vvpWpL7CNz not mounted

which means there's probably a logic error somewhere in "simple.rs" (I don't think that you can call a >2k loc file "simple" anymore :D )