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

From: Stefano Lattarini <[email-masked]>
Date: Tue, 10 Jan 2012 13:44:25 +0100

On 01/10/2012 12:35 PM, Peter Rosin wrote:
> 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.
>
Thanks for tracking this down.  So the question now becomes: why doesn't
the trick with background processes work on MSYS?  Does maybe MSYS lack
proper emulation of POSIX-ish PIDs?  If that is the case, can we easily
work around that in our situation?

> As below, but as before, one unconditional second might be too expensive.
>
As a last resort, we might enable this suboptimal-but-safer behaviour
only when the build system is recognized to be MinGW/MSYS...

... Or we could take advantage of the bash built-in special variable
$SECONDS, if available (that variable was already present in bash 3.0
BTW), and use that to decide whether enough time has elapsed ... WDYT?

Thanks,
  Stefano