test: Deal with gpg-agent behavior change that broke the test suite.
authorJoey Hess <joeyh@joeyh.name>
Tue, 18 Oct 2016 20:56:38 +0000 (16:56 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 18 Oct 2016 20:56:38 +0000 (16:56 -0400)
gpg-agent started deleting its socket file on shutdown, and this tickled an
ugly behavior in removeDirectoryRecursive,
https://github.com/haskell/directory/issues/60

Running removeDirectoryRecursive again on exception avoids the problem.

CHANGELOG
Utility/Gpg.hs

index 8307252e7754c3035213793e032322ec829a5fb8..4fe08d537d808a8a36589cacf717939d9fb7030a 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,7 @@ git-annex (6.20161013) UNRELEASED; urgency=medium
     Thanks, James MacMahon.
   * Assistant, repair: Improved filtering out of git fsck lines about
     duplicate file entries in tree objects.
+  * test: Deal with gpg-agent behavior change that broke the test suite.
 
  -- Joey Hess <id@joeyh.name>  Mon, 17 Oct 2016 12:46:54 -0400
 
index af740c3e0e4c21f7d3d38a5b3ee5dc2436a55330..21171b6fb02946b1c140fd115f9475e605a1fac4 100644 (file)
@@ -352,7 +352,14 @@ testHarness cmd a = do
                        [testSecretKey, testKey]
                return dir
                
-       cleanup orig tmpdir = removeDirectoryRecursive tmpdir >> reset orig
+       cleanup orig tmpdir = do
+               removeDirectoryRecursive tmpdir
+                       -- gpg-agent may be shutting down at the same time
+                       -- and may delete its socket at the same time as
+                       -- we're trying to, causing an exception. Retrying
+                       -- will deal with this race.
+                       `catchIO` (\_ -> removeDirectoryRecursive tmpdir)
+               reset orig
        reset (Just v) = setEnv var v True
        reset _ = unsetEnv var