-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Nanosecond-granularity modification times cause spurious rebuilds #2874
Comments
This may be a Docker-specific issue, but I'm unclear as to why it would only happen with the one crate. If I watch the modification times, it appears that the filesystem truncates the modification time between images: RUN cargo build && ls --full-time /playground/target/debug/build/tempfile-1b82f6307d61d5f0/output
RUN ls --full-time /playground/target/debug/build/tempfile-1b82f6307d61d5f0/output
|
Interestingly, {
"rustc": 0,
"target": 0,
"profile": 0,
"local": {
"variant": "MtimeBased",
"fields": [
[
1468471990,
914840077
],
[
47, 112, 108, 97, 121, 103, 114, 111, 117, 110, 100, 47, 116, 97, 114,
103, 101, 116, 47, 100, 101, 98, 117, 103, 47, 98, 117, 105, 108, 100,
47, 116, 101, 109, 112, 102, 105, 108, 101, 45, 49, 98, 56, 50, 102,
54, 51, 48, 55, 100, 54, 49, 100, 53, 102, 48, 47, 111, 117, 116, 112,
117, 116
]
]
},
"features": "",
"deps": [],
"rustflags": []
} |
One thing of note is that the modification checks assert that the values are equal. Many other systems test if the file is older than the fingerprint. Is that a deliberate decision, or is it possible that could be changed? |
I’m not sure it is possible to do anything about this. It is generally a well known issue with timestamp-based change tracking in build systems. |
I feel like I've definitely seen this before in terms of docker dropping nanosecond precision, although I can't seem to find any issues related to that. I also wouldn't mind changing the check here to be a "less than or equal to" relation rather than "equal to", as I agree it's what I would generally expect and would also naturally solve this! |
One behavior I've found in rustbuild at least is:
I think it's because the mtime of a project is the maximum mtime, and if this mtime is different than what's in the metadata we rebuild, rather than if it's later we rebuild. @shepmaster would you like to make a PR? |
Chiming in that I just encountered this, and a |
For those that might want a workaround, here's a
I threw that in a file:
And then fix all the fingerprints:
|
This was fixed in #2880 |
I have a large
Cargo.toml
that I'm placing in a Docker container and prebuilding all the dependencies. However, at runtime there's still one crate that is rebuilt:tempfile v2.1.4
. Turning on logging shows:More specifically:
A complete log
The text was updated successfully, but these errors were encountered: