From 6e4fee1faf9193cd6efa9b93aafe5044779fd2d0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 18 Oct 2016 16:56:38 -0400 Subject: [PATCH] test: Deal with gpg-agent behavior change that broke the test suite. 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 | 1 + Utility/Gpg.hs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 8307252e77..4fe08d537d 100644 --- 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 Mon, 17 Oct 2016 12:46:54 -0400 diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs index af740c3e0e..21171b6fb0 100644 --- a/Utility/Gpg.hs +++ b/Utility/Gpg.hs @@ -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