From ddf3a1152d32cc950389c9cb9e7b7962e7e14f16 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Thu, 7 Feb 2019 22:17:45 -0500 Subject: [PATCH 1/2] t/lib-gpg: quote path to ${GNUPGHOME}/trustlist.txt When gpgsm is installed, lib-gpg.sh attempts to update trustlist.txt to relax the checking of some root certificate requirements. The path to "${GNUPGHOME}" contains spaces which cause an "ambiguous redirect" warning when bash is used to run the tests: $ bash t7030-verify-tag.sh /git/t/lib-gpg.sh: line 66: ${GNUPGHOME}/trustlist.txt: ambiguous redirect ok 1 - create signed tags ok 2 # skip create signed tags x509 (missing GPGSM) ... No warning is issued when using bash called as /bin/sh, dash, or mksh. Quote the path to ensure the redirect works as intended and sets the GPGSM prereq. While we're here, drop the space after ">>". Signed-off-by: Todd Zullinger Signed-off-by: Junio C Hamano --- t/lib-gpg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh index 3fe02876c1..d90160eb0b 100755 --- a/t/lib-gpg.sh +++ b/t/lib-gpg.sh @@ -60,7 +60,7 @@ then gpgsm --homedir "${GNUPGHOME}" 2>/dev/null -K \ | grep fingerprint: | cut -d" " -f4 | tr -d '\n' > \ ${GNUPGHOME}/trustlist.txt && - echo " S relax" >> ${GNUPGHOME}/trustlist.txt && + echo " S relax" >>"${GNUPGHOME}/trustlist.txt" && (gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) && echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \ -u committer@example.com -o /dev/null --sign - 2>&1 && From 2e285e7803217c56f5e86a0abdec4b7fa8bc1058 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Thu, 7 Feb 2019 22:17:46 -0500 Subject: [PATCH 2/2] t/lib-gpg: drop redundant killing of gpg-agent In 53fc999306 ("gpg-interface t: extend the existing GPG tests with GPGSM", 2018-07-20), the gpgconf call which kills gpg-agent was copied from the existing gpg setup code. The reason for killing gpg-agent is given in 29ff1f8f74 ("t: lib-gpg: flush gpg agent on startup", 2017-07-20): When running gpg-relevant tests, a gpg-daemon is spawned for each GNUPGHOME used. This daemon may stay running after the test and cache file descriptors for the trash directories, even after the trash directory is removed. This leads to ENOENT errors when attempting to create files if tests are run multiple times. Add a cleanup script to force flushing the gpg-agent for that GNUPGHOME (if any) before setting up the GPG relevant-environment. Killing gpg-agent once per test is sufficient. Signed-off-by: Todd Zullinger Signed-off-by: Junio C Hamano --- t/lib-gpg.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh index d90160eb0b..041f10171a 100755 --- a/t/lib-gpg.sh +++ b/t/lib-gpg.sh @@ -61,7 +61,6 @@ then | grep fingerprint: | cut -d" " -f4 | tr -d '\n' > \ ${GNUPGHOME}/trustlist.txt && echo " S relax" >>"${GNUPGHOME}/trustlist.txt" && - (gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) && echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \ -u committer@example.com -o /dev/null --sign - 2>&1 && test_set_prereq GPGSM