diff --git a/.github/workflows/build_and_tests_reusable.yml b/.github/workflows/build_and_tests_reusable.yml index 0f7bc01..5507f66 100644 --- a/.github/workflows/build_and_tests_reusable.yml +++ b/.github/workflows/build_and_tests_reusable.yml @@ -18,8 +18,8 @@ jobs: - name: build run: | - cargo build --all-targets --all-features - cargo build --release --all-targets --all-features + cargo build --all-targets --all-features --target x86_64-unknown-linux-gnu + cargo build --release --all-targets --all-features --target x86_64-unknown-linux-gnu - name: fmt check run: cargo fmt --all --check @@ -28,7 +28,15 @@ jobs: run: cargo check --all-targets - name: tests - run: cargo test --release --all-features + run: cargo test --release --all-features --target x86_64-unknown-linux-gnu - name: test publish - run: cargo publish --dry-run --allow-dirty + run: cargo publish --dry-run --allow-dirty --target x86_64-unknown-linux-gnu + + - name: test publish + run: cargo publish --dry-run --allow-dirty --target x86_64-unknown-linux-gnu + + - name: test package + run: | + cargo aur + cargo generate-rpm diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 4430682..f6217ec 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -7,7 +7,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - + env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 # TODO: remove this when we cache the builds @@ -16,19 +16,19 @@ jobs: clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Setup Rust - run: rustup update + - name: Setup Rust + run: rustup update - - name: build - run: cargo build --all --release + - name: build + run: cargo build --all --release --target x86_64-unknown-linux-gnu - - name: fmt check - run: cargo fmt --all -- --check + - name: fmt check + run: cargo fmt --all -- --check - - name: check - run: cargo check --all --release + - name: check + run: cargo check --all --release - - name: clippy - run: cargo clippy --all + - name: clippy + run: cargo clippy --all diff --git a/Cargo.lock b/Cargo.lock index 2ee0873..73ab2d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1614,7 +1614,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rencfs" -version = "0.13.55" +version = "0.13.56" dependencies = [ "anyhow", "argon2", diff --git a/Cargo.toml b/Cargo.toml index 99542be..f2dda6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ depends = ["fuse3"] files = [ ["LICENSE-Apache-2.0", "/usr/share/licenses/$pkgname/LICENSE-Apache-2.0"], ["LICENSE-MIT", "/usr/share/licenses/$pkgname/LICENSE-MIT"], - # ["LICENSE-BSD-3-Clause", "/usr/share/licenses/$pkgname/LICENSE-BSD-3-Clause"] + ["LICENSE-BSD-3-Clause", "/usr/share/licenses/$pkgname/LICENSE-BSD-3-Clause"] ] [package.metadata.generate-rpm] diff --git a/check-before-push.bat b/check-before-push.bat index 9c317bf..6883e75 100755 --- a/check-before-push.bat +++ b/check-before-push.bat @@ -1,20 +1,29 @@ cargo build --all --all-features if %errorlevel% neq 0 exit /b %errorlevel% -cargo build --release --all --all-features +cargo build --all --all-features --target x86_64-unknown-linux-gnu +if %errorlevel% neq 0 exit /b %errorlevel% + +cargo build --release --all --all-features --target x86_64-unknown-linux-gnu if %errorlevel% neq 0 exit /b %errorlevel% cargo fmt --all -- --check if %errorlevel% neq 0 exit /b %errorlevel% -cargo check --all +cargo check --all --target x86_64-unknown-linux-gnu +if %errorlevel% neq 0 exit /b %errorlevel% + +cargo clippy --all --target x86_64-unknown-linux-gnu if %errorlevel% neq 0 exit /b %errorlevel% -cargo clippy --all +cargo test --release --all --all-features --target x86_64-unknown-linux-gnu if %errorlevel% neq 0 exit /b %errorlevel% -cargo test --release --all --all-features +cargo publish --dry-run --allow-dirty --target x86_64-unknown-linux-gnu if %errorlevel% neq 0 exit /b %errorlevel% -cargo publish --dry-run --allow-dirty -if %errorlevel% neq 0 exit /b %errorlevel% \ No newline at end of file +cargo aur +if %errorlevel% neq 0 exit /b %errorlevel% + +cargo generate-rpm +if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/check-before-push.sh b/check-before-push.sh index 3b71675..3441c9d 100755 --- a/check-before-push.sh +++ b/check-before-push.sh @@ -2,10 +2,12 @@ set -e -cargo build --all --all-features -cargo build --release --all --all-features +cargo build --all --all-features --target x86_64-unknown-linux-gnu +cargo build --release --all --all-features --target x86_64-unknown-linux-gnu cargo fmt --all -- --check -cargo check --all -cargo clippy --all -cargo test --release --all --all-features -cargo publish --dry-run --allow-dirty +cargo check --all --target x86_64-unknown-linux-gnu +cargo clippy --all --target x86_64-unknown-linux-gnu +cargo test --release --all --all-features --target x86_64-unknown-linux-gnu +cargo publish --dry-run --allow-dirty --target x86_64-unknown-linux-gnu +cargo aur +cargo generate-rpm diff --git a/src/encryptedfs.rs b/src/encryptedfs.rs index c304985..d6fe248 100644 --- a/src/encryptedfs.rs +++ b/src/encryptedfs.rs @@ -1242,7 +1242,8 @@ impl EncryptedFs { let fhs = self.opened_files_for_read.read().await.get(&ino).cloned(); if let Some(fhs) = fhs { for fh in fhs { - if let Some(ctx) = self.read_handles.read().await.get(&fh) { + let lock = self.read_handles.read().await; + if let Some(ctx) = lock.get(&fh) { let set_atr: SetFileAttr = ctx.lock().await.attr.clone().into(); merge_attr(&mut attr, &set_atr, false); } @@ -1255,7 +1256,8 @@ impl EncryptedFs { if open_writes { let fh = self.opened_files_for_write.read().await.get(&ino).copied(); if let Some(fh) = fh { - if let Some(ctx) = self.write_handles.read().await.get(&fh) { + let lock = self.write_handles.read().await; + if let Some(ctx) = lock.get(&fh) { let ctx = ctx.lock().await; merge_attr(&mut attr, &ctx.attr.clone().into(), false); } @@ -1552,8 +1554,10 @@ impl EncryptedFs { // in the case of directory or if the file was crated without being opened we don't use a handle return Ok(()); } - let mut valid_fh = self.read_handles.read().await.get(&handle).is_some(); - if let Some(ctx) = self.write_handles.read().await.get(&handle) { + let lock = self.read_handles.read().await; + let mut valid_fh = lock.get(&handle).is_some(); + let lock = self.write_handles.read().await; + if let Some(ctx) = lock.get(&handle) { let mut ctx = ctx.lock().await; let lock = self .read_write_locks @@ -1970,7 +1974,8 @@ impl EncryptedFs { let path = self.contents_path(ino); // read - if let Some(set) = self.opened_files_for_read.read().await.get(&ino) { + let lock = self.opened_files_for_read.read().await; + if let Some(set) = lock.get(&ino) { for handle in set .iter() .filter(|h| skip_write_fh.map_or(true, |fh| **h != fh)) @@ -1989,13 +1994,15 @@ impl EncryptedFs { } // write - if let Some(fh) = self.opened_files_for_write.read().await.get(&ino) { + let lock = self.opened_files_for_write.read().await; + if let Some(fh) = lock.get(&ino) { if let Some(handle) = skip_write_fh { if *fh == handle { return Ok(()); } } - if let Some(lock) = self.write_handles.read().await.get(fh) { + let lock = self.write_handles.read().await; + if let Some(lock) = lock.get(fh) { let mut ctx = lock.lock().await; let writer = ctx.writer.as_mut().unwrap(); let file = writer.finish()?; diff --git a/src/expire_value.rs b/src/expire_value.rs index 4809d3b..f094c01 100644 --- a/src/expire_value.rs +++ b/src/expire_value.rs @@ -67,7 +67,8 @@ impl< } async fn get_from_ref_or_cache(&self) -> Option> { - if let Some(ref weak) = *self.weak.read().await { + let lock = self.weak.read().await; + if let Some(ref weak) = *lock { // try to take it from weak ref if let Some(ref v) = weak.upgrade() { return Some(v.clone());