Skip to content

Unsupported operation sqlite3_open_v2 #2325

Closed
@weiznich

Description

@weiznich

Motivated by Ralf Jung's blog post about the last 2 years of miri development I've tried to run diesels test suit using miri. Especially the sqlite backend does a lot of nasty pointer things, so another layer of checks beside asan and friends would be helpful. I run into the following error message:

error: unsupported operation: can't call foreign function: sqlite3_open_v2
   --> diesel/src/sqlite/connection/raw.rs:47:13
    |
47  |             ffi::sqlite3_open_v2(database_url.as_ptr(), &mut conn_pointer, flags, ptr::null())
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: sqlite3_open_v2
    |
    = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support

    = note: inside `sqlite::connection::raw::RawConnection::establish` at diesel/src/sqlite/connection/raw.rs:47:13
note: inside `<sqlite::connection::SqliteConnection as connection::Connection>::establish` at diesel/src/sqlite/connection/mod.rs:92:30
   --> diesel/src/sqlite/connection/mod.rs:92:30
    |
92  |         let raw_connection = RawConnection::establish(database_url)?;
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `test_helpers::connection` at diesel/src/test_helpers.rs:10:13
   --> diesel/src/test_helpers.rs:10:13
    |
10  |             SqliteConnection::establish(":memory:").unwrap()
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `connection::transaction_manager::test::sqlite_transaction_is_rolled_back_upon_deferred_constraint_failure` at diesel/src/connection/transaction_manager.rs:896:25
   --> diesel/src/connection/transaction_manager.rs:896:25
    |
896 |         let conn = &mut crate::test_helpers::connection();
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure at diesel/src/connection/transaction_manager.rs:889:5
   --> diesel/src/connection/transaction_manager.rs:889:5
    |
887 |       #[test]
    |       ------- in this procedural macro expansion
888 |       #[cfg(feature = "sqlite")]
889 | /     fn sqlite_transaction_is_rolled_back_upon_deferred_constraint_failure() {
890 | |         use crate::connection::transaction_manager::AnsiTransactionManager;
891 | |         use crate::connection::transaction_manager::TransactionManager;
892 | |         use crate::result::Error;
...   |
923 | |         );
924 | |     }
    | |_____^
    = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)

I should note that I kind of expected that. I mainly raise this issue as the blog post explicitly calls for opening issues for unsupported operations.

Environment information:

  • Ubuntu 22.04
  • rustc --version:
rustc 1.63.0-nightly (c06728704 2022-05-19)
binary: rustc
commit-hash: c0672870491e84362f76ddecd50fa229f9b06dff
commit-date: 2022-05-19
host: x86_64-unknown-linux-gnu
release: 1.63.0-nightly
LLVM version: 14.0.4

Steps to reproduce:

git clone https://github.com/diesel-rs/diesel
cd diesel
git checkout cbdfee30b206fff0aba62fa482fd837c0edd2cea
cd diesel
cargo miri test --features "sqlite" --no-default-features

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: affects documentationA-shimsArea: This affects the external function shimsC-proposalCategory: a proposal for something we might want to do, or maybe not; details still being worked out

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions