diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-01-08 23:24:06 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-01-27 18:27:20 +0200 |
commit | 9e07f8d8e6bb088252ac11b3e663ff3d93c8020a (patch) | |
tree | a21528f07e69aa4b5edf293ffb549d57012f0af1 /mesonbuild/backend | |
parent | 42bbce28356e7863d172ea57db3431c80108e258 (diff) | |
download | meson-9e07f8d8e6bb088252ac11b3e663ff3d93c8020a.zip meson-9e07f8d8e6bb088252ac11b3e663ff3d93c8020a.tar.gz meson-9e07f8d8e6bb088252ac11b3e663ff3d93c8020a.tar.bz2 |
Check for bad timestamps that cause eternal configure loops.
Diffstat (limited to 'mesonbuild/backend')
-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 2a07058..d75b7a4 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: |