Subject: MSYS: race in directory access?

From: Peter Rosin <[email-masked]>
Date: Tue, 10 Jan 2012 00:07:54 +0100

Hi!

distcheck-configure-flags-am.test fails on MSYS.  I think the cause is
that some process lingers with CWD in the _build directory which some
other process tries to remove.  On MSYS, it's not possible to remove a
directory that is "in use" like that.

Ugly patch coming up shortly.

Cheers,
Peter

Running from installcheck: no
Using TAP: no
PATH = /home/peda/automake/tests:/c/Program Files (x86)/Microsoft F#/v4.0/:/c/Program Files (x86)/Microsoft Visual Studio 10.0/VSTSDB/Deploy:/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/:/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/BIN:/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/Tools/:/c/Windows/Microsoft.NET/Framework/v4.0.30319:/c/Windows/Microsoft.NET/Framework/v3.5:/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/VCPackages:/c/Program Files (x86)/HTML Help Workshop:/c/Program Files (x86)/Microsoft Visual Studio 10.0/Team Tools/Performance Tools:/c/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/bin/NETFX 4.0 Tools:.:/usr/local/bin:/mingw/bin:/bin:/c/Program Files/Common Files/Microsoft Shared/Windows Live:/c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/
++ pwd
/home/peda/automake/tests/distcheck-configure-flags-am.dir
+ cat
+ unset sentence
+ cat
+ aclocal-1.11a -Werror
+ automake-1.11a --foreign -Werror -Wall
+ /bin/grep -F '$(DISTCHECK_CONFIGURE_FLAGS)' Makefile.in
	    $(DISTCHECK_CONFIGURE_FLAGS) \
+ /bin/grep -F '$(AM_DISTCHECK_CONFIGURE_FLAGS)' Makefile.in
	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ grep 'DISTCHECK_CONFIGURE_FLAGS.*AM_DISTCHECK_CONFIGURE_FLAGS' Makefile.in
+ autoconf -B /no/such/dir
+ ./configure --enable-success 'sentence=it works :-)'
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
+ make distcheck
make  dist-gzip am__post_remove_distdir='@:'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir'
{ test ! -d "distcheck-configure-flags-am-1.0" || { find "distcheck-configure-flags-am-1.0" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr "distcheck-configure-flags-am-1.0"; }; }
test -d "distcheck-configure-flags-am-1.0" || mkdir "distcheck-configure-flags-am-1.0"
test -n "" \
	|| find "distcheck-configure-flags-am-1.0" -type d ! -perm -755 \
		-exec chmod u+rwx,go+rx {} \; -o \
	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -444 -exec /bin/sh /home/peda/automake/tests/distcheck-configure-flags-am.dir/install-sh -c -m a+r {} {} \; \
	|| chmod -R a+r "distcheck-configure-flags-am-1.0"
tardir=distcheck-configure-flags-am-1.0 && ${TAR-tar} chof - "$tardir" | GZIP=--best gzip -c >distcheck-configure-flags-am-1.0.tar.gz
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir'
{ test ! -d "distcheck-configure-flags-am-1.0" || { find "distcheck-configure-flags-am-1.0" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr "distcheck-configure-flags-am-1.0"; }; }
case 'distcheck-configure-flags-am-1.0.tar.gz' in \
	*.tar.gz*) \
	  GZIP=--best gzip -dc distcheck-configure-flags-am-1.0.tar.gz | ${TAR-tar} xf - ;;\
	*.tar.bz2*) \
	  bzip2 -dc distcheck-configure-flags-am-1.0.tar.bz2 | ${TAR-tar} xf - ;;\
	*.tar.lz*) \
	  lzip -dc distcheck-configure-flags-am-1.0.tar.lz | ${TAR-tar} xf - ;;\
	*.tar.xz*) \
	  xz -dc distcheck-configure-flags-am-1.0.tar.xz | ${TAR-tar} xf - ;;\
	*.tar.Z*) \
	  uncompress -c distcheck-configure-flags-am-1.0.tar.Z | ${TAR-tar} xf - ;;\
	*.shar.gz*) \
	  GZIP=--best gzip -dc distcheck-configure-flags-am-1.0.shar.gz | unshar ;;\
	*.zip*) \
	  unzip distcheck-configure-flags-am-1.0.zip ;;\
	esac
chmod -R a-w distcheck-configure-flags-am-1.0; chmod a+w distcheck-configure-flags-am-1.0
mkdir distcheck-configure-flags-am-1.0/_build
mkdir distcheck-configure-flags-am-1.0/_inst
chmod a-w distcheck-configure-flags-am-1.0
test -d distcheck-configure-flags-am-1.0/_build || exit 0; \
	dc_install_base=`CDPATH="${ZSH_VERSION+.}:" && cd distcheck-configure-flags-am-1.0/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
	  && dc_destdir="${TMPDIR-/tmp}/am-dc-$$/" \
	  && am__cwd=`pwd` \
	  && CDPATH="${ZSH_VERSION+.}:" && cd distcheck-configure-flags-am-1.0/_build \
	  && ../configure --srcdir=.. --prefix="$dc_install_base" \
	    --enable-success sentence='it works :-)'  \
	     \
	  && make  \
	  && make  dvi \
	  && make  check \
	  && make  install \
	  && make  installcheck \
	  && make  uninstall \
	  && make  distuninstallcheck_dir="$dc_install_base" \
	        distuninstallcheck \
	  && chmod -R a-w "$dc_install_base" \
	  && ({ \
	       (cd ../.. && umask 077 && mkdir "$dc_destdir") \
	       && make  DESTDIR="$dc_destdir" install \
	       && make  DESTDIR="$dc_destdir" uninstall \
	       && make  DESTDIR="$dc_destdir" \
	            distuninstallcheck_dir="$dc_destdir" distuninstallcheck; \
	      } || { rm -rf "$dc_destdir"; exit 1; }) \
	  && rm -rf "$dc_destdir" \
	  && make  dist \
	  && rm -rf distcheck-configure-flags-am-1.0.tar.gz \
	  && make  distcleancheck \
	  && cd "$am__cwd" \
	  || exit 1
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Nothing to be done for `dvi'.
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Nothing to be done for `check'.
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[2]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Nothing to be done for `installcheck'.
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Nothing to be done for `uninstall'.
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[2]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Nothing to be done for `uninstall'.
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make  dist-gzip am__post_remove_distdir='@:'
make[2]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
{ test ! -d "distcheck-configure-flags-am-1.0" || { find "distcheck-configure-flags-am-1.0" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr "distcheck-configure-flags-am-1.0"; }; }
test -d "distcheck-configure-flags-am-1.0" || mkdir "distcheck-configure-flags-am-1.0"
test -n "" \
	|| find "distcheck-configure-flags-am-1.0" -type d ! -perm -755 \
		-exec chmod u+rwx,go+rx {} \; -o \
	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -444 -exec /bin/sh /home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/install-sh -c -m a+r {} {} \; \
	|| chmod -R a+r "distcheck-configure-flags-am-1.0"
tardir=distcheck-configure-flags-am-1.0 && ${TAR-tar} chof - "$tardir" | GZIP=--best gzip -c >distcheck-configure-flags-am-1.0.tar.gz
make[2]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
{ test ! -d "distcheck-configure-flags-am-1.0" || { find "distcheck-configure-flags-am-1.0" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr "distcheck-configure-flags-am-1.0"; }; }
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
test -z "" || rm -f 
test . = ".." || test -z "" || rm -f 
rm -f config.status config.cache config.log configure.lineno config.status.lineno
rm -f Makefile
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir/distcheck-configure-flags-am-1.0/_build'
{ test ! -d "distcheck-configure-flags-am-1.0" || { find "distcheck-configure-flags-am-1.0" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr "distcheck-configure-flags-am-1.0"; }; }
==================================================================
distcheck-configure-flags-am-1.0 archives ready for distribution: 
distcheck-configure-flags-am-1.0.tar.gz
==================================================================
+ cat
+ automake-1.11a --foreign -Werror -Wall Makefile
+ ./config.status Makefile
config.status: creating Makefile
+ make distcheck
+ cat output
make  dist-gzip am__post_remove_distdir='@:'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir'
{ test ! -d "distcheck-configure-flags-am-1.0" || { find "distcheck-configure-flags-am-1.0" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr "distcheck-configure-flags-am-1.0"; }; }
test -d "distcheck-configure-flags-am-1.0" || mkdir "distcheck-configure-flags-am-1.0"
test -n "" \
	|| find "distcheck-configure-flags-am-1.0" -type d ! -perm -755 \
		-exec chmod u+rwx,go+rx {} \; -o \
	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -444 -exec /bin/sh /home/peda/automake/tests/distcheck-configure-flags-am.dir/install-sh -c -m a+r {} {} \; \
	|| chmod -R a+r "distcheck-configure-flags-am-1.0"
tardir=distcheck-configure-flags-am-1.0 && ${TAR-tar} chof - "$tardir" | GZIP=--best gzip -c >distcheck-configure-flags-am-1.0.tar.gz
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir'
{ test ! -d "distcheck-configure-flags-am-1.0" || { find "distcheck-configure-flags-am-1.0" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr "distcheck-configure-flags-am-1.0"; }; }
case 'distcheck-configure-flags-am-1.0.tar.gz' in \
	*.tar.gz*) \
	  GZIP=--best gzip -dc distcheck-configure-flags-am-1.0.tar.gz | ${TAR-tar} xf - ;;\
	*.tar.bz2*) \
	  bzip2 -dc distcheck-configure-flags-am-1.0.tar.bz2 | ${TAR-tar} xf - ;;\
	*.tar.lz*) \
	  lzip -dc distcheck-configure-flags-am-1.0.tar.lz | ${TAR-tar} xf - ;;\
	*.tar.xz*) \
	  xz -dc distcheck-configure-flags-am-1.0.tar.xz | ${TAR-tar} xf - ;;\
	*.tar.Z*) \
	  uncompress -c distcheck-configure-flags-am-1.0.tar.Z | ${TAR-tar} xf - ;;\
	*.shar.gz*) \
	  GZIP=--best gzip -dc distcheck-configure-flags-am-1.0.shar.gz | unshar ;;\
	*.zip*) \
	  unzip distcheck-configure-flags-am-1.0.zip ;;\
	esac
tar: distcheck-configure-flags-am-1.0: time stamp 2012-01-09 23:58:44 is 0.285 s in the future
chmod -R a-w distcheck-configure-flags-am-1.0; chmod a+w distcheck-configure-flags-am-1.0
mkdir distcheck-configure-flags-am-1.0/_build
mkdir distcheck-configure-flags-am-1.0/_inst
chmod a-w distcheck-configure-flags-am-1.0
test -d distcheck-configure-flags-am-1.0/_build || exit 0; \
	dc_install_base=`CDPATH="${ZSH_VERSION+.}:" && cd distcheck-configure-flags-am-1.0/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
	  && dc_destdir="${TMPDIR-/tmp}/am-dc-$$/" \
	  && am__cwd=`pwd` \
	  && CDPATH="${ZSH_VERSION+.}:" && cd distcheck-configure-flags-am-1.0/_build \
	  && ../configure --srcdir=.. --prefix="$dc_install_base" \
	    --enable-success sentence='it works :-)' --disable-success \
	     \
	  && make  \
	  && make  dvi \
	  && make  check \
	  && make  install \
	  && make  installcheck \
	  && make  uninstall \
	  && make  distuninstallcheck_dir="$dc_install_base" \
	        distuninstallcheck \
	  && chmod -R a-w "$dc_install_base" \
	  && ({ \
	       (cd ../.. && umask 077 && mkdir "$dc_destdir") \
	       && make  DESTDIR="$dc_destdir" install \
	       && make  DESTDIR="$dc_destdir" uninstall \
	       && make  DESTDIR="$dc_destdir" \
	            distuninstallcheck_dir="$dc_destdir" distuninstallcheck; \
	      } || { rm -rf "$dc_destdir"; exit 1; }) \
	  && rm -rf "$dc_destdir" \
	  && make  dist \
	  && rm -rf distcheck-configure-flags-am-1.0.tar.gz \
	  && make  distcleancheck \
	  && cd "$am__cwd" \
	  || exit 1
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
configure: error: success='no', sentence='it works :-)'
make: *** [distcheck] Error 1
+ grep '^configure:.* success='\''no'\'', sentence='\''it works :-)'\''' output
configure: error: success='no', sentence='it works :-)'
+ make distcheck DISTCHECK_CONFIGURE_FLAGS=--enable-success=yes
make  dist-gzip am__post_remove_distdir='@:'
make[1]: Entering directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir'
{ test ! -d "distcheck-configure-flags-am-1.0" || { find "distcheck-configure-flags-am-1.0" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr "distcheck-configure-flags-am-1.0"; }; }
rm: cannot remove directory `distcheck-configure-flags-am-1.0/_build': Permission denied
make[1]: *** [distdir] Error 1
make[1]: Leaving directory `/home/peda/automake/tests/distcheck-configure-flags-am.dir'
make: *** [dist] Error 2
+ exit_status=2
+ set +e
+ cd /home/peda/automake/tests
+ test no = yes
+ case $am_explicit_skips in
+ test 2 -eq 0
+ keep_testdirs=yes
+ am_keeping_testdirs
+ case $keep_testdirs in
+ return 0
+ set +x
distcheck-configure-flags-am: exit 2