{"thread":{"id":"46431","subject":"[PATCH v2] t: lib-gpg: flush gpg agent on startup","startedAt":"2017-07-20T21:06:04Z","lastAt":"2017-07-20T21:06:04Z","messageCount":1,"participants":["santiago@nyu.edu"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"324840","messageId":"20170720210552.3076-1-santiago@nyu.edu","threadId":"46431","inReplyTo":null,"subject":"[PATCH v2] t: lib-gpg: flush gpg agent on startup","fromName":"","fromEmail":"santiago@nyu.edu","sentAt":"2017-07-20T21:05:52Z","receivedAt":"2017-07-20T21:06:04Z","isPatch":true,"sender":{"key":"santiago@nyu.edu","avatar":"https://avatars.githubusercontent.com/u/3579933?v=4"},"body":"From: Santiago Torres <santiago@nyu.edu>\n\nWhen running gpg-relevant tests, a gpg-daemon is spawned for each\nGNUPGHOME used. This daemon may stay running after the test and cache\nfile descriptors for the trash directories, even after the trash\ndirectory is removed. This leads to ENOENT errors when attempting to\ncreate files if tests are run multiple times.\n\nAdd a cleanup script to force flushing the gpg-agent for that GNUPGHOME\n(if any) before setting up the GPG relevant-environment.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Santiago Torres <santiago@nyu.edu>\n---\n t/lib-gpg.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/lib-gpg.sh b/t/lib-gpg.sh\nindex ec2aa8f68..43679a4c6 100755\n--- a/t/lib-gpg.sh\n+++ b/t/lib-gpg.sh\n@@ -31,6 +31,7 @@ then\n \t\tchmod 0700 ./gpghome &&\n \t\tGNUPGHOME=\"$(pwd)/gpghome\" &&\n \t\texport GNUPGHOME &&\n+\t\t(gpgconf --kill gpg-agent 2>&1 >/dev/null || : ) &&\n \t\tgpg --homedir \"${GNUPGHOME}\" 2>/dev/null --import \\\n \t\t\t\"$TEST_DIRECTORY\"/lib-gpg/keyring.gpg &&\n \t\tgpg --homedir \"${GNUPGHOME}\" 2>/dev/null --import-ownertrust \\\n-- \n2.13.3\n\n"}]}