test: Stop gpg-agent daemons that are started for the test framework's gpg key
They normally shutdown when the GNUPGHOME directory is deleted, but on NFS they keep the directory from being deleted. And also, this avoids a number of them piling up while the test suite is running.
This commit is contained in:
parent
6fb7ecde35
commit
cde3e5eb0c
4 changed files with 39 additions and 4 deletions
|
@ -14,6 +14,8 @@ git-annex (8.20200815) UNRELEASED; urgency=medium
|
|||
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
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ testHarness tmpdir cmd a = ifM (inPath (unGpgCmd cmd))
|
|||
, return Nothing
|
||||
)
|
||||
where
|
||||
var = "GNUPGHOME"
|
||||
var = "GNUPGHOME"
|
||||
|
||||
setup = do
|
||||
orig <- getEnv var
|
||||
|
@ -431,9 +431,16 @@ testHarness tmpdir cmd a = ifM (inPath (unGpgCmd cmd))
|
|||
[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
|
||||
|
|
|
@ -24,3 +24,4 @@ so it seems to relate to gpg, and not unlikely to be out of git-annex control, b
|
|||
[[!meta author=yoh]]
|
||||
[[!tag projects/datalad]]
|
||||
|
||||
> [[fixed|done]] --[[Joey]]
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
[[!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.
|
||||
"""]]
|
Loading…
Reference in a new issue