Hi Peter, sorry for the delay.

>>>> We could enhance your original workaround like this:
>>>>
>>>>  am__remove_distdir = \
>>>>    { test ! -d "$(distdir)" \
>>>>      || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
>>>> -         && rm -fr "$(distdir)"; }; }
>>>> +         && if rm -fr "$(distdir)"; then :; else \
>>>> +## On MSYS (1.0.17) it is not possible to remove a directory that is
>>>> +## in use; so, if the first rm fails, we sleep some seconds and retry,
>>>> +## to give pending processes some time to exit and "release" the
>>>> +## directory before we removed.  See automake bug#10470.
>>>> +              sleep 5 && rm -fr "$(distdir)"; fi; }; }
>>>>  am__post_remove_distdir = $(am__remove_distdir)
>>>>  endif %?TOPDIR_P%
>>
>>> This works, best so far!  Committable, if you ask me.
>>>
> 
Could you try the attached test case to see if it can reliably expose the
problem on MSYS/MinGW?  If yes, I'll prepare a patch shortly.

Thanks,
  Stefano
#! /bin/sh
# Copyright (C) 2012 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
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Ensure "make distcheck" does not experience racy failures on
# systems (like MinGW/MSYS) that cannot remove a directory "in use"
# by a process (e.g., that is its "current working directory").
# See automake bug#10470.

parallel_tests=no
. ./defs || Exit 1

set -e

my_sleep='sleep 4'

mkdir foo.d
sh -c "cd foo.d && $my_sleep" &
rm -rf foo.d && skip_ 'system is able to remove "in use" directories'

echo AC_OUTPUT >> configure.in

cat > Makefile.am <<END
TESTS = foo.test
EXTRA_DIST= foo.test
END

cat > foo.test <<END
#!/bin/sh
$my_sleep
exit 0
END
chmod a+x foo.test

$ACLOCAL
$AUTOCONF
$AUTOMAKE
./configure

$MAKE distcheck

:

Reply via email to