mgree / ffs

the file filesystem: mount semi-structured data (like JSON) as a Unix filesystem
https://mgree.github.io/ffs/
GNU General Public License v3.0
463 stars 14 forks source link

Invalid mount attempt leaves behind empty directory/member #42

Closed RaphaelWimmer closed 3 years ago

RaphaelWimmer commented 3 years ago

Trying to mount a JSON file within the virtual filesystem fails (which is ok, I guess):

raphael@tukk ~/Downloads> ./ffs -i ffs1.json raphael@tukk ~/Downloads> cat ffs1.json {"option":"test"} raphael@tukk ~/Downloads> cp ffs1.json ffs1/ raphael@tukk ~/Downloads> ls ffs1/ ffs1.json option raphael@tukk ~/Downloads> ./ffs -i ffs1/ffs1.json fusermount: bad mount point ffs1/ffs1: Permission denied thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/main.rs:38:41 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

This actually creates the subdirectory ffs1/ffs1 but does not mount anything there. Unmounting the filesystem results in an additional entry "ffs1: {}" in the json file. I'd suggest that a failed command should not leave behind any new files/members.

mgree commented 3 years ago

Thanks for this report! I patterned my test off of your example, so it should be good. Can you download a dev build and comment/re-open this if it's not fixed?