summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-01-11 18:09:07 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-01-13 12:41:03 +0100
commitdfb5e52f5f52fda733f1a6d27680fc347ba17286 (patch)
treeef0170ae1fe8c33c09f42b9e8f312cf587f11c5d /lib
parent657eed2e1b1f2e0fac19f4c840b72a71ec6e1141 (diff)
downloadautomake-dfb5e52f5f52fda733f1a6d27680fc347ba17286.tar.gz
dist: avoid $(distdir) removal failure on MSYS/MinGW
This change fixes automake bug#10470. On MSYS (1.0.17) it is not possible to remove a directory that is in use, and this, together with timing issues, could cause spurious failures in the cleanup code of the "distcheck" recipe. In fact, it should be noted that assuming a directory can be removed while it the CWD of a running process is a POSIX violation: "If the directory is the root directory or the current working directory of any process, it is unspecified whether the function succeeds, or whether it shall fail and set errno to [EBUSY]." * lib/am/distdir.am (am__remove_distdir): If rm fails, sleep some seconds and retry, to give potential "pending" processes some time to exit and "release" the directory. * tests/Makefile.am (XFAIL_TESTS): Remove 'distcheck-pr10470.test'. Report and suggestions by Peter Rosin and Eric Blake.
Diffstat (limited to 'lib')
-rw-r--r--lib/am/distdir.am17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index a681101e0..cd2e4bf5f 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -1,6 +1,6 @@
## automake - create Makefile.in from Makefile.am
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-## 2010, 2011 Free Software Foundation, Inc.
+## 2010, 2011, 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
@@ -23,10 +23,17 @@ distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
- { test ! -d "$(distdir)" \
- || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
- && rm -fr "$(distdir)"; }; }
-
+ if test -d "$(distdir)"; then \
+ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -rf "$(distdir)" \
+## 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 remove it. The value of "some seconds" is 5 for the moment,
+## which is mostly an arbitrary value, but seems high enough in practice.
+## See automake bug#10470.
+ || { sleep 5 && rm -rf "$(distdir)"; }; \
+ else :; fi
endif %?TOPDIR_P%
if %?SUBDIRS%