From ac5ef35b5fa8b938ed427df4b0ad44e5b6b52cff Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 19 Nov 2018 14:58:20 +0200 Subject: Finalize workaround for backwards modification time issue --- build2/cc/link-rule.cxx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'build2/cc/link-rule.cxx') diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx index 90d290d..77619d1 100644 --- a/build2/cc/link-rule.cxx +++ b/build2/cc/link-rule.cxx @@ -2068,11 +2068,14 @@ namespace build2 // this situation in the "from scratch" flag. // bool scratch (false); - if (dd.writing () || dd.mtime () > mt) + if (dd.writing () || dd.mtime > mt) scratch = update = true; +#define MTIME_SANITY_CHECK +#ifdef MTIME_SANITY_CHECK timestamp dd_tt (system_clock::now ()); - bool dd_rd (dd.reading ()); +#endif + dd.close (); // If nothing changed, then we are done. @@ -2080,9 +2083,6 @@ namespace build2 if (!update) return ts; - path ddp (tp + ".d"); - timestamp dd_mt (file_mtime (ddp)); - // Ok, so we are updating. Finish building the command line. // string in, out, out1, out2, out3; // Storage. @@ -2544,19 +2544,20 @@ namespace build2 rm.cancel (); +#ifdef MTIME_SANITY_CHECK { - timestamp tp_tt (system_clock::now ()); timestamp tp_mt (file_mtime (tp)); + timestamp dd_mt (file_mtime (dd.path)); + timestamp tp_tt (system_clock::now ()); if (dd_mt > tp_mt) - { fail << "backwards modification times:\n" - << ddp.string () << " " << dd_mt << " (" << dd_rd << ")\n" - << tp.string () << " " << tp_mt << '\n' - << dd_tt << '\n' - << tp_tt; - } + << dd_tt << " window start\n" + << dd_mt << " " << dd.path.string () << '\n' + << tp_mt << " " << tp.string () << '\n' + << tp_tt << " window end"; } +#endif // Should we go to the filesystem and get the new mtime? We know the // file has been modified, so instead just use the current clock time. -- cgit v1.1