From dcc226c5092b751374fd449603d9c3e5d652896f Mon Sep 17 00:00:00 2001 From: gwenn Date: Sun, 21 Jul 2024 16:09:21 +0200 Subject: [PATCH 1/8] Fix clippy warnings --- .github/workflows/main.yml | 2 +- libsqlite3-sys/src/lib.rs | 2 +- src/hooks/mod.rs | 2 +- src/hooks/preupdate_hook.rs | 4 ++-- src/types/time.rs | 1 + src/vtab/mod.rs | 4 ++-- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 312169885..6a8e775e3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -202,7 +202,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: - components: 'llvm-tools-preview' + components: "llvm-tools-preview" - uses: taiki-e/install-action@main with: tool: grcov diff --git a/libsqlite3-sys/src/lib.rs b/libsqlite3-sys/src/lib.rs index 6b42e2a75..75c031d61 100644 --- a/libsqlite3-sys/src/lib.rs +++ b/libsqlite3-sys/src/lib.rs @@ -21,7 +21,7 @@ pub fn SQLITE_TRANSIENT() -> sqlite3_destructor_type { Some(unsafe { mem::transmute::(-1_isize) }) } -#[allow(clippy::all)] +#[allow(dead_code, clippy::all)] mod bindings { include!(concat!(env!("OUT_DIR"), "/bindgen.rs")); } diff --git a/src/hooks/mod.rs b/src/hooks/mod.rs index 28aac9892..5da159b40 100644 --- a/src/hooks/mod.rs +++ b/src/hooks/mod.rs @@ -372,7 +372,7 @@ impl Connection { /// The callback parameters are: /// /// - the type of database update (`SQLITE_INSERT`, `SQLITE_UPDATE` or - /// `SQLITE_DELETE`), + /// `SQLITE_DELETE`), /// - the name of the database ("main", "temp", ...), /// - the name of the table that is updated, /// - the ROWID of the row that is updated. diff --git a/src/hooks/preupdate_hook.rs b/src/hooks/preupdate_hook.rs index 57ea17404..a8f625a3b 100644 --- a/src/hooks/preupdate_hook.rs +++ b/src/hooks/preupdate_hook.rs @@ -128,7 +128,7 @@ impl Connection { /// - the name of the database ("main", "temp", ...), /// - the name of the table that is updated, /// - a variant of the PreUpdateCase enum which allows access to extra functions depending - /// on whether it's an update, delete or insert. + /// on whether it's an update, delete or insert. #[inline] pub fn preupdate_hook(&self, hook: Option) where @@ -152,7 +152,7 @@ impl InnerConnection { /// let mut called = std::sync::atomic::AtomicBool::new(false); /// db.preupdate_hook(Some(|action, db: &str, tbl: &str, case: &PreUpdateCase| { /// called.store(true, std::sync::atomic::Ordering::Relaxed); - /// })); + /// })); /// } /// db.execute_batch("CREATE TABLE foo AS SELECT 1 AS bar;") /// } diff --git a/src/types/time.rs b/src/types/time.rs index 265d6c6bd..404c80d4d 100644 --- a/src/types/time.rs +++ b/src/types/time.rs @@ -7,6 +7,7 @@ //! - Format 2: "YYYY-MM-DD HH:MM" //! - Format 5: "YYYY-MM-DDTHH:MM" //! - Format 8: "HH:MM" +//! //! without an explicit second value will assume 0 seconds. //! Time String that contain an optional timezone without an explicit date are unsupported. //! All other assumptions described in [Time Values](https://sqlite.org/lang_datefunc.html#time_values) section are unsupported. diff --git a/src/vtab/mod.rs b/src/vtab/mod.rs index 1379bf277..2b83f4f4d 100644 --- a/src/vtab/mod.rs +++ b/src/vtab/mod.rs @@ -3,10 +3,10 @@ //! Follow these steps to create your own virtual table: //! 1. Write implementation of [`VTab`] and [`VTabCursor`] traits. //! 2. Create an instance of the [`Module`] structure specialized for [`VTab`] -//! impl. from step 1. +//! impl. from step 1. //! 3. Register your [`Module`] structure using [`Connection::create_module`]. //! 4. Run a `CREATE VIRTUAL TABLE` command that specifies the new module in the -//! `USING` clause. +//! `USING` clause. //! //! (See [SQLite doc](http://sqlite.org/vtab.html)) use std::borrow::Cow::{self, Borrowed, Owned}; From a53bcd47693c8b9d0396b89c8e3db983530298f5 Mon Sep 17 00:00:00 2001 From: gwenn Date: Tue, 23 Jul 2024 19:19:44 +0200 Subject: [PATCH 2/8] Prevent interrupt from non-owned connection Fix #1546 --- src/inner_connection.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inner_connection.rs b/src/inner_connection.rs index 6c4e6c0b8..5811a85e5 100644 --- a/src/inner_connection.rs +++ b/src/inner_connection.rs @@ -46,7 +46,7 @@ impl InnerConnection { pub unsafe fn new(db: *mut ffi::sqlite3, owned: bool) -> InnerConnection { InnerConnection { db, - interrupt_lock: Arc::new(Mutex::new(db)), + interrupt_lock: Arc::new(Mutex::new(if owned { db } else { ptr::null_mut() })), #[cfg(feature = "hooks")] free_commit_hook: None, #[cfg(feature = "hooks")] From 3810178be01ab49cbf03c1733f351e75b7b12b5d Mon Sep 17 00:00:00 2001 From: gwenn Date: Tue, 23 Jul 2024 19:28:21 +0200 Subject: [PATCH 3/8] Fix test --- src/inner_connection.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inner_connection.rs b/src/inner_connection.rs index 5811a85e5..010552b24 100644 --- a/src/inner_connection.rs +++ b/src/inner_connection.rs @@ -155,7 +155,7 @@ impl InnerConnection { self.remove_preupdate_hook(); let mut shared_handle = self.interrupt_lock.lock().unwrap(); assert!( - !shared_handle.is_null(), + !self.owned || !shared_handle.is_null(), "Bug: Somehow interrupt_lock was cleared before the DB was closed" ); if !self.owned { From e29a57fc580efeeccf95ebdb173b9e597a012b1c Mon Sep 17 00:00:00 2001 From: gwenn Date: Fri, 26 Jul 2024 18:35:37 +0200 Subject: [PATCH 4/8] Test direct-minimal-versions --- .github/workflows/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6a8e775e3..071390e69 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -158,6 +158,18 @@ jobs: RUST_BACKTRACE: "0" run: cargo -Z build-std test --features 'bundled-full session buildtime_bindgen preupdate_hook with-asan' --target x86_64-unknown-linux-gnu + direct-minimal-versions: + name: Test min versions + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - ueses: hecrj/setup-rust-action@v2 + with: + rust-version: nightly + - uses: Swatinem/rust-cache@v2 + - run: cargo update -Z direct-minimal-versions + - run: cargo test --workspace --all-targets --features bundled-full + # Ensure clippy doesn't complain. clippy: name: Clippy From 5438cd03c41d1026b04a7b95d0812aa2a46deb79 Mon Sep 17 00:00:00 2001 From: gwenn Date: Fri, 26 Jul 2024 18:38:51 +0200 Subject: [PATCH 5/8] Oops --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 071390e69..d4146a543 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -163,7 +163,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - ueses: hecrj/setup-rust-action@v2 + - uses: hecrj/setup-rust-action@v2 with: rust-version: nightly - uses: Swatinem/rust-cache@v2 From 8bab6eb9a73bf4b9b1b5fabb98f3ee4660949148 Mon Sep 17 00:00:00 2001 From: gwenn Date: Fri, 26 Jul 2024 18:41:31 +0200 Subject: [PATCH 6/8] Fix direct minimal versions Using the most recent versions currenlty available --- Cargo.toml | 6 +++--- libsqlite3-sys/Cargo.toml | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0a2025034..4808bd10a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -113,10 +113,10 @@ modern-full = [ bundled-full = ["modern-full", "bundled"] [dependencies] -time = { version = "0.3.0", features = ["formatting", "macros", "parsing"], optional = true } -bitflags = "2.0" +time = { version = "0.3.36", features = ["formatting", "macros", "parsing"], optional = true } +bitflags = "2.6.0" hashlink = "0.9" -chrono = { version = "0.4", optional = true, default-features = false, features = ["clock"] } +chrono = { version = "0.4.38", optional = true, default-features = false, features = ["clock"] } serde_json = { version = "1.0", optional = true } csv = { version = "1.1", optional = true } url = { version = "2.1", optional = true } diff --git a/libsqlite3-sys/Cargo.toml b/libsqlite3-sys/Cargo.toml index f9c370417..0c435a4c9 100644 --- a/libsqlite3-sys/Cargo.toml +++ b/libsqlite3-sys/Cargo.toml @@ -35,16 +35,16 @@ with-asan = [] wasm32-wasi-vfs = [] [dependencies] -openssl-sys = { version = "0.9", optional = true } +openssl-sys = { version = "0.9.103", optional = true } [build-dependencies] bindgen = { version = "0.69", optional = true, default-features = false, features = ["runtime"] } pkg-config = { version = "0.3.19", optional = true } -cc = { version = "1.0", optional = true } -vcpkg = { version = "0.2", optional = true } +cc = { version = "1.1.6", optional = true } +vcpkg = { version = "0.2.15", optional = true } # for loadable_extension: -prettyplease = {version = "0.2", optional = true } +prettyplease = {version = "0.2.20", optional = true } # like bindgen -quote = { version = "1", optional = true, default-features = false } +quote = { version = "1.0.36", optional = true, default-features = false } # like bindgen -syn = { version = "2.0", optional = true, features = ["full", "extra-traits", "visit-mut"] } +syn = { version = "2.0.72", optional = true, features = ["full", "extra-traits", "visit-mut"] } From 79904517250f5b48cc19bf6c1db7a54d0f8d6703 Mon Sep 17 00:00:00 2001 From: gwenn Date: Fri, 26 Jul 2024 18:48:05 +0200 Subject: [PATCH 7/8] Prepare patch release --- Cargo.toml | 4 ++-- libsqlite3-sys/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4808bd10a..a8cb94aca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rusqlite" # Note: Update version in README.md when you change this. -version = "0.32.0" +version = "0.32.1" authors = ["The rusqlite developers"] edition = "2021" description = "Ergonomic wrapper for SQLite" @@ -139,7 +139,7 @@ bencher = "0.1" [dependencies.libsqlite3-sys] path = "libsqlite3-sys" -version = "0.30.0" +version = "0.30.1" [[test]] name = "auto_ext" diff --git a/libsqlite3-sys/Cargo.toml b/libsqlite3-sys/Cargo.toml index 0c435a4c9..11fb6d875 100644 --- a/libsqlite3-sys/Cargo.toml +++ b/libsqlite3-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libsqlite3-sys" -version = "0.30.0" +version = "0.30.1" authors = ["The rusqlite developers"] edition = "2021" repository = "https://github.com/rusqlite/rusqlite" From c69f2f9a781b00824fa68925de4ee41cf26e2279 Mon Sep 17 00:00:00 2001 From: gwenn Date: Fri, 26 Jul 2024 18:53:16 +0200 Subject: [PATCH 8/8] Cancel previous run --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4146a543..20018626d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,6 +20,10 @@ env: permissions: contents: read +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + jobs: test: name: Test ${{ matrix.target }}