[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #46242] Race condition when input file is updated while compili

From: Mike Shal
Subject: Re: [bug #46242] Race condition when input file is updated while compiling
Date: Tue, 20 Oct 2015 17:07:33 -0400

On Tue, Oct 20, 2015 at 3:57 PM, David Boyce <address@hidden> 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

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}


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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]