0.7.0-alpha.1: error: failed to move query file
when running cargo sqlx prepare
#2395
Labels
error: failed to move query file
when running cargo sqlx prepare
#2395
This issue appears on the latest commit to main at the time of writing this.
Bug Description
The PR to implement one file per query: #2363 implemented logic to write queries to a temp file and then persist them to
SQLX_OFFLINE_DIR
here:sqlx/sqlx-macros-core/src/query/data.rs
Lines 163 to 170 in c03926c
However, the docs for
NamedTempFile::persist
mention the following:On Linux, the
/tmp
directory is commonly mounted astmpfs
which means the call totmp_file.persist
will result in the following error:failed to move query file: PersistError(Os { code: 18, kind: CrossesDevices, message: "Invalid cross-device link" })
.Perhaps we could use
tempfile::NamedTempFile::new_in(dir.as_ref())
to create the temporary files directly inSQLX_OFFLINE_DIR
to ensure we're not crossing any filesystem boundaries?Minimal Reproduction
Run
cargo sqlx migrate
on a Linux system with/tmp
mounted separately from the main OS.Info
rustc --version
: rustc 1.68.0 (2c8cc3432 2023-03-06)The text was updated successfully, but these errors were encountered: