diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-01-08 23:24:06 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-01-23 11:53:05 +0200 |
commit | eb5e0b0859d3e13e081d0383b1428e017539430c (patch) | |
tree | 270d4d77d9529f7ca2f0fcd5e68f85b3920850ca | |
parent | a55e3434c52d53381d17a208acd2a3603913f8e5 (diff) | |
download | meson-clockskew.tar.gz |
Check for bad timestamps that cause eternal configure loops.clockskew
-rw-r--r-- | mesonbuild/backend/backends.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 2a07058a6..d75b7a4e2 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -793,8 +793,25 @@ class Backend: fname = os.path.join(self.environment.get_source_dir(), sp, 'meson_options.txt') if os.path.isfile(fname): deps.append(os.path.join(self.build_to_src, sp, 'meson_options.txt')) + self.check_clock_skew(deps) return deps + def check_clock_skew(self, file_list): + # If a file that leads to reconfiguration has a time + # stamp in the future, it will trigger an eternal reconfigure + # loop. + import time + now = time.time() + for f in file_list: + absf = os.path.join(self.environment.get_build_dir(), f) + ftime = os.path.getmtime(absf) + delta = ftime - now + # On Windows disk time stamps sometimes point + # to the future by a minuscule amount, less than + # 0.001 seconds. I don't know why. + if delta > 0.001: + raise MesonException('Clock skew detected. File {} has a time stamp {:.4f}s in the future.'.format(absf, delta)) + def exe_object_to_cmd_array(self, exe): if isinstance(exe, build.BuildTarget): if exe.for_machine is not MachineChoice.BUILD: |