From 35f6bf81886539af4a91f8cbfdcaadb1eb61b21e Mon Sep 17 00:00:00 2001 From: Michael Greenberg Date: Sun, 26 Sep 2021 08:54:18 -0400 Subject: [PATCH] Fuser 0.9.1 (#49), in anticipation of ffs 0.1.2 Update to fuser=0.9 (i.e., 0.9.1). Update websites, version numbers, etc. for new release. Finally use `destroy` properly, got rid of the `Drop` impl for `FS`. Drop `AutoUnmount` which wasn't doing anything anyway. Fixes and improvements to CI, docs, and logging. --- CHANGELOG.md | 4 +++- Cargo.lock | 14 +++++++------- Cargo.toml | 4 ++-- docs/ffs.1.md | 5 +++-- docs/index.md | 2 +- man/ffs.1 | 4 +++- run_tests.sh | 9 +++++++-- src/fs.rs | 21 +++++---------------- src/main.rs | 1 - 9 files changed, 31 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20ed311..1bdf97e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # ffs - Changelog -## 0.?.? - UNRELEASED +## 0.1.2 - 2021-09-26 * Handle failed mounts better, with an appropriate message and error code. @@ -8,6 +8,8 @@ error. * `--time` flag for emitting timing information on STDERR. * Basic startup/shutdown benchmarking, with microbenchmarks. +* Upgrade to fuser 0.9.1. Concomitant bugfixes turn off AutoUnmount. +* Improvements/bugfixes in regression tests. ## 0.1.1 - 2021-07-15 diff --git a/Cargo.lock b/Cargo.lock index f49b6df..ef363de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,7 +88,7 @@ dependencies = [ [[package]] name = "ffs" -version = "0.1.1" +version = "0.1.2" dependencies = [ "base64", "clap", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "fuser" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "166e3212e0cc562dd17eefa4d80cf443720eec051e7171fe2b94e4ba8d272786" +checksum = "096c834eabc44f7151b8f17d28eb0501e30ea9139b4a2d64f33ad9ef4bdae8d3" dependencies = [ "libc", "log", @@ -493,9 +493,9 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6580539ad917b7c026220c4b3f2c08d52ce54d6ce0dc491e66002e35388fab46" +checksum = "5e59ec1d2457bd6c0dd89b50e7d9d6b0b647809bf3f0a59ac85557046950b7b2" dependencies = [ "byteorder", "zerocopy-derive", @@ -503,9 +503,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d498dbd1fd7beb83c86709ae1c33ca50942889473473d287d56ce4770a18edfb" +checksum = "0af017aca1fa6181f5dd7a802456fe6f7666ecdcc18d0910431f0fc89d474e51" dependencies = [ "proc-macro2", "syn", diff --git a/Cargo.toml b/Cargo.toml index 226d095..7af519c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ffs" -version = "0.1.1" +version = "0.1.2" authors = ["Michael Greenberg "] license = "GPL-3.0" description = "ffs---the File FileSystem---lets you mount semi-structured data (like JSON) as a filesystem, letting you work with modern formats using your familiar shell tools." @@ -27,7 +27,7 @@ exclude = [ [dependencies] base64 = "0.13.0" clap = "2.0" -fuser = "0.8" +fuser = "0.9" libc = "0.2.51" serde_json = "1.0" toml = "0.5" diff --git a/docs/ffs.1.md b/docs/ffs.1.md index 320e3a1..3422086 100644 --- a/docs/ffs.1.md +++ b/docs/ffs.1.md @@ -1,4 +1,4 @@ -% FFS(1) Version 0.1.1 | File Filesystem Documentation +% FFS(1) Version 0.1.2 | File Filesystem Documentation % Michael Greenberg # NAME @@ -240,7 +240,8 @@ RUST_LOG should probably be *ffs* and *level* should be one of *error*, *warn*, *info*, *debug*, or *trace*. The default is *ffs=warn*. Setting *-q* turns off all output; setting *-d* sets - *ffs=debug*. + *ffs=debug*. To get more information from FUSE bindings, add *fuser*, e.g., + *ffs=debug,fuser=info*. # EXIT STATUS diff --git a/docs/index.md b/docs/index.md index e020283..be02b26 100644 --- a/docs/index.md +++ b/docs/index.md @@ -100,7 +100,7 @@ download a single executable. These are the [latest development builds](https:// - [macOS]({{ site.github.macos_url }}) See the [release page](https://github.com/mgree/ffs/releases) for -particular releases; the current version is 0.1.1. You can also build +particular releases; the current version is 0.1.2. You can also build ffs from [source](https://github.com/mgree/ffs). # Related tools diff --git a/man/ffs.1 b/man/ffs.1 index 053dbbd..ba255ab 100644 --- a/man/ffs.1 +++ b/man/ffs.1 @@ -1,6 +1,6 @@ .\" Automatically generated by Pandoc 2.9.1.1 .\" -.TH "FFS" "1" "" "Version 0.1.1" "File Filesystem Documentation" +.TH "FFS" "1" "" "Version 0.1.2" "File Filesystem Documentation" .hy .SH NAME .PP @@ -237,6 +237,8 @@ probably be \f[I]ffs\f[R] and \f[I]level\f[R] should be one of The default is \f[I]ffs=warn\f[R]. Setting \f[I]-q\f[R] turns off all output; setting \f[I]-d\f[R] sets \f[I]ffs=debug\f[R]. +To get more information from FUSE bindings, add \f[I]fuser\f[R], e.g., +\f[I]ffs=debug,fuser=info\f[R]. .SH EXIT STATUS .TP 0 diff --git a/run_tests.sh b/run_tests.sh index 7305f16..7c3bb6b 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -23,7 +23,7 @@ for test in *.sh do tname="$(basename ${test%*.sh})" printf "========== STARTING TEST: $tname\n" - (RUST_LOG="ffs=debug"; export RUST_LOG; ./${test} >$LOG/$tname.out 2>$LOG/$tname.nerr; echo $?>$LOG/$tname.ec) & + (RUST_LOG="ffs=debug,fuser=debug"; export RUST_LOG; ./${test} >$LOG/$tname.out 2>$LOG/$tname.err; echo $?>$LOG/$tname.ec) & : $((TOTAL += 1)) # don't slam 'em @@ -43,12 +43,17 @@ do printf "========== PASSED: $tname\n" else printf "========== FAILED: $tname (ec=$(cat $LOG/$tname.ec))\n" + : $((FAILED += 1)) + fi + + # just always capture output in the CI logs + if [ "$(cat $LOG/$tname.ec)" -ne 0 ] || [ "$CI" ] + then printf "<<<<<<<<<< STDOUT\n" cat $LOG/$tname.out printf "<<<<<<<<<< STDERR\n" cat $LOG/$tname.err printf "\n" - : $((FAILED += 1)) fi done diff --git a/src/fs.rs b/src/fs.rs index 4040404..883f1fe 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -169,7 +169,7 @@ impl FS { /// /// - if `self.config.output == Output::Stdout` and `last_sync == false`, /// nothing will happen (to prevent redundant writes to STDOUT) - #[instrument(level = "debug", skip(self), fields(synced = self.dirty.get(), dirty = self.dirty.get()))] + #[instrument(level = "debug", skip(self), fields(synced = self.synced.get(), dirty = self.dirty.get()))] pub fn sync(&self, last_sync: bool) { info!("called"); trace!("{:?}", self.inodes); @@ -347,14 +347,6 @@ impl FromStr for DirType { } } -impl Drop for FS { - /// Synchronizes the `FS`, calling `FS::sync` with `last_sync == true`. - #[instrument(level = "debug", skip(self), fields(dirty = self.dirty.get()))] - fn drop(&mut self) { - self.sync(true); // last sync - } -} - // ENOATTR is deprecated on Linux, so we should use ENODATA #[cfg(target_os = "linux")] const ENOATTR: i32 = libc::ENODATA; @@ -362,14 +354,11 @@ const ENOATTR: i32 = libc::ENODATA; const ENOATTR: i32 = libc::ENOATTR; impl Filesystem for FS { - #[instrument(level = "debug", skip(self, _req), fields(dirty = self.dirty.get()))] - fn destroy(&mut self, _req: &Request) { + /// Synchronizes the `FS`, calling `FS::sync` with `last_sync == true`. + #[instrument(level = "debug", skip(self), fields(dirty = self.dirty.get()))] + fn destroy(&mut self) { info!("called"); - // It WOULD make sense to call `sync` here, but this function doesn't - // seem to be called on Linux... so we call `self.sync(true)` in - // `Drop::drop`, instead. - // - // See https://github.com/cberner/fuser/issues/153 + self.sync(true); } #[instrument(level = "debug", skip(self, _req, reply))] diff --git a/src/main.rs b/src/main.rs index 4b14e38..9b98c51 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,6 @@ use fuser::MountOption; fn main() { let config = Config::from_args(); let mut options = vec![ - MountOption::AutoUnmount, MountOption::FSName(format!("{}", config.input)), ]; if config.read_only {