Subject: bug#10470: MSYS: race in directory access?

From: Peter Rosin <[email-masked]>
Date: Tue, 10 Jan 2012 12:35:11 +0100

Peter Rosin skrev 2012-01-10 11:12:
> Stefano Lattarini skrev 2012-01-10 10:50:
>> [2] Now that I think of it, my knee-jerk guess is that the "( sleep 1 ) &"
>>     put in configure by AM_SANITY_CHECK is the likely culprit.
> 
> I tried that hypothesis and bumped this to "( sleep 2 ) &", and the test
> case failed even with my ugly "sleep 1" workaround.  I then bumped "my" fix
> to "sleep 2" and the test case succeeded again.  So they certainly seem
> connected.

One further data point; changing that "( sleep 1 ) &" thing followed by a
wait just before AC_OUTPUT into an inlined sleep also fixes the test case.

As below, but as before, one unconditional second might be too expensive.

So, your knee-jerk is sound.  Question is what to do...

Cheers,
Peter

diff --git a/m4/sanity.m4 b/m4/sanity.m4
index b718ac4..689781a 100644
--- a/m4/sanity.m4
+++ b/m4/sanity.m4
@@ -69,17 +69,8 @@ fi
 AC_MSG_RESULT([yes])
 # If we didn't sleep, we still need to ensure time stamps of config.status and
 # generated files are strictly newer.
-am_sleep_pid=
 if grep 'slept: no' conftest.file >/dev/null 2>&1; then
-  ( sleep 1 ) &
-  am_sleep_pid=$!
+  sleep 1
 fi
-AC_CONFIG_COMMANDS_PRE(
-  [AC_MSG_CHECKING([that generated files are newer than configure])
-   if test -n "$am_sleep_pid"; then
-     # Hide warnings about reused PIDs.
-     wait $am_sleep_pid 2>/dev/null
-   fi
-   AC_MSG_RESULT([done])])
 rm -f conftest.file
 ])