diff options
author | Alexey Tourbin <alexey.tourbin@gmail.com> | 2017-02-15 03:25:49 +0300 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2017-03-25 20:16:42 +0100 |
commit | aa16483c4792a030646b36ce3edd5c5dd935c919 (patch) | |
tree | f716b06ad15a90c050ca1c82faadad9620de2d0b | |
parent | b8aeb9826fcbf4627df8c0d9a9b110c4523ea0f1 (diff) | |
download | ccache-aa16483c4792a030646b36ce3edd5c5dd935c919.tar.gz |
Removed time_of_compilation check wrt SLOPPY_FILE_STAT_MATCHES
The whole code seems to be a thinko. For a hit, neither ctime
nor mtime should be greater than or equal to time_of_compilation.
The code only seems to work because time_of_compilation is 0
at this stage (i.e. has not been initialized).
While at it, I also introduce an optimization: when sizes do
not match, it's a good chance to bail out early; there is no
point in further hashing the file.
-rw-r--r-- | manifest.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -377,14 +377,12 @@ verify_object(struct conf *conf, struct manifest *mf, struct object *obj, hashtable_insert(stated_files, x_strdup(path), st); } + if (fi->size != st->size) { + return 0; + } + if (conf->sloppiness & SLOPPY_FILE_STAT_MATCHES) { - // st->ctime is sometimes 0, so we can't check that both st->ctime and - // st->mtime are greater than time_of_compilation. But it's sufficient to - // check that either is. - if (fi->size == st->size - && fi->mtime == st->mtime - && fi->ctime == st->ctime - && MAX(st->mtime, st->ctime) >= time_of_compilation) { + if (fi->mtime == st->mtime && fi->ctime == st->ctime) { cc_log("size/mtime/ctime hit for %s", path); continue; } else { |