Open
Description
Problem
My project depends on tokio
which doesn't support Windows. I run all build activities on WSL1. Cargo always recompiles the sources even if I have no changes.
Following the docs I run build with CARGO_LOG
and there are logs (some info omitted):
stale: changed "/mnt/c/<path>"
(vs) "/mnt/c/..."
FileTime { seconds: 1701833155, nanos: 0 } < FileTime { seconds: 1701833155, nanos: 871914000 }
fingerprint dirty for prj v1.1.0 (/mnt/c/... { ..: lib_target("prj", ["cdylib"], "/mnt/c/.../src/lib.rs", Edition2021) }
dirty: FsStatusOutdated(StaleDepFingerprint { name: "something" })
fingerprint dirty for something v1.1.0 (/mnt/c/...)/Build/TargetInner { ..: lib_target("something", ["lib"], "/mnt/c/GitHub/.../src/lib.rs", Edition2021) }
dirty: FsStatusOutdated(StaleItem(ChangedFile { reference: "/mnt/c/.../target/debug/.fingerprint/...", reference_mtime: FileTime { seconds: 1701833155, nanos: 0 }, stale: "/mnt/c/.../target/debug/build/...", stale_mtime: FileTime { seconds: 1701833155, nanos: 871914000 } }))
As you can see, nanoseconds are stripped by filesystem for files created by WSL.
Steps
- Run WSL
- Create a project with dependencies
cargo build
cargo build
cargo build
Possible Solution(s)
Ignore nanoseconds for file timestamps on WSL.
Notes
No response
Version
$ cargo version --verbose
cargo 1.73.0 (9c4383fb5 2023-08-26)
release: 1.73.0
commit-hash: 9c4383fb55986096b414d98125421ab87b5fd642
commit-date: 2023-08-26
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.2.1-DEV (sys:0.4.65+curl-8.2.1 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u 30 May 2023
os: Ubuntu 22.04 (jammy) [64-bit]
$ uname -a
Linux %hostname% 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Footnotes
-
WSL is a Linux VM hosted by Windows which uses a shared filesystem. ↩