autoinit.
* Display a message when git-annex has to wait for a pid lock file
held by another process.
+ * test: Stop gpg-agent daemons that are started for the test framework's
+ gpg key.
-- Joey Hess <id@joeyh.name> Fri, 14 Aug 2020 14:57:45 -0400
, return Nothing
)
where
- var = "GNUPGHOME"
+ var = "GNUPGHOME"
setup = do
orig <- getEnv var
[testSecretKey, testKey]
return orig
- cleanup (Just (Just v)) = setEnv var v True
- cleanup (Just Nothing) = unsetEnv var
- cleanup Nothing = return ()
+ cleanup (Just (Just v)) = stopgpgagent >> setEnv var v True
+ cleanup (Just Nothing) = stopgpgagent >> unsetEnv var
+ cleanup Nothing = stopgpgagent
+
+ -- Recent versions of gpg automatically start gpg-agent, or perhaps
+ -- other daemons. Stop them when done. This only affects
+ -- daemons started for the GNUPGHOME that was used.
+ -- Older gpg may not support this, so ignore failure.
+ stopgpgagent = void $ boolSystem "gpgconf"
+ [Param "--kill", Param "all"]
go (Just _) = Just <$> a
go Nothing = return Nothing
--- /dev/null
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2020-08-28T17:17:07Z"
+ content="""
+This may depend on the version of gpg in use. With latest version, I see:
+
+ 374404 ? Ss 0:00 gpg-agent --homedir /home/joey/src/git-annex/.t/tmprepo85/../gpgtmp/1 --use-standard-socket --daemon
+ 374411 ? Ss 0:01 gpg-agent --homedir /home/joey/src/git-annex/.t/tmprepo85/../gpgtmp/2 --use-standard-socket --daemon
+
+12 of these build up by the end of the test suite. But here when the test suite
+exits, they all terminate.
+
+Presumably they have a deleted file they're holding open, which causes NFS to
+break in the ususal NFS way. Here they have an inotify handle, and some kind of
+socket. Based on the .nfs filename, which I think usually includes the name of
+the deleted file but here does not, I suspect it might be for the directory
+itself, and so due to the inotify handle.
+
+Ah, I think I see.. When I delete the directory, gpg-agent notices
+and exits.
+
+`gpgconf --kill all` can be used to stop them, so I've made the test
+suide do that after using gpg.
+"""]]