[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: avoid a 1-second sleep in every configure script
From: |
Ralf Wildenhues |
Subject: |
Re: avoid a 1-second sleep in every configure script |
Date: |
Sun, 11 Oct 2009 17:00:01 +0200 |
User-agent: |
Mutt/1.5.20 (2009-08-09) |
* Ralf Wildenhues wrote on Sun, Sep 06, 2009 at 01:14:16PM CEST:
> Avoid sleeping for one second most of the time in sanity check.
>
> * m4/sanity.m4 (AM_SANITY_CHECK): Try sanity check first without
> sleeping for a second, and only if that failed, sleep and try
> again, to avoid the delay in the common case of a configure
> script that is older than a second, or a system with sub-second
> time stamp granularity.
> Report and different patch by Jim Meyering.
Hmpf. This patch exposed a spurious test failure in Automake, when
running its testsuite on a fast system, but with low time stamp
granularity. Reproduced with werror2.test, a quick (probably not
exhausting) audit found no other affected tests, but a couple where
I needed a comment to understand why they weren't susceptible.
Here's the problem: when in a series of
create configure.ac
create Makefile.am
aclocal
autoconf
# (1) clock advances by a second right here
automake -a
./configure
make
update Makefile.am
make
all files starting from (1) are updated within the same second, but
configure was created earlier, then configure won't sleep, thus the
second 'make' invocation may not see that Makefile.am is updated.
Running $AUTOMAKE before the second 'make', even without --no-force, is
not enough because Makefile.in might not have a newer time stamp than
Makefile afterwards. Eww.
I hope that there isn't any code out there that relies on this. OTOH,
the sequence
update Makefile.am
make
update Makefile.am
make
alone has had similar problems already.
Pushed to maint.
Cheers,
Ralf
Fix race condition in werror2.test due to sanity sleep change.
* tests/werror2.test: Generate Makefile.in before configure so
that a Makefile.am update after configure has run is guaranteed
to be newer than Makefile.in.
* tests/subdir5.test: Document why this test does not need to be
fixed.
* tests/subdir8.test: Likewise.
diff --git a/tests/subdir5.test b/tests/subdir5.test
index 1bfee41..2f0113b 100755
--- a/tests/subdir5.test
+++ b/tests/subdir5.test
@@ -1,5 +1,6 @@
#! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2009 Free Software Foundation,
+# Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,6 +55,12 @@ $AUTOMAKE --include-deps --copy --add-missing
./configure
$MAKE
+# We shouldn't need to $sleep here: configure ensures that files
+# generated by it are newer than configure. Thus, even if
+# Makefile.in is newer than configure but the updated Makefile.am
+# below has the same timestamp as Makefile.in, the latter should
+# be rebuilt due to its dependency on configure.in.
+
# Now add a new directory.
cat > configure.in << 'END'
AC_INIT(maude, 1.0)
diff --git a/tests/subdir8.test b/tests/subdir8.test
index 97f7d42..bc3043e 100755
--- a/tests/subdir8.test
+++ b/tests/subdir8.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2009 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -67,6 +67,7 @@ $AUTOMAKE --copy --add-missing
$MAKE
# Now add a new directory.
+# See subdir5.test for why we shouldn't need to $sleep here.
mkdir sub/maude
cat > sub/maude/Makefile.am << 'END'
diff --git a/tests/werror2.test b/tests/werror2.test
index d55b015..6b6d011 100755
--- a/tests/werror2.test
+++ b/tests/werror2.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2009 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,8 +29,11 @@ echo AC_OUTPUT>>configure.in
: > Makefile.am
$ACLOCAL
-$AUTOCONF
+# Create Makefile.in before configure. configure ensures files
+# generated by it or later are newer than configure, so this allows
+# us to avoid a $sleep before updating Makefile.am below.
$AUTOMAKE
+$AUTOCONF
./configure
$MAKE
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: avoid a 1-second sleep in every configure script,
Ralf Wildenhues <=