GNU bug report logs - #13107
timestamp bug when files are created just before make is run

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: automake; Reported by: Mikulas Patocka <mikulas@HIDDEN>; dated Thu, 6 Dec 2012 22:18:02 UTC; Maintainer for automake is bug-automake@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Dec 2012 16:54:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 10 11:54:32 2012
Received: from localhost ([127.0.0.1]:35766 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Ti6ch-0008OZ-K9
	for submit <at> debbugs.gnu.org; Mon, 10 Dec 2012 11:54:32 -0500
Received: from eggs.gnu.org ([208.118.235.92]:60451)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <schwab@HIDDEN>) id 1ThzxU-0005VF-L6
	for submit <at> debbugs.gnu.org; Mon, 10 Dec 2012 04:47:33 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <schwab@HIDDEN>) id 1Thzwn-00081Y-R3
	for submit <at> debbugs.gnu.org; Mon, 10 Dec 2012 04:46:58 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI,
	RP_MATCHES_RCVD autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:52889)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schwab@HIDDEN>) id 1Thzwn-00081I-OG
	for submit <at> debbugs.gnu.org; Mon, 10 Dec 2012 04:46:49 -0500
Received: from eggs.gnu.org ([208.118.235.92]:43536)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schwab@HIDDEN>) id 1Thzwg-0005DP-9w
	for bug-automake@HIDDEN; Mon, 10 Dec 2012 04:46:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <schwab@HIDDEN>) id 1ThzwR-0007r2-8Y
	for bug-automake@HIDDEN; Mon, 10 Dec 2012 04:46:42 -0500
Received: from cantor2.suse.de ([195.135.220.15]:43273 helo=mx2.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schwab@HIDDEN>)
	id 1ThzwR-0007lp-2E; Mon, 10 Dec 2012 04:46:27 -0500
Received: from relay1.suse.de (unknown [195.135.220.254])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx2.suse.de (Postfix) with ESMTP id C0232A3B99;
	Mon, 10 Dec 2012 10:45:45 +0100 (CET)
From: Andreas Schwab <schwab@HIDDEN>
To: Mikulas Patocka <mikulas@HIDDEN>
Subject: Re: timestamp bug when files are created just before make is run
References: <alpine.DEB.2.00.1212062203000.29768@HIDDEN>
	<CAKKmsNgx9XNaYXJYTcKX6k78QurPxAP=n3XTya5nAf1w2MqHVA@HIDDEN>
	<alpine.DEB.2.00.1212070309340.6415@HIDDEN>
X-Yow: ..  If I had heart failure right now,
	I couldn't be a more fortunate man!!
Date: Mon, 10 Dec 2012 10:45:45 +0100
In-Reply-To: <alpine.DEB.2.00.1212070309340.6415@HIDDEN>
	(Mikulas Patocka's message of "Fri, 7 Dec 2012 03:16:31 +0100 (CET)")
Message-ID: <mvmmwxmw88m.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 10 Dec 2012 11:54:30 -0500
Cc: Philip Guenther <guenther@HIDDEN>, bug-automake@HIDDEN,
	bug-make@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.5 (-----)

Mikulas Patocka <mikulas@HIDDEN> writes:

> BTW. on Linux, high precision timestamps have really kernel-tick 
> precision, not nanosecond precision.

The precision is as high as what the best hardware timer provides,
independent of the configured value of HZ.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@HIDDEN
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-automake@HIDDEN:
bug#13107; Package automake. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Dec 2012 02:17:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 06 21:17:01 2012
Received: from localhost ([127.0.0.1]:57557 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TgnUq-0000rK-Iu
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 21:17:01 -0500
Received: from eggs.gnu.org ([208.118.235.92]:57491)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnUo-0000rC-2X
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 21:16:58 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnUU-0004Nf-Ot
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 21:16:42 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD
	autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:55609)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnUU-0004NY-LQ
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 21:16:38 -0500
Received: from eggs.gnu.org ([208.118.235.92]:40603)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnUR-0005z4-I5
	for bug-automake@HIDDEN; Thu, 06 Dec 2012 21:16:38 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnUO-0004N8-RY
	for bug-automake@HIDDEN; Thu, 06 Dec 2012 21:16:35 -0500
Received: from artax.karlin.mff.cuni.cz ([195.113.26.195]:36785)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnUO-0004N3-Kf; Thu, 06 Dec 2012 21:16:32 -0500
Received: by artax.karlin.mff.cuni.cz (Postfix, from userid 17421)
	id 19CE498070; Fri,  7 Dec 2012 03:16:31 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
	by artax.karlin.mff.cuni.cz (Postfix) with ESMTP id 135A798062;
	Fri,  7 Dec 2012 03:16:31 +0100 (CET)
Date: Fri, 7 Dec 2012 03:16:31 +0100 (CET)
From: Mikulas Patocka <mikulas@HIDDEN>
To: Philip Guenther <guenther@HIDDEN>
Subject: Re: timestamp bug when files are created just before make is run
In-Reply-To: <CAKKmsNgx9XNaYXJYTcKX6k78QurPxAP=n3XTya5nAf1w2MqHVA@HIDDEN>
Message-ID: <alpine.DEB.2.00.1212070309340.6415@HIDDEN>
References: <alpine.DEB.2.00.1212062203000.29768@HIDDEN>
	<CAKKmsNgx9XNaYXJYTcKX6k78QurPxAP=n3XTya5nAf1w2MqHVA@HIDDEN>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-Personality-Disorder: Schizoid
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: submit
Cc: bug-automake@HIDDEN, bug-make@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.2 (----)



On Thu, 6 Dec 2012, Philip Guenther wrote:

> Note that this problem doesn't arise on systems with high precision
> file timestamps.  Many systems have provided those since the mid 90's;
> I'm appalled that the modern system that process the involved shell
> commands fast enough for this to regularly be a problem don't provide
> microsecond or better timestamp precision.

BTW. on Linux, high precision timestamps have really kernel-tick 
precision, not nanosecond precision.

So the first example that I posted doesn't always work correctly on Linux 
with 100HZ tick - with sufficiently fast computer, touch "a" and the rule 
to make "b" is executed in the same tick - so "a" isn't rebuilt.

Mikulas




Information forwarded to bug-automake@HIDDEN:
bug#13107; Package automake. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Dec 2012 01:56:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 06 20:56:19 2012
Received: from localhost ([127.0.0.1]:57548 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TgnAo-0007xr-NE
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 20:56:19 -0500
Received: from eggs.gnu.org ([208.118.235.92]:54926)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnAm-0007xk-8O
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 20:56:17 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnAS-0007p0-RQ
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 20:56:00 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD
	autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:52277)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnAS-0007or-OC
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 20:55:56 -0500
Received: from eggs.gnu.org ([208.118.235.92]:38034)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnAP-0002li-Um
	for bug-automake@HIDDEN; Thu, 06 Dec 2012 20:55:56 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnAM-0007oB-ST
	for bug-automake@HIDDEN; Thu, 06 Dec 2012 20:55:53 -0500
Received: from artax.karlin.mff.cuni.cz ([195.113.26.195]:38542)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgnAM-0007o2-Cd; Thu, 06 Dec 2012 20:55:50 -0500
Received: by artax.karlin.mff.cuni.cz (Postfix, from userid 17421)
	id E794498070; Fri,  7 Dec 2012 02:55:48 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
	by artax.karlin.mff.cuni.cz (Postfix) with ESMTP id E158898062;
	Fri,  7 Dec 2012 02:55:48 +0100 (CET)
Date: Fri, 7 Dec 2012 02:55:48 +0100 (CET)
From: Mikulas Patocka <mikulas@HIDDEN>
To: Philip Guenther <guenther@HIDDEN>
Subject: Re: timestamp bug when files are created just before make is run
In-Reply-To: <CAKKmsNgx9XNaYXJYTcKX6k78QurPxAP=n3XTya5nAf1w2MqHVA@HIDDEN>
Message-ID: <alpine.DEB.2.00.1212070252050.4823@HIDDEN>
References: <alpine.DEB.2.00.1212062203000.29768@HIDDEN>
	<CAKKmsNgx9XNaYXJYTcKX6k78QurPxAP=n3XTya5nAf1w2MqHVA@HIDDEN>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-Personality-Disorder: Schizoid
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: submit
Cc: bug-automake@HIDDEN, bug-make@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.2 (----)



On Thu, 6 Dec 2012, Philip Guenther wrote:

> On Thu, Dec 6, 2012 at 2:02 PM, Mikulas Patocka
> <mikulas@HIDDEN> wrote:
> > The apparent problem is that after make rebuilds b, it compares b's time
> > with a's time, finds that the times are equal (because a was touched just
> > before make was run) and doesn't rebuild a.
> >
> > I think it is a bug - when b is finished, make should find out whether the
> > rule for b modified the file b (if b's time is greater or equal than the
> > time when the rule for b was started, then b may have been modified) and
> > rebuild a in this case.
> 
> That's not the rule that make has always followed and, indeed, is
> required by the standard to follow.  To quote POSIX:
> 
>         The make utility attempts to perform the actions required to ensure
>         that the specified targets are up-to-date. A target is considered
>         out-of-date if it is older than any of its prerequisites or if
> it does not
>         exist. The make utility shall treat all prerequisites as targets
>         themselves and recursively ensure that they are up-to-date, processing
>         them in the order in which they appear in the rule. The make utility
>         shall use the modification times of files to determine whether the
>         corresponding targets are out-of-date.
> 
> The fact that the timestamp on a prerequisite has changed do *not*
> mean that it's newer than the target; it may have been copied from
> some other file which, while newer, is still older than the target
> file.  So the change to the make algorithm described in the paragraph
> above that starts "I think it is a bug" would not be correct;
> something more precise about what timestamps would be considered
> "newer" would be necessary.
> 
> 
> Note that this problem doesn't arise on systems with high precision
> file timestamps.  Many systems have provided those since the mid 90's;
> I'm appalled that the modern system that process the involved shell
> commands fast enough for this to regularly be a problem don't provide
> microsecond or better timestamp precision.

Yes, but it is very counterintuitive to remake file "b" and not remake 
file "a" that depends on "b" when asked to make file "a". It may be ok 
according to the standard, but not what the user wants.

> > This bug is causing real-world problems in automake-generated Makefiles.
> > This is a simplified piece of Makefile from automake:
> > all : config.h
> >         $(MAKE) all-am
> >
> > config.h : stamp-h1
> >         echo build config.h
> >
> > stamp-h1 : config.h.in
> >         echo build stamp-h1
> >         rm -f stamp-h1
> >         touch config.h
> >         touch stamp-h1
> >
> > config.h.in : am__configure_deps
> >         echo build config.h.in
> >         rm -f stamp-h1
> >         touch config.h.in
> >
> > all-am :
> >         echo ALL-AM
> >
> > Now, if you run this script, you trigger the bug:
> >
> > touch config.h.in;sleep 1;touch am__configure_deps;sleep 1;touch config.h stamp-h1;make
> >
> > - you see "build config.h.in", but the other files are not rebuild and
> > all-am is executed
> > (the essential thing to trigger the bug is that make is run in the same
> > second in which config.h and stamp-h1 were created)
> ...
> > Another possible solution for this bug would be to remove rm -f stamp-h1
> > from config.h.in rule, but there is some complex explanation in
> > /usr/local/share/automake-1.12/am/remake-hdr.am why rm -f stamp-h1 is
> > there so it would likely fix one bug and trigger another one.
> 
> Hmm, adding a "sleep 1" after that rm -f and before the touch
> config.h.in would work without reintroducing the issue described in
> that explanation, no?
> 
> 
> Philip Guenther

Yes it fixes it, you can add "sleep 1" to automake there, that fixes the 
bug.

Mikulas




Information forwarded to bug-automake@HIDDEN:
bug#13107; Package automake. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Dec 2012 00:23:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 06 19:23:37 2012
Received: from localhost ([127.0.0.1]:57495 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Tglj6-0005sA-Iv
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 19:23:37 -0500
Received: from eggs.gnu.org ([208.118.235.92]:36782)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <guenther@HIDDEN>) id 1TglGW-0005Cv-Ej
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 18:54:05 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <guenther@HIDDEN>) id 1TglGF-0003m4-R4
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 18:53:48 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,
	USER_IN_WHITELIST autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:53277)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <guenther@HIDDEN>) id 1TglGB-0003kw-WF
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 18:53:47 -0500
Received: from eggs.gnu.org ([208.118.235.92]:48118)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <guenther@HIDDEN>) id 1TglGA-0005LM-Rh
	for bug-automake@HIDDEN; Thu, 06 Dec 2012 18:53:43 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <guenther@HIDDEN>) id 1TglG9-0003j3-8Y
	for bug-automake@HIDDEN; Thu, 06 Dec 2012 18:53:42 -0500
Received: from mail-qa0-f41.google.com ([209.85.216.41]:48732)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <guenther@HIDDEN>)
	id 1TglG9-0003iz-4j; Thu, 06 Dec 2012 18:53:41 -0500
Received: by mail-qa0-f41.google.com with SMTP id o19so1683305qap.0
	for <multiple recipients>; Thu, 06 Dec 2012 15:53:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	bh=gGibXBWXDSdVfUvFXh4tSuIxtk8ghq5UW1oFnc1uNGo=;
	b=vWfxUTkVIprjSHXvfjsCu3T90vnk5LFJmNC7aLagQWpfoCmG+19ND2yzFWlCVaYLf4
	nqS8CZE7HOpRBkcEH4wv6NNNJteMjms5w0Mb7hMioLzTCbpUiQUMeog2d0Zab39Wjkn+
	zOFnpNNK0ttz4+L02tjqenZHbE1Y2uKhZbnVqQ5O9p3DZzP8Ay83DNfasYl/mKx26T3b
	gkJ5svzAcR4DDkgVQUWPX6Lstgl4bV5I25fnm+4YC3xqkXo1Vhn/XM3Xv7a2am/fjQpY
	1FXUt/rfdUEqY/vRhdKRTJNeWvoFBqKTMRV/C3rO6u3HAjm3QcuoktjTXqw6p3I8+9WT
	V9/w==
MIME-Version: 1.0
Received: by 10.229.205.18 with SMTP id fo18mr1248169qcb.24.1354838020433;
	Thu, 06 Dec 2012 15:53:40 -0800 (PST)
Received: by 10.49.25.232 with HTTP; Thu, 6 Dec 2012 15:53:40 -0800 (PST)
In-Reply-To: <alpine.DEB.2.00.1212062203000.29768@HIDDEN>
References: <alpine.DEB.2.00.1212062203000.29768@HIDDEN>
Date: Thu, 6 Dec 2012 15:53:40 -0800
Message-ID: <CAKKmsNgx9XNaYXJYTcKX6k78QurPxAP=n3XTya5nAf1w2MqHVA@HIDDEN>
Subject: Re: timestamp bug when files are created just before make is run
From: Philip Guenther <guenther@HIDDEN>
To: Mikulas Patocka <mikulas@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -3.4 (---)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 06 Dec 2012 19:23:35 -0500
Cc: bug-automake@HIDDEN, bug-make@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.2 (----)

On Thu, Dec 6, 2012 at 2:02 PM, Mikulas Patocka
<mikulas@HIDDEN> wrote:
> The apparent problem is that after make rebuilds b, it compares b's time
> with a's time, finds that the times are equal (because a was touched just
> before make was run) and doesn't rebuild a.
>
> I think it is a bug - when b is finished, make should find out whether the
> rule for b modified the file b (if b's time is greater or equal than the
> time when the rule for b was started, then b may have been modified) and
> rebuild a in this case.

That's not the rule that make has always followed and, indeed, is
required by the standard to follow.  To quote POSIX:

        The make utility attempts to perform the actions required to ensure
        that the specified targets are up-to-date. A target is considered
        out-of-date if it is older than any of its prerequisites or if
it does not
        exist. The make utility shall treat all prerequisites as targets
        themselves and recursively ensure that they are up-to-date, processing
        them in the order in which they appear in the rule. The make utility
        shall use the modification times of files to determine whether the
        corresponding targets are out-of-date.

The fact that the timestamp on a prerequisite has changed do *not*
mean that it's newer than the target; it may have been copied from
some other file which, while newer, is still older than the target
file.  So the change to the make algorithm described in the paragraph
above that starts "I think it is a bug" would not be correct;
something more precise about what timestamps would be considered
"newer" would be necessary.


Note that this problem doesn't arise on systems with high precision
file timestamps.  Many systems have provided those since the mid 90's;
I'm appalled that the modern system that process the involved shell
commands fast enough for this to regularly be a problem don't provide
microsecond or better timestamp precision.


> This bug is causing real-world problems in automake-generated Makefiles.
> This is a simplified piece of Makefile from automake:
> all : config.h
>         $(MAKE) all-am
>
> config.h : stamp-h1
>         echo build config.h
>
> stamp-h1 : config.h.in
>         echo build stamp-h1
>         rm -f stamp-h1
>         touch config.h
>         touch stamp-h1
>
> config.h.in : am__configure_deps
>         echo build config.h.in
>         rm -f stamp-h1
>         touch config.h.in
>
> all-am :
>         echo ALL-AM
>
> Now, if you run this script, you trigger the bug:
>
> touch config.h.in;sleep 1;touch am__configure_deps;sleep 1;touch config.h stamp-h1;make
>
> - you see "build config.h.in", but the other files are not rebuild and
> all-am is executed
> (the essential thing to trigger the bug is that make is run in the same
> second in which config.h and stamp-h1 were created)
...
> Another possible solution for this bug would be to remove rm -f stamp-h1
> from config.h.in rule, but there is some complex explanation in
> /usr/local/share/automake-1.12/am/remake-hdr.am why rm -f stamp-h1 is
> there so it would likely fix one bug and trigger another one.

Hmm, adding a "sleep 1" after that rm -f and before the touch
config.h.in would work without reintroducing the issue described in
that explanation, no?


Philip Guenther




Information forwarded to bug-automake@HIDDEN:
bug#13107; Package automake. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 6 Dec 2012 22:17:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 06 17:17:43 2012
Received: from localhost ([127.0.0.1]:57431 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TgjlG-00030l-Hv
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 17:17:43 -0500
Received: from eggs.gnu.org ([208.118.235.92]:46483)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgjXI-0002gC-3g
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 17:03:17 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgjWy-0001Sr-P3
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 17:03:01 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD
	autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:55901)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgjWy-0001Sn-My
	for submit <at> debbugs.gnu.org; Thu, 06 Dec 2012 17:02:56 -0500
Received: from eggs.gnu.org ([208.118.235.92]:57797)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgjWv-0007cs-RT
	for bug-automake@HIDDEN; Thu, 06 Dec 2012 17:02:56 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgjWs-0001R1-5x
	for bug-automake@HIDDEN; Thu, 06 Dec 2012 17:02:53 -0500
Received: from artax.karlin.mff.cuni.cz ([195.113.26.195]:40212)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <mikulas@HIDDEN>)
	id 1TgjWr-0001Qs-Vn; Thu, 06 Dec 2012 17:02:50 -0500
Received: by artax.karlin.mff.cuni.cz (Postfix, from userid 17421)
	id 269FA98070; Thu,  6 Dec 2012 23:02:48 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
	by artax.karlin.mff.cuni.cz (Postfix) with ESMTP id 239A398062;
	Thu,  6 Dec 2012 23:02:48 +0100 (CET)
Date: Thu, 6 Dec 2012 23:02:48 +0100 (CET)
From: Mikulas Patocka <mikulas@HIDDEN>
To: bug-make@HIDDEN, bug-automake@HIDDEN
Subject: timestamp bug when files are created just before make is run
Message-ID: <alpine.DEB.2.00.1212062203000.29768@HIDDEN>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-Personality-Disorder: Schizoid
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 06 Dec 2012 17:17:42 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.2 (----)

Hi

Try this Makefile:
---
a : b
        echo build a
        touch a

b : c
        echo build b
        touch b
---
and run this script:
touch b;sleep 1;touch a c;make

You see
"echo build b
build b
touch b"
but it doesn't remake a.

The apparent problem is that after make rebuilds b, it compares b's time 
with a's time, finds that the times are equal (because a was touched just 
before make was run) and doesn't rebuild a.

I think it is a bug - when b is finished, make should find out whether the 
rule for b modified the file b (if b's time is greater or equal than the 
time when the rule for b was started, then b may have been modified) and 
rebuild a in this case.

---

This bug is causing real-world problems in automake-generated Makefiles. 
This is a simplified piece of Makefile from automake:
all : config.h
        $(MAKE) all-am

config.h : stamp-h1
        echo build config.h

stamp-h1 : config.h.in
        echo build stamp-h1
        rm -f stamp-h1
        touch config.h
        touch stamp-h1

config.h.in : am__configure_deps
        echo build config.h.in
        rm -f stamp-h1
        touch config.h.in

all-am :
        echo ALL-AM

Now, if you run this script, you trigger the bug:

touch config.h.in;sleep 1;touch am__configure_deps;sleep 1;touch config.h stamp-h1;make

- you see "build config.h.in", but the other files are not rebuild and 
all-am is executed
(the essential thing to trigger the bug is that make is run in the same 
second in which config.h and stamp-h1 were created)


The problem that really happens in a real build:

* The user runs autoheader && aclocal && automake && autoconf && ./configure && make -j4
* Configure runs ./config.status, ./config.status writes config.h and 
stamp-h1
* Make sees that am__configure_deps is newer than config.h.in
* Make runs the rule for config.h.in. It sets the new timestamp for 
config.h.in and deletes stamp-h1
* Now make sees that config.h.in has the same time as stamp-h1 (the 
timestamp is read from make's cache even if stamp-h1 no longer exists)
* Because of the same timestamp, make doesn't run the commands for 
stamp-h1 and config.h
* Make executes a subprocess to build the rule all-am

* The subprocess doesn't have the file cache of the parent process, so the 
subprocess knows that stamp-h1 is missing
* The subprocess sees a dependency config.h->stamp-h1, stamp-h1 doesn't 
exist
* The subprocess executes the rule for stamp-h1 which regenerates config.h 
- the problem is that this rule is executed in parallel with other rules 
that build C files that include config.h - changing config.h while it is 
being used results in build failure

Another possible solution for this bug would be to remove rm -f stamp-h1 
from config.h.in rule, but there is some complex explanation in 
/usr/local/share/automake-1.12/am/remake-hdr.am why rm -f stamp-h1 is 
there so it would likely fix one bug and trigger another one.

So it would be better to fix this in make.

Mikulas




Acknowledgement sent to Mikulas Patocka <mikulas@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-automake@HIDDEN. Full text available.
Report forwarded to bug-automake@HIDDEN:
bug#13107; Package automake. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.