Hi Eric,

* Eric Blake wrote on Tue, Aug 19, 2008 at 11:51:29PM CEST:
> 
> Hmmm.  This looks suspicious:
> 
> Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes:
> > ../../autoconf/tests/m4sh.at:743: ./script 1
> > --- -       2008-08-19 23:00:54.243440122 +0200
> > +++ /tmp/autoconf/write/build/tests/testsuite.dir/at-groups/60/stdout       
> > 2008-08-19
> > 23:00:54.000000000 +0200
> > @@ -1,5 +1,20 @@
> > -1
> > -1
> > -1
> > -1
> > +one
> > +two

> The test now builds 'script' from two independent 'script.as' inputs; where 
> before it only built one 'script'.  This diff looks like you are getting the 
> output from the first build of 'script' at the point where we should be 
> executing the second build.

Yep.  It's a timing problem: the `script' from the first test has the
same time stamp as the `script.as' from the second test, tricking
autom4te to think that its output is already up to date.

I got this to trigger on my x86 system in about one third of the cases.
The local file system has one-second resolution.  I'm kind of guessing
that m4 speed improvements helped to make this race more likely.

> Hey, this sounds EXACTLY like a case where Ben Pfaff's patch to make autom4te 
> atomically replace files would come in handy!  Want to give that a shot?

Ben's patch actually didn't help this problem at all, I tried with and
without it.  (Ben's test has a similar issue though; more in other mail).

Below is a fix.  I checked the testsuite for other instances of autom4te
races.  Luckily AT_CHECK_AUTOCONF includes --force by default so there
weren't many I could find.

OK?  Should I also reset the limit to 1000 in the AS_IF test, Eric?

Cheers,
Ralf

    Avoid timestamp races for updated input.

    * tests/m4sh.at (AS_IF and AS_CASE): Use `autom4te --force' for
    second script.
    * tests/tools.at (autotools and whitespace in file names): Add
    --force for repeated invocations.

diff --git a/tests/m4sh.at b/tests/m4sh.at
index f64d832..acaa11e 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -739,7 +739,8 @@ AS_CASE([$[1]]m4_for([i], [1], ]limit[, [], [, i, echo i]))
 AS_CASE([$[1]]m4_for([i], [1], ]limit[, [], [, i, echo i]), [echo default])
 ]])
 
-AT_CHECK_M4SH
+dnl Add --force so autom4te doesn't think `script' is still up to date.
+AT_CHECK_M4SH([--force])
 AT_CHECK([./script 1], [0], [[1
 1
 1
diff --git a/tests/tools.at b/tests/tools.at
index 8e432cb..3fc4959 100644
--- a/tests/tools.at
+++ b/tests/tools.at
@@ -1039,9 +1039,9 @@ END
 END
 
   AT_CHECK_AUTOHEADER([-B "$dir" "$file.in"])
-  AT_CHECK_AUTOHEADER([-I "$dir" "$file.in"])
+  AT_CHECK_AUTOHEADER([--force -I "$dir" "$file.in"])
   AT_CHECK_AUTOUPDATE([-B "$dir" "$file.in"])
-  AT_CHECK_AUTOUPDATE([-I "$dir" "$file.in"])
+  AT_CHECK_AUTOUPDATE([--force -I "$dir" "$file.in"])
   AT_CHECK_AUTOUPDATE([-B "$dir" - < "$file.in"], [], [ignore])
   AT_CHECK_AUTOCONF([-B "$dir" -o "$file" "$file.in"])
   AT_CHECK_AUTOCONF([-I "$dir" -o "$file" "$file.in"])
@@ -1049,12 +1049,12 @@ END
   AT_CHECK_AUTOCONF([--prepend-include="$dir" -o "$file" "$file.in"])
   AT_CHECK_AUTOCONF([--include="$dir" -o "$file" "$file.in"])
   AT_CHECK([autoscan -B "$dir"], [], [], [ignore])
-  AT_CHECK([autoscan -I "$dir"], [], [], [ignore])
+  AT_CHECK([autoscan --force -I "$dir"], [], [], [ignore])
   # autoreconf requires a sane input file name.  Also, disable aclocal.
   mv -f "$file.in" configure.in
   AT_DATA([aclocal.m4])
   AT_CHECK([autoreconf -B "$dir"])
-  AT_CHECK([autoreconf -I "$dir"])
+  AT_CHECK([autoreconf --force -I "$dir"])
 
   cat >"$file.c" <<'END'
 #if FOO


Reply via email to