-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Invalid cross-device link" when generating query files #2663
Comments
Similar to #2395. |
I'm also encountering this issue. The whole idea of using a temporary file and then persisting it doesn't make any sense to me. Why not just serialize the data into memory and then write it out directly to the "persisted" location? I'll look into making a PR to do that instead. |
Because it is the recommended way to ensure the write is atomic. If the same query appears in multiple places, then multiple instances of the macro may attempt to write the data file at the same time. This may be a non-issue for invocations within the same crate as macros are expanded serially, but could be an issue for concurrent compiler invocations when building a multi-crate project. |
That can be handled with the |
The manpage for
Does this apply if the parent directory is a symbolic link as might also happen? |
No, it works fine in that case. Also, it's in the Rust stdlib as |
I just pushed a PR that uses |
* Don't use temp dir for query jsons Fixes #2663 * Return early when exclusive create fails * Use atomic-file-write for writing query data
Bug Description
When
CARGO_TARGET_DIR
is not on the same filesystem as the project source,cargo sqlx prepare
fails:Minimal Reproduction
(on linux)
sudo mount -o X-mount.mkdir /tmp/cargo-target-dir
CARGO_TARGET_DIR
while runningcargo sqlx prepare
.Info
features = ["postgres", "runtime-tokio-rustls", "chrono", "uuid"]
rustc --version
:rustc 1.71.0 (8ede3aae2 2023-07-12)
The text was updated successfully, but these errors were encountered: