On Tue, Oct 20, 2015 at 3:57 PM, David Boyce <david.s.bo...@gmail.com>
wrote:

> My view is that this is really a variant of the longstanding
> discussion about getting make to not rely on timestamps at all and use
> MD5 or similar digital signatures instead. There are a number of
> reasons why timestamps can be insufficient beside this race condition,
> so I think it might be better to put effort into getting that working
> than doing more work on the timestamp implementation.
>
> Note that there are published mechanisms for using checksums with
> existing make. For instance
> http://www.cmcrossroads.com/article/rebuilding-when-files-checksum-changes
> .
>
>
I would clarify that the benefit from using the technique in that article
is really because the rebuild algorithm is essentially changed from:

if timestamp(foo.o) < timestamp(foo.c) {rebuild foo.o}

to:

if checksum(foo.c) != last_checksum(foo.c) {rebuild things that depend on
foo.c}

But you can get pretty much all the same benefits without having to hash
everything just by doing:

if timestamp(foo.c) != last_timestamp(foo.c) {rebuild things that depend on
foo.c}

In this last case, the only way things would rebuild incorrectly is if you
managed to change the contents of foo.c but somehow managed to keep its
timestamp identical between runs (which you can force with 'touch -t' or
some such, but doesn't come up in normal usage). Using checksums instead of
timestamps only addresses this additional minor usecase. Changing the
algorithm from a comparison between two files to a comparison between a
file and that same file's last-seen timestamp/checksum/whatever is the
primary improvement.

-Mike
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to