-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Files with zero mtime are treated as nonexistent #1120
Comments
The Ninja build tool can't cope with an zero mtime, so ensure it's set to the current time when repacking the archive (see ninja-build/ninja#1120).
Looks like a likely candidate. And
Also
It's assumed in a few other places as well. I don't think your current strategy is safe, particularly when zero is often the default when unspecified in e.g. archive formats. Consider that the underlying |
This is a dupe of #795. Someone suggested to let an mtime of 1 instead of 0 mean "file does not exist" :-) On #795, the latest status is that it's now easy to print a message like "ninja can't handle files with mtime of 0" instead of confusingly and silently marking them as dirty. Would that be good enough for you? Why is the file's mtime 0 on your system? |
mtime of 1 is a clever hack! Could also just add one to all mtimes, to On Tue, Apr 5, 2016 at 6:36 PM, Nico Weber notifications@github.com wrote:
|
The reason for the mtime being zero in this specific instance is by using the Python Using an mtime of 1 would indeed be a "clever hack" and would certainly work around the issue here. On the other hand, a fix such as I suggested would be not much more effort and would remove the need for any special values at all, making it robust under all circumstances. Either way would be fine with me. Thanks for following this up, |
But the 0 mtime is never intentional, right? It seems like erroring out might be the best way forward here. |
It's not intentional, no. But it is something which occurs relatively commonly by accident. I don't think erroring out would be appropriate; if anyone ever makes a source release with an unset timestamp, that's de facto unbuildable with ninja. Setting it to 1 would be a much nicer strategy. |
The Windows code to convert the filesystem-representation timestamp into a I'm proposing changing this code: https://github.com/ninja-build/ninja/blob/master/src/disk_interface.cc#L193 I believe it will solve everything at the cost of us not properly handling On Fri, Apr 8, 2016 at 7:56 AM, Roger Leigh notifications@github.com
|
I am seeing something similar here when building inside a flatpak sandbox, basically all the files handled by ostree, meaning the "system" files have a mtime = 0 (not sure why they do that, but I think it is related to the file de-duplication sytstem). Those system files are not considered nonexistent but as "dirty", and full rebuild is triggered each time I am running ninja in that env. When rebuilding with
|
This reverts commit a84bf6a. Meson can be used now from builder, although it compiles everytime due to ninja issue ninja-build/ninja#1120 it's still faster than autotools for me (quite surprising), so switching for it as default build system. Developers can still use autotools just switching the buildsystem in the flatpak manifest.
For flatpak I'm going to add the patch in flatpak/flatpak#607 (comment) to our ninja build until this is figured out. |
I think I have a more thorough fix in #1293 |
Just noting also, I did also file Patrick Griffis' patch used in Flatpak as pull request #1292, which is a good workaround for the problem, which we know is well tested (builds regularly pass with that applied at least). But I did put some effort to do it thoroughly in #1293 so that the semantic is changed and any mtime is a valid one, including 0 and negative mtimes which should also be valid (not sure how the codebase stands up to negative mtimes, though). While I think #1293 is the correct fix, it is of course a bit more of an invasive change and would be good to review that (I did not end up modifying deps_log.[cc,h], I'm not sure if a change is needed there to distinguish between file existence and mtimes). I have however built a lot of GNOME modules using the #1293 branch without issue. Whichever route is taken, it would be nice to have some fix in upstream ninja for this. |
And thanks much for the fix! |
On a CentOS 7 system:
This source archive was packed incorrectly, and a single file has an mtime of zero (i.e. start of Unix epoch).
The cause:
Clearly, the file does exist. If I
touch /tmp/ome-cmake-superbuild-0.1.0/cmake/GitVersion.cmake
to update the timestamp to the current time, thenninja
runs perfectly. It appears to be the case that Ninja is treating files with a zero mtime as being nonexistent, which seems incorrect. Please could you consider changing that behaviour? While this is an unusual corner case--files shouldn't have a timestamp this old--it can and does happen for various reasons, and it would be nice if Ninja could work correctly under these circumstances.Kind regards,
Roger
The text was updated successfully, but these errors were encountered: